Skip to content

Commit c2d70ec

Browse files
committed
[css-text] Improve descriptions for auto/kashida justification
1 parent b8431cf commit c2d70ec

2 files changed

Lines changed: 94 additions & 32 deletions

File tree

css-text/Overview.bs

Lines changed: 47 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1566,12 +1566,34 @@ Canonical order: N/A
15661566
on a balance between performance and adequate presentation quality.
15671567
UAs should, where possible, use a justification algorithm appropriate to the text.
15681568

1569+
<p class="example">
1570+
For example, the UA could use by default a justification method that is a
1571+
simple universal compromise for all writing systems&mdash;such as
1572+
primarily expanding <i>word separators</i>
1573+
and between CJK <i>visually-perceived letters</i>
1574+
along with secondarily expanding between Southeast Asian <i>visually-perceived letters</i>.
1575+
Then, in cases where the <i>content language</i> of the paragraph is known,
1576+
it could choose a more language-tailored justification behavior
1577+
e.g. following [[JLREQ]] for Japanese,
1578+
using cursive elongation for Arabic,
1579+
using ''inter-word'' for German,
1580+
etc.
1581+
15691582
<div class="figure" id="fig-text-justify-cursive">
15701583
<p>
15711584
<img alt="Two lines of calligraphic Arabic end together due to a mix of compressed and swash forms."
15721585
title="Swash forms elongate the first line while a compressed contextual ligature shortens the second, allowing both to end precisely together."
15731586
src="text-justify-cursive.png"></p>
1574-
<p class="caption">An example of cursively-justified Arabic text rendered by <a href="http://www.decotype.com/">Tasmeem</a>.
1587+
<p class="caption">An example of cursively-justified Arabic text,
1588+
rendered by <a href="http://www.decotype.com/">Tasmeem</a>.
1589+
Like English, Arabic can be justified by adjusting the spacing between words,
1590+
but in most styles it can also be justified by calligraphically elongating or compressing the letterforms themselves.
1591+
In this example, the upper text is extended to fill the line by the use of elongated (kashida) forms and swash forms,
1592+
while the bottom line is compressed slightly by using a stacked combination for the characters between ت and م.
1593+
By employing traditional calligraphic techniques,
1594+
Tasmeem can justify the line while preserving flow and color,
1595+
providing a very high quality justification effect.
1596+
However, this is by its nature a very script-specific effect.
15751597
</div>
15761598

15771599
<div class="figure" id="fig-text-justify-compromise">
@@ -1581,6 +1603,10 @@ Canonical order: N/A
15811603
<p class="caption">Mixed-script text with ''text-justify: auto'':
15821604
this interpretation uses a universal-compromise justification method,
15831605
expanding at spaces as well as between CJK and Southeast Asian letters.
1606+
This effectively uses inter-word + inter-ideograph spacing
1607+
for lines that have word-separators and/or CJK characters
1608+
and falls back to inter-cluster behavior for lines that don't
1609+
or for which the space stretches too far.
15841610
</div>
15851611

15861612
<dt><dfn>none</dfn></dt>
@@ -1704,13 +1730,31 @@ Unexpandable Text</h4>
17041730
<h4 id="justify-cursive">
17051731
Cursive Scripts</h4>
17061732

1707-
<p>Justification <em>must not</em> introduce gaps between <i>visually-perceived letters</i>
1733+
<p>Justification <em>must not</em> introduce gaps between the joined <i>visually-perceived letters</i>
17081734
of <i>cursive scripts</i> such as Arabic.
17091735
If it is able, the UA <em>may</em>
17101736
translate space distributed to <i>justification opportunities</i> within a run of such <i>visually-perceived letters</i>
17111737
into some form of cursive elongation for that run.
17121738
It otherwise <em>must</em> assume that no <i>justification opportunity</i> exists
1713-
between any pair of <i>visually-perceived letters</i> in <i>cursive script</i>.
1739+
between any pair of <i>visually-perceived letters</i> in <i>cursive script</i>
1740+
(regardless of whether they join).
1741+
1742+
<div class="example">
1743+
<p>The following are examples of unacceptable justification:
1744+
<div class="figure">
1745+
<p><img alt="" src="arabic-stretch-spaced.png">
1746+
<p class="caption">Adding gaps between every pair of Arabic letters
1747+
</div>
1748+
<div class="figure">
1749+
<p><img alt="" src="arabic-stretch-unjoined.png">
1750+
<p class="caption">Adding gaps between every pair of unjoined Arabic letters
1751+
</div>
1752+
</div>
1753+
1754+
<p>Some font designs allow for the use of the tatweel character for justification.
1755+
A UA that performs tatweel-based justification must properly handle the rules for its use.
1756+
Note that correct insertion of tatweel characters depends on context, including
1757+
the letter-combinations involved, location within the word, and location of the word within the line.
17141758

