Skip to content

Layout: vertical writing flow and CJK line breaking #321

Open

Description

@Tim81

C4 adds vertical writing at the Kernel level — Identity-V, the vertical predefined CMaps, /W2 and
/DW2. The layout engine is horizontal-only, so that capability would ship with no way to use it
from the API where documents are actually written.

Scope

  • Vertical writing mode in the flow engine: text advancing top to bottom, lines advancing right to
    left (or left to right for Mongolian), with the content area, page breaking and column flow all
    rotated accordingly.
  • Tate-chu-yoko — short horizontal runs inside vertical text, used for two-digit numbers and Latin
    abbreviations. Common enough in Japanese typesetting that vertical support without it is incomplete.
  • CJK line breaking (kinsoku) — the rules preventing certain characters starting or ending a line,
    plus the spacing adjustments between CJK and Latin runs.
  • Writing mode as a section property (L0b), since a document may mix vertical and horizontal sections.

A note on the normative reference

ISO 32000-2 lists JIS X 4051 ("Formatting rules for Japanese documents") among its normative
references — and PDF2NormRefs flags it as the one level-1 reference with status "not available".
It is not freely obtainable.

So implement from what is: Unicode UAX #14 for line breaking, UAX #11 for east-asian width, and
the published CSS Writing Modes and CSS Text specifications, which encode the same kinsoku rules
in an openly available form. Say so in the implementation notes rather than citing a document nobody
working on this can read — that is both honest and consistent with the clean-room policy.

UAX #14 and UAX #11 are now held, along with the Unicode_LineBreakTest.txt conformance corpus.

Acceptance

  • Vertical Japanese text rendering correctly, verified against a reference rendering.
  • Tate-chu-yoko for a two-digit number inside a vertical run.
  • Kinsoku rules preventing a closing bracket at a line start, tested against the UAX Deterministic output: DocumentId pin + determinism tests #14 pair table.
  • A document mixing a vertical and a horizontal section.
  • Correct /W2 and /DW2 reaching the font dictionary via C4.

Relates to

  • C4 — the Kernel-side vertical writing this makes usable.
  • L18 — the other writing-direction work.
  • L14, L29 — line breaking, which kinsoku constrains.

Plan labels used above, resolved: C4 #266 · L0b #286 · L14 #306 · L29 #307 · L18 #320.

Activity

  1. added
    area/fonts
    area/layout
    type/feature
    on Aug 29, 2026
  2. Tim81 commented on Sep 6, 2026

    @Tim81
    OwnerAuthor

    From the specification audit on 2026-09-06: W3C JLReq is the substitute this issue is looking for, and it is free.

    This issue records JIS X 4051 as the one level-1 normative reference PDF2NormRefs marks "not available", notes it is not freely obtainable, and proposes implementing from UAX #14, UAX #11 and the CSS specifications instead. That plan is sound but it misses the closest thing to the standard itself.

    Requirements for Japanese Text Layout (JLReq) is a W3C document from the Japanese Layout Task Force. Its abstract states it is mainly based on JIS X 4051 and also covers areas JIS X 4051 does not. The second edition added substantial material on hanmen design: heading treatment, placement of illustrations and tables, and handling of notes and reference marks. It is bilingual, Japanese and English in parallel, and integrates its own errata.

    Why it beats the current plan. UAX #14 gives line-breaking classes and UAX #11 gives East Asian width, but neither describes page design, and the CSS specifications describe behaviour a formatter should expose rather than the typographic rules behind it. JLReq covers kinsoku and the vertical-flow page questions this issue actually has to answer, which is the half the current substitution leaves uncovered.

    The rest of the CJK scope has equivalents worth taking at the same time: CLReq for Chinese and KLReq for Korean.

    JIS X 4051 stays unobtainable, so the implementation notes should still say what was implemented from. They should name JLReq first.

    Also worth correcting in eng/generate-pdf20-inventory.py: the JSA JIS X 4051 STATUS row says CJK line breaking "would implement from UAX #14 and CSS Writing Modes instead". That note should name JLReq too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/fontsarea/layouttype/feature

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions