[css-text] Universal Compromise Default Justification

One of the tasks we have in CSS3 Text is to provide an example
of a justification algorithm that is simple and i18n-aware and
can be applied to untagged text. (We recommend using more
specialized knowledge when the language is known.)

Here is a proposal for such an algorithm. It does not give ideal
results, but it should be acceptable in the most common cases.

   0. Contract word separators / trimmable punctuation
      if possible and adequate, within limits. (Optional)
   1. Expand word separators up to AmountX.
   2. If there's still more space to distribute,
      expand word separators together with inter-character
      spacing of block scripts, up to an additional AmountX.
   3. If there's still more space to distribute,
      expand word separators and tsek marks together with
      inter-character spacing of block and cluster scripts.

block scripts = Han, Hangul, Kana, Yi, etc.
cluster scripts = Thai, Lao, etc.
AmountX = some possibilities listed below:
   a. min(0.25em, 100% width of U+0020) + character's own advance width
   b. max(0.5em, character’s own advance width)

For most space-separated scripts, this will be like inter-word.

For Korean, this will be mostly like inter-word, but in short
lines with few spaces, it may cause some expansion between
characters.

For Japanese and Chinese, this will be mostly like inter-character
justification, but in lines with a few spaces (as can occur when
Latin phrases are used inline), the spaces might become wider than
is ideal, depending on the limits chosen. (JLREQ maxes spaces out
at 0.5em total.)

For cluster scripts like Thai, this will result in wider spaces
before inter-cluster justification kicks in, which afaik is
appropriate for such scripts.

I think this will produce acceptable, though not optimal, results
for all the scripts I know of.

Comments welcome.

~fantasai

Received on Wednesday, 23 July 2014 16:13:08 UTC