Skip to content

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

CJK: document kenten, shatai, grid, ruby and ICF status

aiongg30778c14a547
diff --git a/ROADMAP.md b/ROADMAP.md
index 86a435456..875b4f898 100644
--- a/ROADMAP.md
+++ b/ROADMAP.md
@@ -5,7 +5,7 @@
- AR1.1: Kashida justification tests verify space fallback without Tatweel fonts using an isolated font database, while retaining elongation assertions when fonts support it.
- AR1: Arabic IDML controls now retain character direction, kashida switches, diacritic offsets/forms, paragraph policy values and independent story/table directions. Shaping preserves joining context and script/language selection; paragraph-level bidi, contextual digit conversion, mark-safe elongation, RTL columns/tables and physical column insertion have regression coverage. Vendor-specific justification and diacritic presets remain explicit preflight warnings; see docs/arabic-typography.md.
-- CJK1: IDML composite fonts now retain character mappings and metrics; explicit aki, tsume, jidori, em alignment/leading, named/custom kinsoku boundaries, hanging punctuation, tate-chu-yoko offsets and kenten symbols flow through composition and IDML export. Automatic kerning no longer imports inactive numeric values as enormous manual spacing. Composite definitions are editable through commands with undo/cache invalidation. Mojikumi definitions are retained and unsupported spacing-table / push-in-push-out policies are reported by preflight. Full InDesign CJK composition parity, frame-grid layout and detailed ruby remain unfinished. Warichu sets the selected run in smaller lines inside the line after the line is broken.
+- CJK1: IDML composite fonts now retain character mappings and metrics; explicit aki, tsume, jidori, em alignment/leading, named/custom kinsoku boundaries, hanging punctuation, tate-chu-yoko offsets and kenten symbols flow through composition and IDML export. Automatic kerning no longer imports inactive numeric values as enormous manual spacing. Composite definitions are editable through commands with undo/cache invalidation. Mojikumi definitions are retained and unsupported spacing-table / push-in-push-out policies are reported by preflight. Kenten settings (kind, custom mark and font, size, scale, distance, position, alignment, colour), shatai, auto tate-chu-yoko, rotate roman, roman word break and grid alignment references with gyoudori and paragraph gyoudori are composed and round-trip through IDML (`type.kenten`, `type.shatai`, `type.autoTateChuYoko`, `type.rotateRoman`, `type.romanWordBreak`, `type.gridSettings`); ICF top and bottom come from the font's `BASE` table. Full InDesign CJK composition parity and frame-grid layout remain unfinished. Warichu sets the selected run in smaller lines inside the line after the line is broken.
DesignCraft aims at full Adobe InDesign parity — and to be better: faster, open (documented JSON format + IDML), scriptable by agents (MCP), and available on the web.
@@ -119,7 +119,7 @@ DesignCraft aims at full Adobe InDesign parity — and to be better: faster, ope
- Keyboard: Tab / Shift+Tab hide and show all panels / all but Tools (`window.hidePanels`, `window.hidePanelsExceptTools`); Cmd+F6 / Cmd+Shift+F6 cycle documents; panel fields are reached with Tab and Escape returns to the layout.
- Smart guides and snapping (View ▸ Snap to Guides / Snap to Document Grid / Smart Guides, `view.snapPreferences` and Preferences ▸ Guides & Pasteboard): moving, drawing, resizing, rotating and pen/anchor drags snap in order to the document and baseline grids, ruler guides, margins and columns, other objects' edges and centres (parent-page items too, by visible stroked bounds), equal spacing, matching dimensions and matching rotation, with guides, gap marks and measurements drawn on the canvas. Shift and Cmd constrain the gesture.
- View ▸ Rotate Spread (`view.rotateSpread`, `layout.rotateSpreadView`): the spread in view turns in quarter turns on screen (stored with the document; output is unaffected). The canvas maps each spread through its own transform, so tools, snapping, resize handles, guides, overlays and rendering all follow the turned spread.
-- Vertical type (Vertical Type Tool, Type ▸ Story Direction `type.storyDirection`, IDML StoryOrientation): the direction belongs to the story, so every frame of a thread is vertical or horizontal together and a frame threaded onto a story takes its direction (`object.textFrameOptions {vertical}` sets the frames' stories); lines run top to bottom and follow each other right to left; the arrow keys follow them (Down and Up along the line, Left and Right to the next and previous line, keeping the position along it); CJK characters stay upright and other text turns, on screen and in PDF; CJK line breaking with basic kinsoku (also in horizontal text); Korean breaks at spaces, word by word (Hangul in any language, hanja in Korean text), or between syllables when the paragraph asks for it (`type.para {koreanCharBreaks}`, Paragraph Style Options ▸ Justification; not written to IDML). Upright text is shaped top to bottom: punctuation and brackets take their vertical forms (OpenType `vert`; `vkrn` and `vpal` through OpenType features), glyphs advance by their vertical metrics (`vmtx`) and hang from their vertical origins (`VORG`) on the centre of the ideographic em box (`BASE`, else OS/2), which the first line's ascent follows; turned text keeps its horizontal forms. Tate-chu-yoko (Type ▸ Tate-Chu-Yoko, `type.tateChuYoko`, IDML `Tatechuyoko`) sets a run such as "12" side by side within one em of the line. Ruby (Type ▸ Ruby…, `type.ruby`, IDML RubyString; group ruby spread 1-2-1 or centred) and kenten emphasis dots (`type.kenten`, IDML KentenKind) are set over their text — to its right in vertical frames — without changing line breaks. Warichu and ruby options (per-character ruby, positions, overhang) aren't there yet.
+- Vertical type (Vertical Type Tool, Type ▸ Story Direction `type.storyDirection`, IDML StoryOrientation): the direction belongs to the story, so every frame of a thread is vertical or horizontal together and a frame threaded onto a story takes its direction (`object.textFrameOptions {vertical}` sets the frames' stories); lines run top to bottom and follow each other right to left; the arrow keys follow them (Down and Up along the line, Left and Right to the next and previous line, keeping the position along it); CJK characters stay upright and other text turns, on screen and in PDF; CJK line breaking with basic kinsoku (also in horizontal text); Korean breaks at spaces, word by word (Hangul in any language, hanja in Korean text), or between syllables when the paragraph asks for it (`type.para {koreanCharBreaks}`, Paragraph Style Options ▸ Justification; not written to IDML). Upright text is shaped top to bottom: punctuation and brackets take their vertical forms (OpenType `vert`; `vkrn` and `vpal` through OpenType features), glyphs advance by their vertical metrics (`vmtx`) and hang from their vertical origins (`VORG`) on the centre of the ideographic em box (`BASE`, else OS/2), which the first line's ascent follows; turned text keeps its horizontal forms. Tate-chu-yoko (Type ▸ Tate-Chu-Yoko, `type.tateChuYoko`, IDML `Tatechuyoko`) sets a run such as "12" side by side within one em of the line. Ruby (Type ▸ Ruby…, `type.ruby`, IDML `Ruby*`): group and per-character (jukugo) ruby with every placement, font, overhang, parent-spacing, auto-scaling and colour setting of InDesign's four ruby panes, set over the text (to its right in vertical frames) or under it, and beyond kenten on the same side; longer ruby spaces its parent out before line breaking and keeps its group on the line of each neighbour it overhangs. Kenten emphasis marks (`type.kenten`, IDML `Kenten*`) are set beside their text. Ruby and kenten overprint shows in Overprint Preview; PDF export writes no overprint.
- Math expressions (Type ▸ Insert Math Expression…, `math.insert`, `math.svg`): a LaTeX subset (fractions, scripts, roots, big operators with limits, Greek, relations and operators with math spacing, `\left…\right`, `\text`) typeset by our own engine into SVG, placed inline at the cursor or as a frame; the LaTeX is kept as alt text and can be edited.
- Object Layer Options for placed PDFs (`object.pdfLayers`, `object.layerOptions`, Object ▸ Object Layer Options…): the file's optional-content layers listed and shown or hidden per frame on screen; in exported PDFs such graphics go out as 300 ppi images of their visible layers.
- Effects: Inner Glow (edge or centre), Bevel and Emboss (inner bevel lit from the light angle), Satin (`object.innerGlow`, `object.bevel`, `object.satin`); PDF export now keeps soft effects: objects with shadows, glows, feathers, bevels or satin go out as 300 ppi transparent images of their appearance (threaded text frames excepted).
diff --git a/docs/cjk.md b/docs/cjk.md
index 58a322bed..740aad859 100644
--- a/docs/cjk.md
+++ b/docs/cjk.md
@@ -37,10 +37,13 @@ presets or tables are copied. Our default mojikumi and kinsoku tables are built
| Korean line breaking | at spaces (Hangul everywhere, hanja in Korean text); per-paragraph character-based breaking (`koreanCharBreaks`); DesignCraft-only, not in IDML |
| Mojikumi | tables and paragraph references kept through IDML; not applied (Preflight says so) |
| Aki, tsume, jidori | done ([cjk-typography.md](cjk-typography.md)) |
-| Character alignment, leading model | em box top / centre / bottom, ICF from ascender and descender, roman baseline; aki above / below, centre (centre down as centre) |
-| Tate-chu-yoko | manual, with offsets; no auto, 3+ digits overflow the em |
-| Ruby | group and per-character (jukugo) ruby; alignment (shoulder, centre, end, justify, JIS 1-2-1, equal aki, 1 ruby-character aki); above/right or below/left with offsets; font, size (½ by default), scales, OpenType `ruby` glyphs, auto tate-chu-yoko of digits; overhang onto kana and punctuation; parent spacing and automatic narrowing when the ruby is longer; flush with the line edge; fill, stroke, tint, weight and overprint fill on screen; every setting through `type.ruby` and IDML. Doesn't affect leading; overprint stroke isn't drawn and PDF has no overprint |
-| Kenten | the IDML kinds and a custom character, drawn as characters; no position, size, alignment, colour or font |
+| Character alignment, leading model | em box top / centre / bottom, ICF top / bottom (`BASE` `icft`/`icfb`, else the em box inset by 5%), roman baseline; aki above / below, centre (centre down as centre) |
+| Tate-chu-yoko | manual, with offsets; auto tate-chu-yoko of short digit runs (with roman letters when asked) in vertical text, narrowed to fit the em (`type.autoTateChuYoko`, IDML `AutoTcy`, `AutoTcyIncludeRoman`); manual groups of 3+ digits overflow the em |
+| Ruby | group and per-character (jukugo) ruby; alignment (shoulder, centre, end, justify, JIS 1-2-1, equal aki, 1 ruby-character aki); above/right or below/left with offsets; font, size (½ by default), scales, OpenType `ruby` glyphs, auto tate-chu-yoko of digits; overhang onto kana and punctuation; parent spacing and automatic narrowing when the ruby is longer; flush with the line edge (a group stays on the line of each neighbour its ruby overhangs, so the reserved spacing holds at line edges); set beyond kenten on the same side; fill, stroke, tint, weight, and overprint in Overprint Preview; every setting through `type.ruby` and IDML. Doesn't affect leading; PDF export writes no overprint (Preflight and the export say so) |
+| Kenten | the kinds and a custom mark (up to 8 characters) in its own font; size, x/y scale, distance, above/right or below/left, centred or at the character's start; fill, stroke, tints, weight, and overprint in Overprint Preview (`type.kenten`, IDML `Kenten*`). The character set (input mode) is kept, not converted; PDF export writes no overprint |
+| Shatai | magnification, angle, adjust rotation and adjust tsume on screen, in PDF, outlines and type on a path (`type.shatai`, IDML `Shatai*`) |
+| Rotate roman, roman word break | half-width characters upright in vertical text (`type.rotateRoman`, IDML `RotateSingleByteCharacters`); breaks between Latin, Greek or Cyrillic letters without a hyphen (`type.romanWordBreak`, IDML `AllowArbitraryHyphenation`) |
+| Grid alignment | against the baseline grid: roman baseline, em box top / centre / bottom, ICF top / bottom; first line only; gyoudori (auto or N grid lines) and paragraph gyoudori (`type.gridSettings`, IDML `GridAlignment`, `GridGyoudori`, `ParagraphGyoudori`). No frame grid; vertical frames have no baseline grid |
| Composite fonts | done: model, `style.compositeFont.*`, shaping, IDML, font list, replace and Preflight; no dialog |
| Languages | Japanese, Korean, Simplified and Traditional Chinese reach the shaper (`locl`), font fallback, line breaking and typographer's quotes; IDML language names are kept as written; locale codes (`ja_JP`, `ko-KR`, `de_DE_2006`) are their language and region, and Chinese is also recognised in its common spellings ("Simplified Chinese", "Chinese (Traditional)", `zh_CN`, `zh-Hant`) |
| Missing glyphs | as in InDesign: characters the applied font lacks are drawn as its missing-glyph box (screen and PDF) and listed by Preflight; the document setting Draw Missing Glyphs from Fallback Fonts (Preferences › Composition, off in new documents and IDML imports, on in documents saved before it existed) draws them from fallback fonts instead |
@@ -115,12 +118,7 @@ working (tsume removes the side bearings before mojikumi runs).
All set after line layout like today's ruby, but able to affect line height:
-- **Ruby**: per-character (mono), group and jukugo ruby; alignment (1-2-1, centre, left/right,
- equal space, JIS rule), position (above/right, below/left), size, font, colour, x/y scale,
- offsets, overhang onto neighbours (none / ½ / 1 ruby character / ½ base / unlimited), automatic
- scaling, spacing to the base, "ruby adjusts leading".
-- **Kenten**: position, size, alignment, colour, font (the kinds and a custom character are
- there).
+- **Ruby**: "ruby adjusts leading" (every other setting is in place; see the table above).
- **Warichu**: an inline run set in 2+ smaller lines inside one line height, with size, line
spacing, alignment and breaking rules. Type › Warichu (`type.warichu`) does this after the
line is broken: the run is scaled and stacked, and the rest of that line closes up. It does
@@ -134,13 +132,10 @@ All set after line layout like today's ruby, but able to affect line height:
left as body text. IDML reads and writes `Warichu`, `WarichuLines`, `WarichuSize`,
`WarichuLineSpacing`, `WarichuAlignment`, `WarichuCharsBeforeBreak` and
`WarichuCharsAfterBreak`.
-- **Tate-chu-yoko**: scale-to-fit-em, automatic TCY for runs of N digits (with or without
- Latin), rensuji (offsets are there).
-- **Shatai** (oblique in the CJK sense: angle and magnification, keeping the em box),
- **character rotation**.
-- **Character alignment and leading model**: ICF top and bottom from the font's ideographic
- character face (`BASE` `icft`/`icfb`) rather than its ascender and descender, and centre down
- as its own model.
+- **Tate-chu-yoko**: scale-to-fit-em for manual groups, rensuji (offsets and automatic TCY are
+ there).
+- **Character rotation**.
+- **Leading model**: centre down as its own model.
Jidori, tsume, aki before and after, em-box alignment and the other leading models are in place
([cjk-typography.md](cjk-typography.md)).
@@ -201,25 +196,29 @@ as a command regardless of the feature set (agents, MCP).
## IDML attributes to support
-Already read and written: `KentenKind`, `KentenCustomCharacter`, `RubyFlag`, `RubyString`,
+Already read and written: `KentenKind`, `KentenCustomCharacter`, `KentenFont`, `KentenFontStyle`,
+`KentenFontSize`, `KentenXScale`, `KentenYScale`, `KentenPlacement`, `KentenPosition`,
+`KentenAlignment`, `KentenCharacterSet`, `KentenFillColor`, `KentenStrokeColor`, `KentenTint`,
+`KentenStrokeTint`, `KentenWeight`, `KentenOverprintFill`, `KentenOverprintStroke`,
+`ShataiMagnification`, `ShataiDegreeAngle`, `ShataiAdjustRotation`, `ShataiAdjustTsume`,
+`RubyFlag` (written as `1`), `RubyString`, `RubyType`, `RubyAlignment`, `RubyPosition`,
+`RubyXOffset`, `RubyYOffset`, `RubyFont`, `RubyFontStyle`, `RubyFontSize`, `RubyXScale`,
+`RubyYScale`, `RubyOpenTypePro`, `RubyAutoTcyDigits`, `RubyAutoTcyIncludeRoman`,
+`RubyAutoTcyAutoScale`, `RubyOverhang`, `RubyParentOverhangAmount`, `RubyParentSpacing`,
+`RubyAutoAlign`, `RubyAutoScaling`, `RubyParentScalingPercent`, `RubyFill`, `RubyStroke`,
+`RubyTint`, `RubyStrokeTint`, `RubyWeight`, `RubyOverprintFill`, `RubyOverprintStroke`;
+paragraph `AutoTcy`, `AutoTcyIncludeRoman`, `RotateSingleByteCharacters`,
+`AllowArbitraryHyphenation`, `GridAlignment`, `GridAlignFirstLineOnly`, `GridGyoudori`,
+`ParagraphGyoudori`; the `Warichu*` attributes;
`Tatechuyoko`, `TatechuyokoXOffset`, `TatechuyokoYOffset`, `Jidori`, `Tsume`, `LeadingAki`,
`TrailingAki`, `CharacterAlignment`, `LeadingModel`, `GlyphForm`, `OTFProportionalMetrics`,
`OTFHVKana`, `OTFRomanItalics`; paragraph `KinsokuSet`, `KinsokuType`, `KinsokuHangType`,
`BunriKinshi`, `Rensuuji`, `MojikumiTable`, `TreatIdeographicSpaceAsSpace`; resources
`KinsokuTable`, `MojikumiTable`, `CompositeFont`, `StoryPreference` direction.
-Character: `KentenFont`, `KentenFontStyle`, `KentenSize`, `KentenPosition`, `KentenAlignment`,
-`KentenCharacterSet`, `KentenXScale`, `KentenYScale`, `KentenFillColor`/`Tint`, `RubyType`,
-`RubyAlignment`, `RubyPosition`, `RubyFont`, `RubyFontStyle`, `RubyFontSize`, `RubyXScale`,
-`RubyYScale`, `RubyXOffset`, `RubyYOffset`, `RubyOverhang`, `RubyParentSpacing`,
-`RubyParentOverhangAmount`, `RubyAutoAlign`, `RubyAutoScaling`, `RubyAutoTcyDigits`, `Rensuji`,
-`CharacterRotation`, `ShataiMagnification`, `ShataiDegreeAngle`, `ShataiAdjustRotation`,
-`ShataiAdjustTsume`, `Warichu`, `WarichuLines`, `WarichuSize`, `WarichuLineSpacing`,
-`WarichuAlignment`, `WarichuCharsBeforeBreak`, `WarichuCharsAfterBreak`.
-
-Paragraph: `Composer` (the Japanese composers), `GridAlignment` (all values),
-`GridAlignFirstLineOnly`, `GridGyoudori`, `ParagraphGyoudori`, `CjkGridTracking`, `AutoTcy`,
-`AutoTcyIncludeRoman`, `RotateSingleByteCharacters`, `ScaleAffectsLineHeight`.
+Character: `Rensuji`, `CharacterRotation`.
+
+Paragraph: `Composer` (the Japanese composers), `CjkGridTracking`, `ScaleAffectsLineHeight`.
Resources: `MojikumiTableSet`, `NamedGrid`, layout grid and frame grid preferences,
`StoryPreference` orientation.