Skip to content

DesignCraft: An open-source page and layout design editor written by scratch in pure Rust

Docs: explain hyphenation defaults and image fitting modes to agents

KnottyDyes97b753619a51
diff --git a/crates/engine/src/cmd/object.rs b/crates/engine/src/cmd/object.rs
index 17c44c27a..82e27833f 100644
--- a/crates/engine/src/cmd/object.rs
+++ b/crates/engine/src/cmd/object.rs
@@ -543,7 +543,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
),
diff --git a/crates/engine/src/cmd/text.rs b/crates/engine/src/cmd/text.rs
index 4950d82b9..78e356567 100644
--- a/crates/engine/src/cmd/text.rs
+++ b/crates/engine/src/cmd/text.rs
@@ -135,7 +135,7 @@ pub fn specs() -> Vec<CommandSpec> {
"Paragraph Formatting",
[],
None,
- "{attrs: {align?, leftIndent?, firstLineIndent?, spaceBefore?, spaceAfter?, dropCapLines?, 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?, 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))
),
diff --git a/docs/mcp.md b/docs/mcp.md
index 772f8a91f..f85e7691c 100644
--- a/docs/mcp.md
+++ b/docs/mcp.md
@@ -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 |