Skip to content

UI text: Arabic and Hebrew with RTL paragraphs - #1007

Merged
GLinnik21 merged 17 commits into
plxnative:mainfrom
Goo6i:arabic-hebrew-ui
Oct 29, 2026
Merged

GLinnik21 merged 17 commits into
plxnative:mainfrom
Goo6i:arabic-hebrew-ui

Conversation

@Goo6i

@Goo6i Goo6i commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Closes #760

Summary

Arabic and Hebrew in titles, summaries, cast names and menus drew as boxes. They now draw shaped and in reading order, through the HarfBuzz, FriBidi and FreeType that libass-plx already bundles, as the issue suggests. No crate is added and the screen layout stays left-to-right.

  • libass-plx ABI 4. src/ass_text.c adds five plx_ass_text_* calls: bidi levels and order, shaping, raster. NATIVE_ABI is 4 in player/ass.rs and in the new gfx/src/rtl.rs. Without the library, Arabic and Hebrew draw as boxes as they do today.
  • Fonts. Noto Kufi Arabic 2.110 and Noto Sans Hebrew 3.001, regular and bold, unmodified (OFL 1.1, 312 KB), fetched by tools/fetch-noto-rtl.py.
  • Layout. Arabic and Hebrew are links 4 and 5 of the fallback chain. A line holding right-to-left text is cut into bidi runs; shaped runs go through the facade, the rest through SDL2_ttf as before.
  • Direction follows a paragraph's first strong character (UAX #9 P2/P3). Right-to-left summaries are right-aligned with the fade and MORE on the left, the About card's title and genres follow their own text, and marquees rest on their first words and glide right.
  • Packaging. The faces are in every font list, and ci/test_shipped_faces.py holds those lists to the files text.rs opens (the package gate passed without them).

Latin, CJK and emoji text draw as before. Subtitles and Arabic/Hebrew UI text now share libass-plx.so.0, so a library at the wrong ABI turns both off.

Tests

49 new tests. The UI, marquee, About card, HUD and packaging tests failed before their code. I checked the facade and bidi layout tests by mutation instead, and they caught every mutant. the_written_analyses_are_what_fribidi_returns checks each hand-worked bidi fixture against FriBidi.

Verification

On a8c9c93. CI and the benchmark ran on 358fe08, the same tree before I added the sign-off

  • CI on my fork, all green: CI, Simulator CI. plx_ui ok. 1395 passed, plx_screens ok. 1690 passed, plx_gfx ok. 171 passed; 14 ignored; the 14 run under make check-ass (ok. 14 passed, subtitles ok. 58 passed). The armv7 binary grows 16,440 bytes, within budget. The firmware load matrix is OK on 4.4.2 to 11.2.0 for plxnative and libass-plx.so.0.
  • Locally ran both halves of make check (check-cargo, check-python), plus check-nodef and check-ass. Three failures also fail on 5959398 on my machine and pass on CI: two curlio::keymode_tests (host libcurl 8.23.0) and ci/test_host_threads.py (local nightly).
  • fw-compat-reviewer: no new link dependency or glibc requirement; the new surface is a gated dynlib! table. Nothing blocking.
  • doc-claim-auditor: fixed ten stale claims it found (facade ABI, font chain, MORE side and others). It also found a marquee fade bug, which I fixed with tests in c4deb11.
  • Device: ran the debug ipk CI built for 4193a46 (as 61f6229, before the sign-offs) on my LG NANO80 (webOS 6.5.3) against my library with Arabic metadata, and checked home, the library, the detail page and the About card on screen and in the simulator. That build predates the marquee fade fix in c4deb11, which has host tests only. I have not checked the subtitle track menu on the TV.

I am a native Arabic speaker and reviewed the Arabic myself. No Hebrew reader has reviewed the Hebrew.

With the TV in Arabic, ICU formats counts in Arabic-Indic digits beside English words ("١٩ seasons"). They render now; whether the format locale should follow the UI language is a separate question.

make build-bench

