Repository navigation
Type: Top-to-Top Leading — leading measured from em box top to em box top - #385
Merged
Merged
Conversation
4 tasks done
… top Japanese layout measures leading from the top of one line's ideographic em box to the next (the right side, in vertical type), not from baseline to baseline. The Paragraph panel menu now offers both: - `ParaStyle.leading_model`: RomanBaseline (as before, the default) or EmBoxTop. With EmBoxTop a line's leading is the space below it — the next line's em box top is this line's plus its leading, and the next baseline hangs from there by that line's tallest em box — and area type's first line touches the top of the frame (its em box top on the frame's top, at least Area Type Options' minimum). With baseline leading a line's leading stays the space above it. - Lines of one size are exactly as far apart either way; the models differ for mixed sizes and for the first line of area type (fonts whose ascent isn't the em box top: Hiragino's nearly is). - The em box top comes from the font's vertical metrics (storytold#343), else 0.88 em. Written only when EmBoxTop. - `text.setFormat {leadingModel: "romanBaseline"|"emBoxTop"}`; menu items Top-to-Top Leading / Bottom-to-Bottom Leading (checked as set); catalog rows in ja and zh-hant. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- The em box top that Top-to-Top Leading asks of every glyph's line metrics parsed the font's cmap and vertical metrics per glyph on every layout: each face now reads it once. - The Paragraph panel menu shows Top-to-Top / Bottom-to-Bottom Leading with the East Asian options (Preferences › Type), as the Mojikumi Set does, and Reset Panel goes back to Bottom-to-Bottom Leading, the default. - Saved as `leading_model`, like the other paragraph attributes in files. - Simplified Chinese (landed since) translates the two menu items. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
bflatastic
force-pushed
the
pr/ja-leading
branch
from
October 7, 2026 23:38
7125a01 to
5865e4c
Compare
Member
|
Thank you @imachus, merged! Top-to-Top Leading is clean, and the file format stays readable by older builds. I rebased it on main, fitting the field into the new
Checked live: Top-to-Top moves area type's first line so its em box touches the frame top, at the same line pitch. Over MCP, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
Japanese layout measures leading from the top of one line's ideographic
em box to the next (the right side, in vertical type), not from baseline
to baseline. The Paragraph panel menu now offers both:
ParaStyle.leading_model: RomanBaseline (as before, the default) orEmBoxTop. With EmBoxTop a line's leading is the space below it — the
next line's em box top is this line's plus its leading, and the next
baseline hangs from there by that line's tallest em box — and area
type's first line touches the top of the frame (its em box top on the
frame's top, at least Area Type Options' minimum). With baseline
leading a line's leading stays the space above it.
differ for mixed sizes and for the first line of area type (fonts
whose ascent isn't the em box top: Hiragino's nearly is).
0.88 em. Written only when EmBoxTop.
text.setFormat {leadingModel: "romanBaseline"|"emBoxTop"}; menu itemsTop-to-Top Leading / Bottom-to-Bottom Leading (checked as set); catalog
rows in ja and zh-hant.
The default stays baseline to baseline, so no existing or new document changes unless the paragraph is set to Top-to-Top. Japanese layout apps usually default to Top-to-Top for Japanese type; whether VectorCraft's new type should too (it would move area type's first line for every font whose ascent isn't its em box top) is left for a separate decision.
How it was tested
cargo testpasses (3,573), with new tests: area type's first line flush with the frame top; lines of one size equally spaced in both models; 40 pt over 20 pt spaced by the big line's leading (Top-to-Top) vs the small line's (baseline); text.setFormat, its error, undo, and saved only when Top-to-Top.cargo fmt --check,cargo clippy --workspace --all-targets -D warnings,cargo xtask brands,layers,assetspass; the web build compiles.Checklist
cargo xtask cipasses (fmt, clippy, tests, assets, brands, layers, wasm).🤖 Generated with Claude Code