Skip to content

Fonts: subset appfont-cjk.ttf to cmap-reachable glyphs so webOS 3/4 FreeType opens it (#628) - #709

Merged
GLinnik21 merged 3 commits into
mainfrom
font-cjk-subset
Oct 15, 2026
Merged

GLinnik21 merged 3 commits into
mainfrom
font-cjk-subset

Conversation

@GLinnik21

Copy link
Copy Markdown
Collaborator

Closes #628

The reporter's set (55SK8500PCA, webOS 4.x) could not have drawn CJK even with correctly decoded text: the bundled appfont-cjk.ttf (Noto Sans CJK KR) had 65,535 glyphs, so its long loca table was exactly 0x40000 bytes, and FreeType 2.4.11–2.7.0 (webOS 3.x/4.x system FreeType, used by SDL2_ttf) rejects that face with Invalid_Table. The charset half of #628 is the companion PR for fix-628-subtitle-charset.

What changes

  • tools/cut-noto-cjk.py subsets the face to the 44,097 glyphs reachable from its cmap (keeping the variation-selector table) — no coverage is dropped. pkg/appfont-cjk.ttf regenerated: 21,185,868 → 13,417,156 bytes (−7.4 MiB; ipk gzip-9 ≈ 11.34 → 7.45 MB).
  • base/src/fontcov.rs: new test shipped_faces_open_under_old_freetype — every shipped face has numGlyphs ≤ 65,534 and a long loca under 0x40000.
  • media/src/player/ass.rs: libass no longer copies the CJK face into a memory font (it stays the path_default fallback), avoiding a second in-process copy of the face.
  • Doc/comment fixes that described the old face (Makefile, docs/agent-reference.md, fontcov.rs, text.rs).

Verification

  • The new fontcov test fails by construction on the old face (65,535 glyphs, loca = 0x40000).
  • Committed tree 2bec93d: make check exit 0 (every test result: ok, 0 failed); cargo check --lib --no-default-features clean.
  • TV (LG webOS 4.5, mock guest server): CJK subtitle cues (drawn by gfx/text.rs over the system SDL2_ttf/FreeType) render through the subset face.

make build-bench (same sitting, M4 10 cores, 3 runs; host load was above core count throughout, so treat deltas inside the spread as noise; the base checkout had no target-fast, so its incremental rows are skipped). The build-relevant change is Makefile comments only.

Base:

Scenario base 64a580a (median, min–max)
No-op host test build 0.1 s (0.1–0.2)
Edit leaf plx_base cbuf.rs, non-incr 26.2 s (26.0–33.4)
Edit leaf plx_machine, non-incr 25.1 s (24.6–29.6)
Edit leaf plx_platform, non-incr 24.8 s (24.0–28.7)
Edit leaf plx_gfx, non-incr 11.6 s (11.0–13.7)
Edit leaf plx_net, non-incr 20.6 s (20.5–29.6)
Edit leaf plx_ui, non-incr 10.7 s (10.5–19.6)
Edit leaf plx_plex, non-incr 20.5 s (20.0–23.9)
Edit leaf plx_telemetry, non-incr 17.5 s (17.3–28.3)
Edit leaf plx_data, non-incr 18.5 s (15.4–24.5)
Edit leaf plx_session, non-incr 12.3 s (9.3–20.8)
Edit leaf plx_media, non-incr 14.6 s (10.8–23.6)
Edit leaf plx_appkit, non-incr 9.6 s (8.3–18.9)
Edit leaf plx_screens, non-incr 8.8 s (7.7–18.2)
Edit leaf app coldstart.rs, non-incr 4.0 s (3.8–9.6)
Edit hub plx_ui lib.rs, non-incr 11.5 s (10.1–23.4)
Edit leaf / hub, incremental skipped (no target-fast in base checkout)
Unit suite 79.6 s (73.3–126.3), 7511 passed / 0 failed / 20 ignored

font-cjk-subset (2bec93d):

Scenario median (min–max)
No-op host test build 0.1 s (0.1–0.1), 0/180 units
Edit leaf plx_base cbuf.rs, non-incr 25.1 s (21.9–25.6)
Edit leaf plx_machine, non-incr 21.2 s (20.8–22.2)
Edit leaf plx_platform, non-incr 20.4 s (20.3–20.5)
Edit leaf plx_gfx, non-incr 9.6 s (9.5–9.7)
Edit leaf plx_net, non-incr 17.3 s (17.2–17.8)
Edit leaf plx_ui, non-incr 9.1 s (9.1–9.4)
Edit leaf plx_plex, non-incr 17.1 s (16.7–19.2)
Edit leaf plx_telemetry, non-incr 16.7 s (14.9–31.4)
Edit leaf plx_data, non-incr 14.2 s (13.0–22.3)
Edit leaf plx_session, non-incr 8.5 s (7.7–13.7)
Edit leaf plx_media, non-incr 9.7 s (9.4–12.7)
Edit leaf plx_appkit, non-incr 7.1 s (7.1–14.0)
Edit leaf plx_screens, non-incr 6.7 s (6.6–12.4)
Edit leaf app coldstart.rs, non-incr 3.2 s (3.1–5.1)
Edit hub plx_ui lib.rs, non-incr 8.9 s (8.8–14.7)
Edit leaf plx_base, incremental 9.9 s (7.2–13.0)
Edit hub plx_ui, incremental 3.2 s (3.1–3.9)
Unit suite 56.3 s (56.1–56.6), 7512 passed / 0 failed / 21 ignored

🤖 Generated with Claude Code

GLinnik21 and others added 2 commits October 14, 2026 20:15
… 2.7.0 opens it; libass no longer copies it

The CJK fallback had 65535 glyphs, so its long loca was exactly 0x40000 bytes,
which FreeType 2.4.11-2.7.0 (ttpload.c: table_len >= 0x40000) rejects with
error 8; several firmware inventories ship such a FreeType. Only 44,074 glyphs
are reachable from the cmap (the rest were GSUB alternates, dead since the cut
drops GSUB). tools/cut-noto-cjk.py now runs the fontTools subsetter keeping all
44,810 codepoints and the 12-selector cmap-14 UVS: 44,097 glyphs, 13.42 MB raw /
7.45 MB gzip-9 (was 21.19 / 11.34). Outlines and advances are identical for all
44,810 mapped codepoints and the 28 UVS glyphs. fontcov.rs gains
shipped_faces_open_under_old_freetype (red on the old file).

Behaviour change: ass.rs no longer adds appfont-cjk.ttf as a libass memory font
per renderer (a malloc+copy, plus a transient fs::read, per windowed-sidecar
slide, reachable only by the family name "Noto Sans CJK KR"). Glyph fallback goes
through libass's default font path, which maps the file; Inter regular/bold stay
memory fonts. A native test covers a CJK line in an unknown-family style.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@GLinnik21
GLinnik21 enabled auto-merge (squash) October 14, 2026 23:16
…names its own row

check-package.py asserted pkg/appfont-cjk.ttf > 15 MB, a floor set for the
uncut 21 MB face; the subset ships at 13.4 MB, so every ipk build failed it.
fontcov.rs's cmap gate is what proves the face whole, this only catches absence.

test_the_wire_log_says_how_long_a_page_was_in_flight took the first wire row for
the path, which could be the previous test's row landing after DELETE
/_mock/wire (start=None); it now selects the row by its own start.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@GLinnik21
GLinnik21 merged commit a8dbad9 into main Oct 15, 2026
19 checks passed
@GLinnik21
GLinnik21 deleted the font-cjk-subset branch October 15, 2026 00:32
GLinnik21 added a commit that referenced this pull request Oct 22, 2026
* Release notes and audit for v0.9.0

Action-required evaluation (README trigger list, read from the PRs, grep not run on a built tree): no hits that need a reader action. Launch links (#853) add an inbound surface (any app that can launch apps), stated in What's new; the 3.4 image cache writes to /media/developer/temp (#667); crash/error reports gain fixed-value fields with POLICY_VERSION unchanged (#632), stated under Changed; Watchlist and PMS notifications use hosts the app already reaches.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Release notes v0.9.0: coverage and accuracy pass

Note: correct the Collections surfaces (no TYPE menu; collection shelf
headings live on Home and a library's Recommended page), the Watchlist
hold-menu rows, the launch-link sign-in behaviour and platform-release
numbering, the notification-feed sentence and the per-profile settings
list (no stale "nine"). Add #832, #808, #750/#762, #709 (#628), #641,
#647, #793, #871, #877 (#679), #876 and the key-press frame work;
credit RichiL10 and Shakil Choudhury. #862 moves from Known issues to
the webOS 3.x lines as fixed by #578; the 3.9.3 source-build report
(#700) is kept in Compatibility. Compatibility links reports, not
reporters' profiles.

Audit: #862 provenance (attributed usage-report reading, no counts),
contributor list wording.

Action-required section: not owed. The README grep over
v0.8.0..origin/main (rust-modules/src src ci) hits only CI tooling,
test-only loopback listeners and fixture tokens, and the dev-only
/tmp/plxnative-trackmemory trigger; the audit's PR-by-PR reading in
"Deliberately not done" stands.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Release audit v0.9.0: name the toolchain by its pin file, not its version

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

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.

Chinese characters in embedded SRT subtitles display as garbled text / unreadable

1 participant