Skip to content

v2.9.0 β€” Japanese and Korean, and a PDF that renders them

Latest

Choose a tag to compare

@ZoliQua ZoliQua released this 23 Nov 06:15
· 2 commits to main since this release

Japanese and Korean bring the UI to fourteen languages. Getting them to render in the PDF report meant building the embedded fonts properly for the first time β€” which is how three defects that had been shipping for several releases came to light.

Added

Japanese (ja) and Korean (ko) β€” the thirteenth and fourteenth UI languages

Both carry the full key set β€” all 1017 keys, checked against Hungarian, the authoritative source, with placeholder parity verified key by key. The clinical terminology follows Japanese Society of Conservative Dentistry / Japanese Society of Periodontology and Korean Academy of Conservative Dentistry / Korean Academy of Periodontology usage. The 2017 periodontal classification keeps its international stage/grade wording in both, as the Japanese and Korean literature does.

Like every language but English, each is its own lazy chunk (ja 60.7 KB, ko 58.0 KB). language.ja / language.ko were added to the other twelve locales so every language can name them, and both appear in the topbar menu and in Settings.

Neither has had a native-speaker review yet. The READMEs say so, alongside AR/ZH/FR.

Two embedded PDF fonts β€” src/fonts/notoJP.ts and src/fonts/notoKR.ts

The report embeds one subset font per script so a PDF export works offline. The existing Chinese subset contains no kana and no hangul, so neither language could have rendered at all. The coverage of each new subset is a measured trade-off, not a default:

coverage size
notoJP.ts every kana + the kanji in the ja strings 284 KB
notoKR.ts all 11,172 precomposed hangul syllables + jamo 3.2 MB

Japanese has a phonetic fallback β€” any name can be written in kana β€” so complete kana matters more than complete kanji; all 20,992 CJK ideographs measured 5.65 MB, twenty times the file for the same fixed report labels.

Korean has no fallback. A PDF performs no OpenType composition here, so a hangul syllable is one glyph, and a syllable missing from the subset cannot be drawn at all. The UI uses 429 of them; a patient's name uses whichever it likes, and a dental report naming the patient in empty boxes is not a report.

Both are lazy chunks, loaded only when a PDF is exported in that language β€” the same trade-off the measured tooth anatomy already makes at 3.8 MB.

tools/fonts/build_fonts.py β€” the embedded fonts are generated, not hand-made

It reads the codepoints each locale actually uses straight from src/i18n/locales/<lang>.ts, instances the Noto variable font to wght=400, subsets with pyftsubset, and writes the base64 module. The previous fonts had no generator, which is how both Chinese defects below went unnoticed. It follows tools/toothgen's rule: change the script and re-run, never hand-edit a generated file.

src/__tests__/pdf-font-coverage.test.ts β€” does the PDF render, or does it render boxes?

It parses the base64 each font module ships, walks its cmap (formats 4 and 12, computing glyph ids so a range mapped to .notdef is never counted as covered), and compares that against the locale the font serves. It also asserts that every embedded face is static and weighted as its name says.

Restoring the 2.8.0 Chinese font fails it on 82 named characters and on the fvar table at once.

Fixed

Chinese PDF text rendered hairline Thin

The Chinese subset was cut from a variable font without instancing it, so fvar/gvar survived into the embedded TTF β€” and that font's fvar default is wght=100. jsPDF has no variable-font support: it renders the default instance. Every Chinese PDF has been Thin. Instancing to wght=400 fixes the weight and, with the variation tables gone, makes the file 40% smaller (489 KB β†’ 296 KB).

The Chinese PDF font was missing 84 characters the Chinese UI displays

It was generated before the case-diagnoses strings existed and was never regenerated, so ε”Ύ (saliva), θ…Ί (gland), 瘘 (fistula), 钞 (temporal) and the rest came out as missing glyphs. Regenerating from the locale closed the gap; the new test is what will keep it closed.

Arabic bold text was never bold

notoArabic.ts embeds two faces, and AR_BOLD_B64 was a variable subset whose fvar default β€” and OS/2 weight class β€” was 400. jsPDF renders the default instance, so every "bold" Arabic run in a PDF came out at regular weight. Pinned to wght=700, which also dropped the module another 25% (378 KB β†’ 283 KB).

Found by widening the new test rather than by reading it: the test's first version looked up one base64 constant per module, so it only ever checked the Regular face. It now walks every embedded face, and additionally asserts that a face named bold reports a weight of at least 600 β€” the property that was actually wrong.

Four language tests restated the language list instead of reading it

translations.test.ts, tour.test.ts, dx-settings.test.ts and the i18n-lazy-load code-splitting guard each carried a hand-written list of twelve codes. A new language could therefore be wired into LANGUAGES, loader.ts, translations.ts and both pickers and still have none of its 1000+ keys checked β€” the suite would stay green and say nothing. All four now derive the list from LANGUAGES, and the two that asserted toHaveLength(12) compare against the registry instead.

Changed

notoArabic.ts's Regular face is now static too, with its coverage verified unchanged. For that face this is not a rendering fix: unlike the Chinese font, its fvar default was already wght=400, so regular Arabic was never hairline. Every embedded face is now static, which is what the new test requires β€” a font whose variable default happens to be right today is one edit away from not being.

Notes for upgraders

  • The Language union widened from twelve members to fourteen. A host that keeps an exhaustive switch over Language, or a Record<Language, T> map, will need ja and ko added. No runtime API changed, and a host that narrows the language it offers is unaffected.
  • Payload version is unchanged at 2.22. No state, render or FHIR-content change. The SVG-fingerprint, roundtrip-golden, API-surface and shell-DOM parity fixtures are byte-identical. The FHIR goldens and the published fhir/ terminology artifacts were regenerated and differ only in the package version string: 36 files, 71 lines, every one of them "version": "2.8.0" β†’ "2.9.0".
  • The package grew: 40 files / 15.6 MB unpacked β†’ 48 files / 22.9 MB unpacked, almost entirely notoKR. The fonts are lazy chunks, so the main entry is unchanged at 1201 KB and no font family literal leaks into it. A host that never exports a Korean PDF never downloads those 3.2 MB.
  • Full suite: 2411 passed / 2 skipped; tsc -b --force --noEmit clean; lint unchanged from the 2.8.0 baseline.