5959398 against 358fe08, same machine and sitting, 3 runs each. Every median moves by 2.2 s or less, and most sit inside the other side's min-max spread. Only the plx_gfx leaf edit's ranges do not overlap (+0.5 s), consistent with the code this adds to plx_gfx.

Full table
Scenario 5959398 median (min-max) 358fe08 median (min-max) Change
No-op host test build 0.0 s (0.0-0.1) 0.1 s (0.0-0.1) +0.0 s
Edit leaf (plx_base cbuf.rs), non-incremental 28.4 s (28.2-29.0) 29.5 s (27.6-29.9) +1.1 s
Edit leaf (plx_machine landgate.rs), non-incremental 27.4 s (26.9-28.7) 28.2 s (27.6-30.0) +0.8 s
Edit leaf (plx_platform devcaps.rs), non-incremental 27.8 s (26.5-28.3) 28.0 s (27.0-28.5) +0.2 s
Edit leaf (plx_gfx overdraw.rs), non-incremental 17.2 s (16.6-17.6) 17.7 s (17.7-18.7) +0.5 s
Edit leaf (plx_net stream_redirect.rs), non-incremental 24.5 s (24.3-26.0) 25.9 s (24.2-26.3) +1.4 s
Edit leaf (plx_ui dwell.rs), non-incremental 15.9 s (15.8-16.7) 16.4 s (16.2-16.9) +0.4 s
Edit leaf (plx_plex retry.rs), non-incremental 25.6 s (24.1-25.8) 24.2 s (24.0-26.1) -1.4 s
Edit leaf (plx_telemetry window.rs), non-incremental 22.0 s (21.8-22.6) 22.8 s (21.9-23.0) +0.8 s
Edit leaf (plx_data tape.rs), non-incremental 21.2 s (20.8-22.7) 23.1 s (20.4-23.2) +1.8 s
Edit leaf (plx_session scripted.rs), non-incremental 15.9 s (14.9-17.4) 15.2 s (14.6-15.4) -0.7 s
Edit leaf (plx_media units.rs), non-incremental 17.1 s (16.0-19.1) 17.1 s (16.5-17.2) +0.0 s
Edit leaf (plx_appkit skip_pill.rs), non-incremental 13.9 s (13.8-15.8) 14.8 s (13.3-15.3) +0.9 s
Edit leaf (plx_screens clock_readout.rs), non-incremental 13.2 s (13.1-13.7) 14.4 s (13.1-15.0) +1.2 s
Edit leaf (app coldstart.rs), non-incremental 7.5 s (7.4-7.9) 7.7 s (7.4-9.7) +0.2 s
Edit hub (plx_ui lib.rs), non-incremental 15.7 s (15.5-16.5) 17.3 s (16.0-17.9) +1.6 s
Edit leaf (plx_base cbuf.rs), incremental 9.3 s (8.9-12.3) 11.5 s (9.3-11.7) +2.2 s
Edit hub (plx_ui lib.rs), incremental 5.7 s (5.2-8.9) 4.2 s (4.0-6.1) -1.5 s
Unit suite run (default features) 37.3 s (37.0-37.5) 37.9 s (37.4-39.0) +0.5 s
ARM staticlib rebuild (touch lib.rs) skipped skipped

x86_64, 16 cores, Linux, rustc 1.99.1, serial front end, no load or swap warnings. Both trees fail the same 3 unit tests on my machine (the two above plus storage::tests::cleanup_removes_only_abandoned_owned_temporaries, which passes in make check and on CI). The ARM row is skipped: neither checkout has an ARM archive. I measured the base's two incremental rows straight after the main pair, once --cold had built its target-fast.

Screenshots

plx1 detail-1006-4

Goo6i added 11 commits October 24, 2026 19:01
plx_ass_text_* shapes one directional run with the bundled HarfBuzz,
rasterizes it with the bundled FreeType, and runs FriBidi over a line.
gfx::rtl binds it; native tests run against the host bundle.

Signed-off-by: Goo6i <[email protected]>
…mpositor

