Skip to content

Japanese and Thai line breaking

Three narrow justified columns: Japanese breaks between characters but keeps punctuation and small kana off the start of a line; Thai, written without spaces, breaks between words found in a dictionary; English breaks at spaces, hyphens and slashes. This is the Unicode Line Breaking Algorithm.

Standards: PDF/A-2b · PDF/UA-1, checked with veraPDF on every change. Download the PDF.

Page 1 of the japanese and thai line breaking, rendered by Tagua.
  • Japanese line breaking rules (kinsoku)
  • Thai word breaking with a dictionary
  • Justification between characters for Japanese and Thai
  • PDF/A-2b and PDF/UA-1
line-breaking.report.yaml
# yaml-language-server: $schema=../schema/template.schema.json
# Line breaking by the Unicode Line Breaking Algorithm (UAX #14): Japanese breaks between characters but
# keeps punctuation, small kana and closing brackets off the start of a line (kinsoku); Thai, written
# without spaces, breaks between words found with a dictionary; Latin breaks at spaces, after hyphens and
# after slashes. Three narrow, justified columns make every paragraph wrap: Japanese and Thai are
# justified between characters, Latin between words. PDF/A-2b and PDF/UA-1.
version: 1
title: Line breaking
culture: en-GB
document:
author: Acme Ltd
compliance: [pdf-a-2b, pdf-ua-1]
page:
size: A4
margins: 22mm
fonts:
Inter:
regular: fonts/Inter-Regular.ttf
bold: fonts/Inter-Bold.ttf
fallback: [NotoThai, NotoJP]
NotoThai: { regular: fonts/NotoSansThai-Regular.ttf }
NotoJP: { regular: fonts/NotoSansJP-Regular-Subset.otf } # only the characters these samples use
styles:
default: { font: Inter, fontSize: 11pt, lineHeight: 1.7, color: "#1F1F1F" }
label: { fontSize: 8.5pt, color: "#6B6B6B", padding: 0 0 4pt 0 }
column: { padding: 0 0 0 0 }
data:
texts:
fields: { Japanese: string, Thai: string, Latin: string }
body:
dataset: texts
detail:
- padding: 0 0 14pt 0
content:
- { type: text, value: "Line breaking", fontSize: 18pt, fontWeight: bold, tag: h1 }
- type: text
value: >-
Lines break where the Unicode Line Breaking Algorithm allows. Japanese and Chinese break between
characters, except before closing punctuation and small kana or after opening brackets; Thai
breaks between dictionary words. Justified text takes up the slack between characters in
Japanese and Thai, and between words elsewhere.
- layout: row
gap: 18pt
content:
- type: stack
content:
- { type: text, value: "Japanese", style: label }
- { type: text, value: "{Japanese}", language: ja, align: justify }
- type: stack
content:
- { type: text, value: "Thai", style: label }
- { type: text, value: "{Thai}", language: th, align: justify }
- type: stack
content:
- { type: text, value: "Latin", style: label }
- { type: text, value: "{Latin}", align: justify }
pageFooter:
- content:
- { type: text, value: "Page {PageNumber} of {TotalPages}", align: right, color: "#6B6B6B", fontSize: 8pt }

Save the template, put the fonts it names next to it (Inter and the Noto fonts are free, under the SIL Open Font License), and run:

Terminal window
tagua render line-breaking.report.yaml --open

Without a data file, tagua render makes up sample rows from the field types; see Preview as you edit.