Japanese Layout Requirements (JLReq)

September 28, 2021

AH Formatter provides excellent support for formatting Japanese. This is reflected in AH Formatter's high level of support for Japanese Layout Requirements (JLReq), published by the W3C.

JLReq is a W3C Note that "describes requirements for general Japanese layout realized with technologies like CSS, SVG and XSL-FO."

This tutorial uses the same headings as the 11 August 2020 version of JLReq.

Unless otherwise noted, the features describe here are available with both XSL-FO and CSS formatting. XSL-FO properties with an axf: prefix are generally available as a CSS property with a -ah- prefix. For example, axf:text-autospace-width is available in CSS as -ah-text-autospace-width.

Basics of Japanese Composition

  • AH Formatter can format Kanji, Hiragana, and Katakana, both horizontally and vertically. AH Formatter will use the correct glyphs for small kana and for horizontal or vertical text if they are available in the specified font.
  • Fixed inter-character spacing is specified using letter-spacing. Finer control of the spacing of ideographic characters is possible using axf:text-autospace and related properties. Automatic selection of the inter-character spacing based on the number of characters is specified using axf:auto-letter-spacing.
  • Even inter-character spacing is achieved using text-align="justify".
  • Even tsumegumi is achieved using a negative letter-spacing value. Face tsumegumi is achieved using axf:kerning-mode="pair".
  • fo:simple-page-master from XSL-FO and @page rules from CSS are both able to represent the page format of a Japanese document. A different hanmen for the table of contents or index can be achieved by selecting a different page master.
  • AH Formatter can position illustrations in the current column or float them to elsewhere in the current column or page or on a following page. Illustrations can be sized to fit the current column, multiple columns, or the width of the kihon-hanmen. Illustrations can instead extend to the width or height of the page or even extend past the page edge.
  • AH Formatter is able to generate text with different writing modes on the same page.
  • AH Formatter can format Latin alphanumeric characters in vertical text as vertical text, rotated 90 degrees clockwise, or as tate-chu-yoko.
  • Tables and illustrations can be rotated 90 degrees clockwise or counter-clockwise.
  • The last page of multi-column horizontal text can be made to balance.
  • Running heads and page numbers can be positioned as recommended by JLReq. Running heads can be omitted from naka-tobira, han-tobira, and blank pages by selecting different page masters for those pages.
  • AH Formatter can number pages using either continuous pagination or independent pagination.

Line Composition

  • The punctuation marks in the formatted document are under the control of either the document author or the stylesheet writer. Punctuation marks are generally included in the source document and are not generated by AH Formatter. The exceptions are quotation marks in CSS formatting that could be generated by the quotes property and text generated by the content property of either an element or a ::before or ::after pseudo-element.
  • AH Formatter will apply the correct character advance to punctuation marks in the context in which they occur. This includes correct placement of opening brackets at line head, position of punctuation characters at line end, and observing rules about characters that cannot either start or end a line.
  • AH Formatter handles mixed text composition in both horizontal and vertical writing modes.
  • AH Formatter handles both ruby and emphasis dots. Ruby support includes mono-ruby, group-ruby, jukugo-ruby, and dual-ruby. Numerous extension properties are available to control the appearance of ruby characters and emphasis dots.
  • AH Formatter supports line head indent using the text-indent property.
  • Text can be aligned using the text-align property.
  • The axf:avoid-widow-words extension and related properties control how widow words can be avoided.
  • AH Formatter provides the <axf:tab> extension element and related properties for control of tab setting.
  • Jidori processing can be specified using either text-align="justify" in a container with a fixed width or by using axf:text-autospace.
  • AH Formatter has a custom-developed MathML engine for formatting mathematics.
  • AH Formatter has extension properties for specifying line adjustments, including hanging punctuation and inter-character spacing reduction and expansion.

Positioning of Headings, Notes, Illustrations, Tables and Paragraphs

  • AH Formatter can format the heading styles shown in this section of JLReq.
  • A column break or page break, including whether to break to the next odd or even page, can be specified on block-level FOs (or, for CSS, for block-level boxes).
  • Endnotes can be handled as ordinary block-level elements.
  • Headnotes in vertical writing mode can be handled using the AH Formatter extensions for sidenotes.
  • Footnotes in horizontal writing mode can be handled as ordinary footnotes.
  • Sidenotes in horizontal writing mode can be handled using the AH Formatter extensions for sidenotes.
  • As stated previously, AH Formatter can render illustrations either in the flow or floated to a different position. AH Formatter implements extensions for floats that provide more control than is defined for either XSL-FO or CSS.
  • AH Formatter can position tables as floats. In addition, AH XSL Formatter can format tables that fill a spread.