Lines with right-to-left text are cut into runs by FriBidi's visual order;
Arabic/Hebrew runs are shaped by the facade, the rest stay on SDL2_ttf.
The facade's box is the ink; shaped ink above the line box rises over it.
fontcov gates the four faces; RTL text is drawn untracked.

Signed-off-by: Goo6i <[email protected]>
An Arabic or Hebrew paragraph (its first strong character, UAX plxnative#9 P2/P3)
is drawn right-aligned in a left-aligned TextView; a wrapped line that
opens with a Latin word keeps the paragraph's direction with an RLM.
A truncated block dissolves at its left end into a MORE on the left, and
the About card's MORE follows. Marquees glide mirrored: a right-to-left
run rests on its first words at the window's right edge and moves right;
the paused player title reveals its end to the left.

Signed-off-by: Goo6i <[email protected]>
…tion

Each line takes its direction from its first strong character, like the
synopsis under it: an Arabic or Hebrew title or genres line stands flush
right in the card. The hero title stands in for the logo and keeps the
layout's side.

Signed-off-by: Goo6i <[email protected]>
It is the renderer's (ci/build-libass.py compiles it with FreeType's
headers); the application's SRCS compiled it a second time, without them,
and the ARM cross-build stopped at ft2build.h. ci/test_renderer_sources.py
holds the SRCS filter-out to the recipe's list.

Signed-off-by: Goo6i <[email protected]>
The .ipk, the package gate, the macOS and WSL simulator staging, the GPL
source bundle and the stills' inputs each list fonts by name and lacked
the four new faces: the package built and passed its gate without them.
ci/test_shipped_faces.py holds every list to the faces text.rs opens.
THIRD-PARTY-NOTICES attributes Noto Kufi Arabic and Noto Sans Hebrew and
names src/ass_text.c among the facade sources; text.rs's header and
docs/localization.md describe right-to-left text as it now is.

Signed-off-by: Goo6i <[email protected]>
An overflowing Arabic or Hebrew tile name rests flush right on its first
words, but block_text gave it the Latin bands: a static dissolve at the
right edge (over those first words) and a growing one at the left. Mirror
them for a right-to-left run: crisp head at rest, a right band that grows
with the travel (head_band_right), and the static dissolve at the left
where the run is cut.

Signed-off-by: Goo6i <[email protected]>
Facade ABI 4 and its two callers (ass-subtitles.md, agent-reference.md,
module-layers.md), the UI text pipeline and its faces, the dynlib caller
count, the mirrored MORE and fades in text_view and its callers, bold on
the shaped links, the gfx member list, the which-tier and ui-sim routing
for shaped runs, and the localization note's own sentence.

Signed-off-by: Goo6i <[email protected]>
GLinnik21 and others added 6 commits October 29, 2026 18:21
The PR's `a_paused_right_to_left_title_reveals_its_end_to_the_left` named
`ControlSlot::Discs` as a unit variant; main made it `Discs(Controls)`, so the
combined tree's appkit lib tests did not compile. Name `Controls::NONE`, as the
neighbouring title tests do.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…or Hebrew keeps its direction

Each drawn line is its own FriBidi paragraph, so a line of an English summary
that wrapped to "باب الحارة, follows the lives of" read right to left, its Latin
moved left of the Arabic. Mirror the right-to-left block's RLM: prefix U+200E
when the block is left to right and the line's first strong letter is not.
LRM is a bidi control, so it draws and measures nothing.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…tart", and the About card uses it

`card_line` decided in the screen that an RTL line stands flush right while
`TextView::drawn_align` held the same rule privately. Add `HAlign::Start`, settled
by `HAlign::resolve` through `is_rtl_paragraph` (Left for Latin, Right for Arabic or
Hebrew) and placed by `HAlign::anchor`. `Label` resolves it against its text,
`TextView::drawn_align` and `HeroLogo` use the same resolver, and the About card
asks it instead of re-deriving the rule.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…asterize

`plx_ass_text_measure` rasterizes every glyph (the box is the ink's extent) and only
skips compositing the coverage buffer; the doc claimed it measured without
rasterizing.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…ot rasterization-free

The SDL_ttf runs are pure metrics, but a shaped run is measured by `Face::measure`,
which runs the same layout pass as the draw and rasterizes each glyph.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@GLinnik21
GLinnik21 merged commit 411f6d3 into plxnative:main Oct 29, 2026
18 checks passed
@GLinnik21

Copy link
Copy Markdown
Collaborator

Merged, thank you! On top: main merged in (a HUD test needed Discs(Controls::NONE)), an LRM for wrapped LTR lines that start with Arabic or Hebrew, and HAlign::Start in the shared label so the About card uses it instead of its own rule.

GLinnik21 added a commit that referenced this pull request Oct 29, 2026
Merge: main's #1007 (Arabic and Hebrew titles) edited appkit/src/player_hud.rs,
which this PR deletes. The file stays deleted; its change is ported into
player_hud/classic.rs (the paused title's right-to-left reveal) and its test,
a_paused_right_to_left_title_reveals_its_end_to_the_left, into player_hud/tests.rs.

Review fixes:
- the clock prewarm reads the page's own scrub, not the app's snapshot from the
  previous frame, so a fast scrub warms the clocks the draw will show (test
  red first)
- a test pins that pin_headless_hud's ring write is paired with an engine re-seat
  (red with the re-seat removed)
- the HudModel sampling test now sets loading and the three caption picks to
  values of their own
- classic::scrub_frac_x (dead, duplicated HudGeometry::scrub_frac) is removed;
  scrub_hit_rect and ctrl_row_hit_rect are module-private
- comments that named the deleted key_updown follow the code

Co-Authored-By: Claude Opus 5.5 <[email protected]>
GLinnik21 added a commit that referenced this pull request Oct 29, 2026
…ne groups (#1140)

The player HUD is split into state, model, motion and geometry, and its travel moves onto FocusEngine groups. This is the contract the plugin renderer will draw through: `HudModel` in, `HudGeometry` out (docs/hud-plugins.md, PR2).

`appkit/src/player_hud.rs` becomes `player_hud/`:
- `state.rs`: the app-owned logic (`slot_for`, `busy`, the scrub ladder).
- `model.rs`: `HudModel`, a per-frame read-only snapshot of every value the draw used to read from process globals. It holds `Copy` fields and borrowed strings, so building it allocates nothing.
- `motion.rs`: `HudMotion`, the springs, `CtlPop` and the reveals.
- `geometry.rs`: `HudGeometry`, what the layout reports back, and the focus `GroupId`s.
- `classic.rs`: the classic constants and arrangement.

Each frame, `run.rs` fills the model and pushes it into the player screen. The player's `Focusable`, the pointer stops, `overscan_rects`, the Up Next and Skip stand-ins and the two player menus' anchors read `HudGeometry` instead of classic constants. #1007's right-to-left title reveal is carried into `classic.rs`.

`nav.focus` is a FocusEngine `GroupId`. The hand-walked Up/Down ring is gone: Up from the top group hides the HUD as the screen's answer to `Step::Edge`. After each of the app's own writes to `nav` (a fresh segment offer, the headless pin, the auto-hide park, `FocusTabs`), the app re-seats the engine. OK still goes through the hand-routed row press, and moving it onto the engine's press is PR3.

One deliberate behaviour change. A stand-in leaving the row (a pressed Skip pill, a seek out of the marker, the marker's end) sends the ring back to the scrubber, for the engine as well as `nav`, so the next OK toggles play. That is `standin_left_the_ring`'s documented intent. On `main`, a movie's Skip press left the engine on the stale item, and its reconcile moved focus to Subtitles, so OK opened the Subtitles menu. Tests pin the movie and episode departures through the real dispatcher.

Before the split, `screens/src/player/hud_pins_tests.rs` pinned classic's keys from every HUD focus, the hit census and the reported rects, and the file is unchanged since. Simulator before/after pairs against `main` show the player, Up Next and failure captures byte-identical, Up off the top hiding the HUD while the film plays, and the Skip pill pressing on OK.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.

Arabic and Hebrew text in the UI (titles, track names, menus)

2 participants