Replace BiDi level inference: add GlyphRun::base_level#139
Merged
Conversation
f1b831c to
7ce1024
Compare
7ce1024 to
7510631
Compare
text_is_rtl fnsGlyphRun::base_level
dhardy
commented
Mar 27, 2026
Comment on lines
-126
to
+113
| assert_eq!(size_of::<shaper::GlyphRun>(), 112); | ||
| assert_eq!(size_of::<shaper::GlyphRun>(), 120); |
Contributor
Author
There was a problem hiding this comment.
The struct size increased because we added 1 byte to a fully packed struct. Potentially we could remove the Script field in the future (only used to support resize_runs which barely ever gets used).
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 removed fn
line_is_rtlwas potentially wrong: it used the level of the logically-first run part on the line, but in case of BiDi lines this could be an embedded run of alternate direction.Sinceline_is_rtlwas never really used, it is removed;TextDisplay::text_is_rtlnow uses a value from analysis during run-breaking.The inference previously used to get the base paragraph direction (min over parts) was wrong sometimes for wrapped lines. We now store
base_levelin structGlyphRunand use this to determine the line level and paragraph direction.