Skip to content

Replace BiDi level inference: add GlyphRun::base_level#139

Merged
dhardy merged 3 commits intomasterfrom
push-ttxpouxzlynv
Mar 27, 2026
Merged

Replace BiDi level inference: add GlyphRun::base_level#139
dhardy merged 3 commits intomasterfrom
push-ttxpouxzlynv

Conversation

@dhardy
Copy link
Copy Markdown
Contributor

@dhardy dhardy commented Mar 26, 2026

The removed fn line_is_rtl was 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.

Since line_is_rtl was never really used, it is removed; TextDisplay::text_is_rtl now 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_level in struct GlyphRun and use this to determine the line level and paragraph direction.

@dhardy dhardy force-pushed the push-ttxpouxzlynv branch from f1b831c to 7ce1024 Compare March 26, 2026 13:53
@dhardy dhardy force-pushed the push-ttxpouxzlynv branch from 7ce1024 to 7510631 Compare March 27, 2026 11:47
@dhardy dhardy changed the title Replace text_is_rtl fns Replace BiDi level inference: add GlyphRun::base_level Mar 27, 2026
Comment on lines -126 to +113
assert_eq!(size_of::<shaper::GlyphRun>(), 112);
assert_eq!(size_of::<shaper::GlyphRun>(), 120);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

@dhardy dhardy merged commit 9797e78 into master Mar 27, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant