Files
photocraft/crates
MathMattTechandClaude Opus 5.5 38c1917ce3 Draw right-to-left layer names in visual word order
egui 0.36 shapes each font run with HarfRust, so an Arabic, Hebrew or
Kurdish word draws right to left with its letters joined, but it places
a line's runs left to right in logical order: a layer named
"سلام عليكم" shows "عليكم سلام".

bidi_label::for_egui puts the runs in visual order with the Unicode
bidi algorithm and leaves the letters of every stretch egui reverses by
itself in logical order (a right-to-left run is reversed, then each
right-to-left-script stretch in it is turned back; Arabic-Indic digits
in a left-to-right run are pre-reversed). Reordering characters too
(reorder_line) mirrors every word and loses the lam-alef ligature.

layer_row_ui::truncated, which draws layer names in the Layers panel
rows, uses it for names with right-to-left characters. A long name is
cut in logical order first, so it keeps its beginning and the "…" sits
at its reading end; other names lay out exactly as before.

Tests cover the string rules, and, where an Arabic or Hebrew system
font is installed, the drawn glyph positions (first word rightmost, the
لا ligature intact) and eliding. unicode-bidi 0.3 is already in the
tree through usvg/resvg. A stopgap until egui orders runs by bidi level
(emilk/egui#8577).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-10 22:44:36 -04:00
..
…
…
…