fix(text): give the text engine glyph fallback, real units, and the fonts asked for - #153
Merged
LeadcodeDev merged 1 commit intoAug 8, 2026
Conversation
…onts asked for Ten confirmed audit findings on text measure/paint. Three of them make text that is simply never legible; four more make the geometry validator blind to overflow it is supposed to catch, because measure and paint disagree. - No missing-glyph fallback: any non-Latin text (CJK, Arabic, Devanagari) rendered as tofu boxes. The engine picked one typeface and drew whatever it produced, including .notdef. - `line-height` in `%` or `em` resolved to 0 at measure time, so taffy reserved a zero-height box and the text was never painted at all. - `letter-spacing` in relative units was resolved at paint but ignored at measure — the box was too small, the glyphs overflowed it, and because the *measure* was what the geometry pass inspected, `validate` reported the scenario clean. - `caption` ignored the width the layout gave it and painted one wide line past the device edge, again invisible to `validate`. Its `line-height` was also hardcoded to `font_size * 1.4` at paint while the box was measured with `line_height_for`. - `font-weight` and `font-style` were dropped entirely as soon as a custom or Google font was declared — bold and italic silently became regular. - `codeblock` and `terminal` never used the scenario's custom/Google fonts. `Terminal` and `TerminalIntrinsic` also resolved their typeface through two separate code paths that could disagree; they now share one `resolve_typeface`, so the box measured and the glyphs drawn cannot diverge. - `codeblock` auto-scroll derived its offset from the full code height instead of the revealed lines, leaving the block empty for most of the reveal. - `is_emoji` classified ©, ™ and ✓ as emoji, so the style's colour was dropped (or a tofu drawn) — including in a shipped example. Also corrects two entry documents that named `engine::text::cosmic` as the text engine. It has no callers on the render path; the real path is `engine::renderer::text` + `rustmotion-components::intrinsic`. The module keeps building, now with a doc comment saying plainly that it is dormant, so the next reader does not spend a session editing dead code. Tests: 116 + 6 + 3 + 5 + 211 + 3 pass on this branch alone.
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.
Round 3 du chantier d'audit — lot texte & polices, 10 constats vérifiés.
Deux familles de défaut, avec des conséquences très différentes :
A. Du texte qui n'est jamais lisible.
.notdefcompris.line-heighten%/emfont-weight/font-stylecodeblockauto-scrollcodeblock/terminalis_emoji©,™et✓comme emoji : couleur du style perdue ou tofu — y compris dans un exemple livré.B. Mesure et peinture qui divergent — donc
validatedevient aveugle.C'est le point le plus grave pour la fiabilité de génération : la passe geometry inspecte la mesure. Quand la peinture fait autre chose, le débordement existe à l'écran et le validateur déclare le scénario propre.
captionlargeurletter-spacingrelatifcaptionline-heightfont_size * 1.4en dur à la peinture,line_height_forà la boîte.TerminaltypefaceTerminaletTerminalIntrinsicrésolvaient leur fonte par deux chemins distincts pouvant diverger.TerminaletTerminalIntrinsicpartagent désormais un uniqueresolve_typeface: la boîte mesurée et les glyphes dessinés ne peuvent plus diverger, etfont-familyest enfin honoré.Correction documentaire
CLAUDE.mdetrules/module-structure.mddésignaientengine::text::cosmiccomme le moteur de texte. Ce module n'a aucun appelant sur le chemin de rendu — le vrai chemin estengine::renderer::text+rustmotion-components::intrinsic. Le module reste compilé (candidat pour un futur moteur de shaping réel), mais son doc-comment dit maintenant clairement qu'il est dormant. Sans ça, la prochaine session peut passer son temps à éditer du code mort en croyant modifier le rendu.Vérification
cargo test -p rustmotion-core -p rustmotion-componentssur cette branche seule : 116 + 6 + 3 + 5 + 211 + 3 tests, 0 échec.