RTL and fonts

Direction, bidi and font handling. Advanced topics in the DocStudio developer reference.

Direction

Set config.page.direction to rtl for right-to-left pages. Alignment, rows, tables and logical spacing mirror. A section can change direction for its content. Fixed-region frames use physical left and top (ADR 0004), so coordinates mean the same in both directions.

Bound values are wrapped in an isolating element so a Latin name inside Arabic text keeps its order.

Launch languages

English, Arabic and Urdu. Exact digit shapes and separators come from the runtime's Intl data and can differ between versions, so tests assert stable fragments for these locales.

Fonts

  • Text uses the families named in styles. Without fonts from the host the renderer falls back to the browser default.
  • Provide fonts through a FontRegistry (createFontRegistry). Faces are embedded in documents as data URIs, with a size limit per font.
  • Header and footer families are preloaded in the main document so Chromium can use them when it prints the margin templates.
  • The PDF service waits for the fonts to load before it prints.
  • Arabic and Urdu need a font that covers the script. The repository uses Noto Naskh Arabic, Noto Sans Arabic and Noto Nastaliq Urdu in its own tests.

Designer interface

The designer supports right-to-left chrome. Pass direction="rtl" and translated messages.

See Right-to-left documents and Font problems.