Repository navigation
0.7.0 — CJK typography in both writing modes
CJK text is now set as W3C's writing-mode and layout requirements describe, in horizontal and vertical text alike. A host passes the style it decided for a chapter in BrowserLayoutConfig.cjkTypographyStyle, and inline layout draws CJK text in its language's font, places and squeezes punctuation as CLREQ and JLREQ do, and orients vertical text by UAX #50. The same passes are public in YueduCoreTextTypography, so a host's own text engine can set CJK text by the same rules.
- Vertical text follows CSS Writing Modes 3
text-orientation: mixed: Latin letters and digits lie on their side, centred on the column; kana and Han stand; brackets and ー take their vertical alternates.VerticalOrientationcarries UAX #50 from the Unicode Character Database 18.0.0. CJKTypographyStyle(Traditional, Simplified, Japanese, Korean) andChineseScripttell a text's typography from its characters. Converters label Traditional textzh-cn, so the text decides, not the declared language.CJKTypography.applyFonts: CJK text in its language's font — PingFang TC or SC, Hiragino Sans, Apple SD Gothic Neo. On iOS the system font's fallback follows the device's languages, not the text's.CJKTypography.applyPositions: 、。,.:;?! where the style puts them — centred for Taiwan and Hong Kong, after the text for the Mainland, JLREQ's places for Japanese — corrected by measurement in fonts that put them elsewhere.CJKTypography.applySpacing: a pair of adjacent marks involving a bracket takes 1.5 em instead of 2 (CLREQ), the bracket kept against its text; :;?! keep their squares in vertical text; Japanese squeezes only between the marks (JLREQ §3.1.4).- Authored
text-combine-upright(縦中横) —all,digits 2–4and the prefixed spellings — becomes one upright cell.TextCombineUprightandCombinedUprightare public for a host's own engine. GlyphBoundarygives character boundaries as the glyphs stand after a negative kern; selection, highlights and hit testing use it.- Text without a family that resolves is set in the system font, not PingFang SC, and
ReaderFontCascadeno longer names PingFang SC or STHeiti SC. CJKTypographyProcessorkeeps quote conversion and its line-breaking classes; its punctuation compression is gone.ReaderPerfStage.cjkTypographyPreparemarks the pass in Points of Interest.
Measured in Yuedu Reader on the iOS 27 simulator (Debug): the pass costs 3–7 ms for a chapter of 5,000–10,800 characters in the reader's legacy engine, and 24–48 ms over the paragraphs of a ruby-heavy Japanese vertical chapter in BrowserAuto. Opening Chinese chapters stays within run-to-run noise. Text with no CJK returns from the font pass early.
Validation: the full package suite passes on iOS Simulator (49 typography and 165 engine tests). Yuedu Reader's acceptance tests draw marks through both of its engines and measure them from their ink; its render-fidelity scores, line-break baseline and loading benchmarks are recorded in the Reader repository.