Text Justification
Shortname: text-justify
Level: 1
Status: UD
Work Status: Exploring
Group: csswg
ED: https://drafts.csswg.org/css-text-3/text-justify-i18n
TR: https://www.w3.org/TR/text-justify-i18n/
Editor: Elika J. Etemad / fantasai, Invited Expert, http://fantasai.inkedblade.net/contact
Abstract: This Note serves as a clearinghouse to further information on worldwide conventions for text justification: the process of stretching text to fill a line.
Introduction
Since the amount of content on a line tends to vary,
even if minutely, from line to line within a paragraph,
typographers have come up with various methods
for effective full justification--
causing the text to completely fill the text--
in order to create visual alignment on both edges of a paragraph.
Typographic conventions for full text justification depend on the writing system,
the content language,
and the calligraphic style of the text.
Results also tend to vary based on the capabilities of the layout engine
and a given typographer’s preferences for weighing
its various detrimental effects on typographic color and readability.
This document collects together references for further information
on the typographic conventions for full justification
as they apply to the various writing systems around the world,
together with some guidance for implementers handling unpredictable Web content.
(General information and technical requirements for CSS
are described under the Justification section of [[!CSS3TEXT]].)
Advisement: Additional information and references are hereby solicited;
please send any suggestions for additions, clarifications, corrections, and other improvements
to the W3C Internationalization Working Group at
www-international@w3.org.
Note: Information on which languages use which writing systems
is maintained in the Unicode CLDR.
References
Chinese Writing System (Han Ideographs)
Historically, Chinese was written as Han ideographs, with no punctuation.
Under this system, justification was automatic,
as the characters fit perfectly into a square grid.
However, the introduction of punctuation in recent centuries,
plus the increase in mixed-script text
(such as the inclusion of European numbers and/or words, phrases, names, and trademarks)
has created a need for adjustments within a line.
Chinese notably does not use word spaces,
so these do not provide a justification opportunity within the lines;
thus justification techniques focus on adjustments to spacing around punctuation,
script-change boundaries,
and inter-character spacing.
Japanese Writing System
Like Chinese, Japanese was historically written in Han ideographs;
however it has since developed its own phonetic scripts
Hiragana and Katakana (collectively, Kana).
While pure kana texts do exist,
particularly in children's literature,
Han ideographs (Kanji, in Japanese) continue to be an integral part of normal Japanese text,
and are interspersed with kana within a sentence.
Like Chinese,
embraced European-inspired punctuation, numerals, and other foreign snippets
that don't conform to the standard full-width character grid.
The Japanese writing system also does not use word spaces,
and similarly focuses on adjustments to spacing around punctuation,
script-change boundaries,
and inter-character spacing,
with a notable preference for compression of intra-glyph spacing
over expansion between glyphs.
Korean Writing System
Like Japanese, Korean was historically written in pure Han ideographs,
and has since developed its own phonetic script, Hangul.
Also like Japanese, it has adopted punctuation and numerals.
However, unlike Japanese, Korean has also adopted word spaces,
and tends towards narrow (Western-style, rather than full-width) punctuation.
This allows it to use inter-word justification:
as in English publications, this method stretches the spaces between words
in order to fill the line.
While Han ideographs (Hanja, in Korean) were kept as part of the writing system,
they have become increasingly scarce over time
such that many documents are written in pure Hangul,
and some only use Hanja as inline annotations for disambiguation among homophones
rather than as part of the main text.
However, Hanja and Hangul together remain important components of Korean writing.
Latin (Roman) Writing System
Quite possibly the writing system familiar to more people than any other,
the Latin writing system derives from the Roman alphabet,
including a few additional characters and diacritic marks
to accommodate languages such as Icelandic and modern Vietnamese.
Thanks to the Europeans in the Age of Exploration,
their missionaries,
and the Western-dominated global scholastic culture of the modern age,
most languages in the world have one or more Latin transcriptions,
even those that do not use it as their primary writing system.
The Latin alphabet is a phonetic system with disjoint letterforms,
and typically uses spaces between words.
This allows it to use inter-word justification,
although it can and sometimes does increase the spacing between individual letters as well.
Since it is frequently adopted into other writing systems,
it can sometimes adopt characteristics of that system;
for example, some styles of Japanese typesetting
treat Latin letters the same as Japanese characters
for the purpose of line-breaking and justification.
Ethiopic Writing System
Like Latin, the Ethiopic writing system uses an alphabet of disjoint letters
and uses punctuation to indicate the break between words.
Unlike Latin, Ethiopic traditionally uses a visible word separator--
the Ethiopic Word Space U+1361 “፡”--
although modern documents sometimes use a regular space U+0020 “ ” instead.
Justification strategies are as for Latin:
increasing the space at the word separator,
and/or distributing space between letters.
Arabic Writing System (and Other Cursive Systems)
Arabic is a cursive script,
meaning its letters are typically joined together within a word.
This creates additional challenges,
as the usual method for stretching out text--
inserting spaces between glyphs--
does not work.
Since Arabic uses spaces between words,
one method for justification is inter-word justification--
stretching out the spaces within the line to fill it.
However, most styles of Arabic writing prefer calligraphic elongation or compression,
distorting the shapes and connections between letters
in order to fill the line while preserving its typographic color.
This is often called “kashida”, meaning “stretched”.
A simplistic variant of this technique inserts elongation marks
(sometimes represented with U+0640 “ـ” TATWEEL)
at appropriate points in the text.
Syriac and Mongolian
have properties similar to Arabic,
and in the absence of additional information should be given
similar treatment for justification.
Tibetan Writing System
Tibetan is a Brahmic writing system related to Indic scripts like Devanagari and Gujarati;
however, unlike these systems, it does not use Western-style punctuation
nor spaces between words,
and instead uses the Tibetan Tsheg Mark U+0F0B “་”
between syllables
and its own punctuation marks such as the Tibetan Shad U+0F0D “།” and Tibetan Nyis Shad U+ 0F0E “༎”,
which indicate the end of longer segments.
Justification techniques used in Tibetan include stretching the space after a shad, minutely increasing the spaces after tsheg marks,
and simply filling the remaining space on a line with tsheg marks.
Southeast Asian Writing Systems
In Southeast Asian systems such as Thai and Lao,
letters are merged together into “clusters”.
There are no spaces between words
(lines must be broken by dictionary),
but spaces serve to separate larger units of text.
Techniques for justification include stretching spaces on the line
(if it happens to have any)
and interspersing extra space between clusters.
Scripts in this category include
Khmer, Myanmar, Lao, and Thai.
Other Writing Systems
Most (but not all) writing systems not mentioned here
have discrete letters, like Latin,
and in the absence of more specific information
may be assumed to justify in a similar manner.
Note: Readers who wish to provide such “more specific information”
are invited (and strongly encouraged)
to contact the W3C Internationalization Working Group
so that this document may be updated.
Guidance for Authors and Implementers
Tagging Content By Writing System
While most languages have a preferred writing system,
many can be transcribed into a different system.
As a common example, most languages have a Latin transcription,
and can thus be written in the Latin writing system.
In these cases the document typically adopts the typographic conventions of the Latin writing system:
for example Japanese “romaji” and Chinese Pinyin use word spaces and justify accordingly.
As another example, historical ideographic Korean
(ko-Hant
)
does not use word spaces,
and should therefore be justified as for Chinese.
Authors can indicate the use of the Latin writing system
with the -Latn
language subtag,
e.g. ja-Latn
for Japanese romaji.
Other subtags exist for other writing systems,
see ????.
Some common/historical examples follow:
zh-Latn
- Chinese, written in Latin transcription
ko-Hant
- Korean, written in Hanja (Chinese ideographic characters)
??-Arab
- Turkish, written in Arabic script.
??-???
- Mongolian, written in Cyrillic
??-???
- Mongolian, written in traditional Mongolian script.
UAs should assume the most common writing system for a given language
when choosing a justification strategy,
but must not assume that writing system
if the author has explicitly indicated a different one.
Justifying Untagged Content
Web browsers frequently have to deal with untagged, potentially mixed-script content.
The following are some guidelines for designing a strategy to deal with such content.
- Since Chinese and Japanese do not use spaces to provide justification opportunities,
CJK content (Han, Hiragana, Katakana, and Hangul)
should be allowed to accept inter-character spacing.
- Since Japanese content prefers compression,
CJK fullwidth punctuation characters, if present on a line,
should be compressed at a higher priority (if possible) than expanding spaces
or letter-spacing.
- Since Korean prefers expanding spaces to expanding between characters,
spaces should be expanded at a higher priority (if possible)
than letter-spacing.
Advisement: Authors should use (correct) language tags
in order to get the best possible typographic behavior.
For example, if Japanese text is tagged as Japanese,
the UA knows to preferentially compress the space rather than expand it.
Acknowledgements
This document was compiled with guidance from:
the W3C Internationalization
and CSS Working Groups,
and the W3C
Japanese,
Chinese,
Korean,
and Ethiopic Language Task Forces.