17151759
<h4 id="justify-algos">
17161760
Possible Algorithms</h4>
@@ -1729,19 +1773,6 @@ Possible Algorithms</h4>
17291773
<li>The boundary between a <i>visually-perceived character</i> of any <i>clustered scripts</i> and any other <i>visually-perceived character</i>
17301774
</ul>
17311775

1732-
<p class="example">
1733-
For example, the UA could use by default a justification method that is a
1734-
simple universal compromise for all writing systems&mdash;such as
1735-
primarily expanding <i>word separators</i>
1736-
and between CJK <i>visually-perceived letters</i>
1737-
along with secondarily expanding between Southeast Asian <i>visually-perceived letters</i>.
1738-
Then, in cases where the <i>content language</i> of the paragraph is known,
1739-
it could choose a more language-tailored justification behavior
1740-
e.g. following [[JLREQ]] for Japanese,
1741-
using cursive elongation for Arabic,
1742-
using ''inter-word'' for German,
1743-
etc.
1744-
17451776
<p>The guidelines in this level of CSS do not describe a complete
17461777
justification algorithm. They are merely a minimum set of requirements
17471778
that a complete algorithm should meet. Limiting the set of requirements

css-text/Overview.html

Lines changed: 47 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1722,10 +1722,32 @@ <h3 class="heading settled heading" data-level=7.4 id=text-justify-property><spa
17221722
on a balance between performance and adequate presentation quality.
17231723
UAs should, where possible, use a justification algorithm appropriate to the text.
17241724

1725+
<p class=example>
1726+
For example, the UA could use by default a justification method that is a
1727+
simple universal compromise for all writing systems—such as
1728+
primarily expanding <a data-link-type=dfn href=#word-separator title="word separators">word separators</a>
1729+
and between CJK <a data-link-type=dfn href=#visually-perceived-letter title="visually-perceived letters">visually-perceived letters</a>
1730+
along with secondarily expanding between Southeast Asian <a data-link-type=dfn href=#visually-perceived-letter title="visually-perceived letters">visually-perceived letters</a>.
1731+
Then, in cases where the <a data-link-type=dfn href=#content-language title="content language">content language</a> of the paragraph is known,
1732+
it could choose a more language-tailored justification behavior
1733+
e.g. following <a data-biblio-type=informative data-link-type=biblio href=#biblio-jlreq title=biblio-jlreq>[JLREQ]</a> for Japanese,
1734+
using cursive elongation for Arabic,
1735+
using <a class=css data-link-type=maybe href=#valuedef-inter-word title=inter-word>inter-word</a> for German,
1736+
etc.
1737+
17251738
<div class=figure id=fig-text-justify-cursive>
17261739
<p>
17271740
<img alt="Two lines of calligraphic Arabic end together due to a mix of compressed and swash forms." src=text-justify-cursive.png title="Swash forms elongate the first line while a compressed contextual ligature shortens the second, allowing both to end precisely together."></p>
1728-
<p class=caption>An example of cursively-justified Arabic text rendered by <a href=http://www.decotype.com/>Tasmeem</a>.
1741+
<p class=caption>An example of cursively-justified Arabic text,
1742+
rendered by <a href=http://www.decotype.com/>Tasmeem</a>.
1743+
Like English, Arabic can be justified by adjusting the spacing between words,
1744+
but in most styles it can also be justified by calligraphically elongating or compressing the letterforms themselves.
1745+
In this example, the upper text is extended to fill the line by the use of elongated (kashida) forms and swash forms,
1746+
while the bottom line is compressed slightly by using a stacked combination for the characters between ت and م.
1747+
By employing traditional calligraphic techniques,
1748+
Tasmeem can justify the line while preserving flow and color,
1749+
providing a very high quality justification effect.
1750+
However, this is by its nature a very script-specific effect.
17291751
</div>
17301752

17311753
<div class=figure id=fig-text-justify-compromise>
@@ -1734,6 +1756,10 @@ <h3 class="heading settled heading" data-level=7.4 id=text-justify-property><spa
17341756
<p class=caption>Mixed-script text with <a class=css data-link-type=propdesc href=#propdef-text-justify title=text-justify>text-justify: auto</a>:
17351757
this interpretation uses a universal-compromise justification method,
17361758
expanding at spaces as well as between CJK and Southeast Asian letters.
1759+
This effectively uses inter-word + inter-ideograph spacing
1760+
for lines that have word-separators and/or CJK characters
1761+
and falls back to inter-cluster behavior for lines that don’t
1762+
or for which the space stretches too far.
17371763
</div>
17381764

