Add root-level styles to Layout - #1
Draft
nicoburns wants to merge 4 commits into
Draft
Conversation
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
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.
Summary
Adds persistent root-level styles to
Layout(linebender#291), so the root style is no longer discarded after building and its font metrics are available even for empty layouts (fixes the invisible-cursor case from linebender#391).New public type nesting a regular
TextStyle:All three builders now take it (breaking change):
The root style is resolved once, stored on
LayoutData, and exposed via:Key mechanics:
FontMetrics::from_font(font, size, synthesis, variations)(new inparley_engine) computes metrics directly via skrifa without shaping; root metrics are resolved with a fontique query using the root style's family/weight/width/style/variations." "to get cursor metrics — empty layouts and trailing empty lines (after a final newline) now derive their line-box/content-box metrics from the root font metrics and root line height.RangedBuilder::push_defaultstill updates the layout's root style, preserving existing semantics.strut: true, each line's ascent/descent/line-height are floored by the root font's metrics (CSS strut behavior); default remains unchanged.word_break.All builder call sites (examples, benches, editor, tests) migrated; new tests cover empty-layout metrics, trailing empty lines, strut flooring, and builder equivalence of the new root fields.
Link to Devin session: https://app.devin.ai/sessions/84c19f0ab14045d6a472af0934ded64c
Requested by: @nicoburns
Devin Review