Repository navigation
feat: right-to-left text in the order it reads - #129
Merged
Merged
Conversation
…r the Unicode bidirectional algorithm gives, in the direction its paragraph says
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.
Hebrew and Arabic were drawn in the wrong order. egui 0.37 has no bidirectional algorithm: it shapes each run with a guessed direction, so a whole run flipped, Latin and digits with it (
fed cba,4202), and a paragraph took its direction from its first letter.odox_core::bidiwrapsunicode-bidi(new dependency, Servo's, default features only): a paragraph's direction comes fromstyle:writing-mode(read intoParagraphProperties::right_to_left), never from its first letter, as LibreOffice reads it; each line's runs come out in visual order.Flowfor text and slides, cells in Odox Grid): a paragraph that needs it is broken into lines here — egui breaks lines by glyph position, and a turned word scrambles that, splitting words — and each line handed to egui in visual order: a right-to-left word as written for the shaper to turn, the spaces and punctuation between words turned here with brackets mirrored. Plain left-to-right paragraphs take the old path untouched.start(and no alignment) to the left margin even in a right-to-left paragraph, andendto the right; that is what the existing mapping already does, so it is unchanged.odox_fonts::faces_with): the generic monospace family no longer comes before everything else, and faces in the variant's weight and slant that are proportional come before the rest. Arabic was falling back to DejaVu Sans Mono, and bold faces turned up for regular text; both the window and the PDF use this.New corpus fixture
directions.odt; compared side by side with LibreOffice's rendering in the window and in the PDF, the same order on every line. Tests: the bidi runs in odox-core, a line's visual glyph order in odox-pdf, and veraPDF on the fixture.Closes #76.