feat(fallbacks): carry glyphExceptions on the resolved fallback#44
Merged
Conversation
The renderable fallback already says which family / verdict / line-break-safety / faces; add the row's glyph exceptions so a consumer can surface a precise 'this face reflows on U+0060' without re-deriving from SUBSTITUTION_EVIDENCE. Projected by the existing helpers, no new API: - getRenderableFallback / getFallbackDecision (family): all of the row's exceptions, with the top-level verdict. - getRenderableFallbackForFace / getFallbackDecisionForFace (face): only that face's exceptions, with the per-face verdict - so Cambria Regular carries none while Bold Italic carries its grave-accent exception. Optional + additive (omitted when none, e.g. Calibri). The field is a readonly GlyphException[] and a FRESH array each call (the family path copies, filter already copies), so a consumer mutating it can never corrupt the shared evidence row for a later lookup. No data change.
fd60bdc to
2c11227
Compare
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.
The renderable fallback already says which family, the verdict, line-break safety, and face coverage. Add the row's glyph exceptions to it too, so a consumer (SuperDoc's report) can surface a precise "this face reflows on U+0060" without re-deriving from
SUBSTITUTION_EVIDENCE.One optional field on
FontFallback, projected by the existing helpers - no new API, no new mental model:getRenderableFallback/getFallbackDecision(family): all of the row's exceptions, with the top-level verdict.getRenderableFallbackForFace/getFallbackDecisionForFace(face): only that face's exceptions, with the per-face verdict - Cambria Regular carries none, Bold Italic carries its grave-accent exception.Optional + additive (omitted when a fallback has none, e.g. Calibri), so it's a minor
0.4.0. No data change. This keeps everything in@docfonts/fallbacks- the question "the fallback I'm about to render, how faithful is it?" belongs onFontFallback; a separate evidence package would add two installs and a second mental model for no second consumer.After this ships, SuperDoc #3672 can drop its local verdict/exception projection and copy these fields straight off
getRenderableFallback/getRenderableFallbackForFace.Verified: typecheck/lint clean;
bun test24 pass (3 new: family=all, face=filtered, none-omitted); built dist loads in Node and projects correctly (Cambria family[boldItalic], Regularundefined, Bold Italic[boldItalic]).