mirror of
https://github.com/storytold/designcraft.git
synced 2026-10-24 10:16:59 -06:00
Merge #463: Docs: explain hyphenation defaults and image fitting modes to agents
Conflict: crates/engine/src/cmd/text.rs: text.formatParagraph params doc keeps next's drop-cap fields and adds the PR's "hyphenate?: bool (default true)"
This commit is contained in:
@@ -525,7 +525,7 @@ pub fn specs() -> Vec<CommandSpec> {
|
||||
"Fitting",
|
||||
["Object", "Fitting"],
|
||||
None,
|
||||
"{mode: fillProportionally|fitProportionally|fitContentToFrame|centerContent|fitFrameToContent, ids?}",
|
||||
"{mode: fillProportionally (preserves aspect ratio, covers frame, clips overflow)|fitProportionally (preserves aspect ratio, shows whole image, may leave empty space)|fitContentToFrame (stretches content to frame)|centerContent (keeps current size, positions at fitting alignment)|fitFrameToContent (resizes frame to content), ids?}",
|
||||
has_selection,
|
||||
fit
|
||||
),
|
||||
|
||||
@@ -138,7 +138,7 @@ pub fn specs() -> Vec<CommandSpec> {
|
||||
"Paragraph Formatting",
|
||||
[],
|
||||
None,
|
||||
"{attrs: {align?, leftIndent?, firstLineIndent?, spaceBefore?, spaceAfter?, dropCapLines?, dropCapChars?, dropCapStyle?, dropCapAlignLeft?, dropCapScaleDescenders?, hyphenate?, composer?, tabs?, ruleAbove?/ruleBelow?: {on?, weight?, color?, tint?, columnWidth?, offset?, leftIndent?, rightIndent?} (only the named rule fields change), …}}",
|
||||
"{attrs: {align?, leftIndent?, firstLineIndent?, spaceBefore?, spaceAfter?, dropCapLines?, dropCapChars?, dropCapStyle?, dropCapAlignLeft?, dropCapScaleDescenders?, hyphenate?: bool (default true), composer?, tabs?, ruleAbove?/ruleBelow?: {on?, weight?, color?, tint?, columnWidth?, offset?, leftIndent?, rightIndent?} (only the named rule fields change), …}}",
|
||||
has_text_or_frames,
|
||||
|s, p| format_paras(s, p.get("attrs").unwrap_or(p))
|
||||
),
|
||||
|
||||
+21
@@ -68,6 +68,27 @@ and `text.move` return, a story's `length` in `get_story` and `inspect_document`
|
||||
`get_story`. A character outside ASCII takes 2 to 4 bytes (é 2, — and は 3), so the story `はただ商店` has length 15
|
||||
and its second character starts at 3. An offset inside a character snaps back to the start of that character.
|
||||
|
||||
## Text and image fitting
|
||||
|
||||
Hyphenation is on by default for new text (`hyphenate: true`). To turn it off, select the text or a text frame,
|
||||
then call `execute`:
|
||||
|
||||
```text
|
||||
execute {"command": "type.para", "params": {"attrs": {"hyphenate": false}}}
|
||||
```
|
||||
|
||||
With a text selection, this formats the selected paragraphs; with selected text frames, it formats their whole stories.
|
||||
|
||||
Use `execute` with `object.fit` to fit a selected graphic frame (or pass `ids`):
|
||||
|
||||
| `mode` | What it does |
|
||||
|---|---|
|
||||
| `fillProportionally` | Preserves aspect ratio, covers the frame and clips overflow. |
|
||||
| `fitProportionally` | Preserves aspect ratio, shows the whole image and may leave empty space. |
|
||||
| `fitContentToFrame` | Stretches the content to the frame's width and height. |
|
||||
| `centerContent` | Keeps the current size and positions content at the fitting alignment (center by default). |
|
||||
| `fitFrameToContent` | Resizes the frame to the content's bounds. |
|
||||
|
||||
## Tools
|
||||
|
||||
| Tool | What it does |
|
||||
|
||||
Reference in New Issue
Block a user