17391765
<dt><dfn class=css-code data-dfn-for=text-justify data-dfn-type=value data-export="" id=valuedef-none2>none<a class=self-link href=#valuedef-none2></a></dfn></dt>
@@ -1854,13 +1880,31 @@ <h4 class="heading settled heading" data-level=7.4.3 id=justify-limits><span cla
18541880
<h4 class="heading settled heading" data-level=7.4.4 id=justify-cursive><span class=secno>7.4.4 </span><span class=content>
18551881
Cursive Scripts</span><a class=self-link href=#justify-cursive></a></h4>
18561882

1857-
<p>Justification <em>must not</em> introduce gaps between <a data-link-type=dfn href=#visually-perceived-letter title="visually-perceived letters">visually-perceived letters</a>
1883+
<p>Justification <em>must not</em> introduce gaps between the joined <a data-link-type=dfn href=#visually-perceived-letter title="visually-perceived letters">visually-perceived letters</a>
18581884
of <a data-link-type=dfn href=#cursive-script title="cursive scripts">cursive scripts</a> such as Arabic.
18591885
If it is able, the UA <em>may</em>
18601886
translate space distributed to <a data-link-type=dfn href=#justification-opportunity title="justification opportunities">justification opportunities</a> within a run of such <a data-link-type=dfn href=#visually-perceived-letter title="visually-perceived letters">visually-perceived letters</a>
18611887
into some form of cursive elongation for that run.
18621888
It otherwise <em>must</em> assume that no <a data-link-type=dfn href=#justification-opportunity title="justification opportunity">justification opportunity</a> exists
1863-
between any pair of <a data-link-type=dfn href=#visually-perceived-letter title="visually-perceived letters">visually-perceived letters</a> in <a data-link-type=dfn href=#cursive-script title="cursive script">cursive script</a>.
1889+
between any pair of <a data-link-type=dfn href=#visually-perceived-letter title="visually-perceived letters">visually-perceived letters</a> in <a data-link-type=dfn href=#cursive-script title="cursive script">cursive script</a>
1890+
(regardless of whether they join).
1891+
1892+
<div class=example>
1893+
<p>The following are examples of unacceptable justification:
1894+
<div class=figure>
1895+
<p><img alt="" src=arabic-stretch-spaced.png>
1896+
<p class=caption>Adding gaps between every pair of Arabic letters
1897+
</div>
1898+
<div class=figure>
1899+
<p><img alt="" src=arabic-stretch-unjoined.png>
1900+
<p class=caption>Adding gaps between every pair of unjoined Arabic letters
1901+
</div>
1902+
</div>
1903+
1904+
<p>Some font designs allow for the use of the tatweel character for justification.
1905+
A UA that performs tatweel-based justification must properly handle the rules for its use.
1906+
Note that correct insertion of tatweel characters depends on context, including
1907+
the letter-combinations involved, location within the word, and location of the word within the line.
18641908

18651909
<h4 class="heading settled heading" data-level=7.4.5 id=justify-algos><span class=secno>7.4.5 </span><span class=content>
18661910
Possible Algorithms</span><a class=self-link href=#justify-algos></a></h4>
@@ -1879,19 +1923,6 @@ <h4 class="heading settled heading" data-level=7.4.5 id=justify-algos><span clas
18791923
<li>The boundary between a <a data-link-type=dfn href=#visually-perceived-character title="visually-perceived character">visually-perceived character</a> of any <a data-link-type=dfn href=#clustered-scripts title="clustered scripts">clustered scripts</a> and any other <a data-link-type=dfn href=#visually-perceived-character title="visually-perceived character">visually-perceived character</a>
18801924
</ul>
18811925

1882-
<p class=example>
1883-
For example, the UA could use by default a justification method that is a
1884-
simple universal compromise for all writing systems—such as
1885-
primarily expanding <a data-link-type=dfn href=#word-separator title="word separators">word separators</a>
1886-
and between CJK <a data-link-type=dfn href=#visually-perceived-letter title="visually-perceived letters">visually-perceived letters</a>
1887-
along with secondarily expanding between Southeast Asian <a data-link-type=dfn href=#visually-perceived-letter title="visually-perceived letters">visually-perceived letters</a>.
1888-
Then, in cases where the <a data-link-type=dfn href=#content-language title="content language">content language</a> of the paragraph is known,
1889-
it could choose a more language-tailored justification behavior
1890-
e.g. following <a data-biblio-type=informative data-link-type=biblio href=#biblio-jlreq title=biblio-jlreq>[JLREQ]</a> for Japanese,
1891-
using cursive elongation for Arabic,
1892-
using <a class=css data-link-type=maybe href=#valuedef-inter-word title=inter-word>inter-word</a> for German,
1893-
etc.
1894-
18951926
<p>The guidelines in this level of CSS do not describe a complete
18961927
justification algorithm. They are merely a minimum set of requirements
18971928
that a complete algorithm should meet. Limiting the set of requirements

0 commit comments

Comments
 (0)