Skip to content

Japanese typesetting

Tools that generate PDFs from HTML inherit whatever the browser does with Japanese, which is usually almost right: a line ends with an opening bracket, a small kana starts a line, the vertical layout is not available at all. Compose PDF sets Japanese as its default case and handles the rest of the world from there.

Kinsoku is applied by default. Characters that may not begin a line — closing brackets, the small kana, the sound mark, punctuation — are pulled back to the previous line, and characters that may not end one are pushed forward. Mixed Japanese and Latin text breaks at the right places on both sides of the mix.

Justified Japanese is spaced between characters, rather than stretching the handful of Latin word gaps that happen to be in the line.

Widows and orphans are controlled, so a paragraph will not leave a single line stranded at the top or bottom of a page.

Turn on Vertical writing (right to left) on a text box and the paragraph is set in columns running right to left, with the glyph substitutions vertical Japanese requires. TCY (tate-chu-yoko) sets a short horizontal run — a two-digit number, an acronym — upright inside that vertical text.

Ruby text is attached per span, so you can annotate a single word inside a sentence rather than the whole line. Ruby is available in horizontal writing.

A catalogue of fonts is available to every template, in regular and bold:

  • Japanese — Noto Sans JP, Noto Serif JP, BIZ UDPGothic
  • Other CJK — Noto Sans KR, Noto Sans SC, Noto Sans TC
  • Latin — Inter, IBM Plex Sans, JetBrains Mono
  • Emoji — Noto Emoji

Each font declares a fallback chain, and fallback is resolved per character: a Latin font that has no kanji hands those characters to a Japanese font in the same line, and the line still measures and breaks correctly. Text shaping goes through a real shaping engine, so ligatures, kerning and the substitutions vertical text depends on are applied rather than approximated.

Fonts are subset and embedded in every PDF. The file renders identically on a machine that has none of these fonts installed, which is the point of sending a PDF rather than a document.

  • Ruby is horizontal-writing only.
  • Text is laid out left to right within a line. Right-to-left scripts such as Arabic and Hebrew are not supported.
  • Fonts come from the catalogue above — those are what the studio offers, and what gets embedded in the file.
  • Line breaks are decided by the engine, from how the text actually measures in the font you chose — which is why a break can move when you change the font or the size.