W3C home > Mailing lists > Public > www-style@w3.org > July 2013

RE: [CSS21][css3-text] letter-spacing, word-spacing and justification

From: Stephen Zilles <szilles@adobe.com>
Date: Wed, 31 Jul 2013 11:07:08 -0700
To: Bert Bos <bert@w3.org>, "www-style@w3.org" <www-style@w3.org>
Message-ID: <CE2F61DA5FA23945A4EA99A212B15795720FFB9223@nambx03.corp.adobe.com>
Bert,

I support Proposal 1 below for the following reasons:
1. The proposal resolves an existing problem. I have been told (and cannot confirm) that there is existing CJK content that specifies "letter-spacing:0" and still expects (and in existing implementations gets) spacing between CJK glyphs. It was also asserted that existing implementations typically ignore explicit letter-spacing values.

2. The property, "letter-spacing", which was (originally, I think) created for texts written in Western alphabets, has been extended to South Asian and East Asian scripts. These latter scripts have aspects (such as combining forms and, for some, lack of a word space) that make their use of letter-spacing behave rather differently than it was intended to do for Western texts. For example, the spacing rules for Japanese text are much more complicated than are the rules for Latin script based texts.
  http://www.w3.org/TR/jlreq/#spacing_between_characters


3. Given 1. and 2., above, it seems best to allow an implementation to do as good a job as it can for a given combination of languages and scripts that it must handle. It seems out of scope (in this level) to specify a good mechanism to control how the spacing choices are made. (In my opinion, both "fixed" not allowing any use of "letter-spacing" during justification and "min/max" controls on the amount are too weak to be useful and may limit a better future solution. I believe we are in the experimentation phase where implementations will learn what they need to control based on what they have delivered and the bugs they receive on those implementations. Only with more experience can we design a suitable control mechanism. That does not mean that I think that we do not need controls; I strongly believe we need controls, but also do not know what they should look like to handle all the language/script combinations.

4. I do not believe that "fixed" is needed provided that implementations limit the amount of justification driven letter-spacing they allow in each context: less (say +- 5%) for Latin and Cyrillic text, more for CJK text, and grapheme cluster based spacing for South Asian scripts. Good implementations will adapt at the paragraph level and not just locally, but that is very difficult to specify (see Japanese Layout Task Force report noted above). With reasonable limits it will be difficult to see that justification based letter spacing is being done on purely Western texts and it will not, therefore, make an appreciable change to explicit letters spacing used for emphasis in German texts and to replace small capitals in Cyrillic texts.

Having said all that, I note that this problem partly arises because (as noted in 2. above) Western "letter-spacing" was extended to cover other scripts. One option, therefore, would be to say that "letter-spacing" only applies between letters of certain scripts, say Latin and Cyrillic scripts and introduce other properties to control spacing between Ideographs (and related kana) or between South and Southeast Asian scripts. These would have separate controls and behaviors. This would mean that "letter-spacing:0em" would have no effect on CJK scripts so it would not prohibit justification using spacing between Ideographs. It would, however, also mean that "letter-spacing:1em" would have no effect either. That would only matter if existing implementations are letter-spacing CJK text. The main disadvantage of this approach, is that it does not deal with the places where scripts collide: Latin script text within CJK text or visa versa, for example.

Limiting the distribution of justification based letter-spacing to runs where "text-justify:distribute" applies is imaginative, but does not really deal with the underlying problem of interactions between scripts in that case. Typographic experience has shown that one can get much better typography by allowing a certain amount of (usually undetectable) justification based letter-spacing to be automatically applied. Why not enable that always and find out where that fails before settling on a fix.

So, I believe that going with Proposal 1 is the best available solution. And, I hope that we can learn how to develop controls to handle the range of formatting options our users need.

Steve Zilles



-----Original Message-----
From: Bert Bos [mailto:bert@w3.org] 
Sent: Wednesday, July 31, 2013 3:19 AM
To: www-style@w3.org
Subject: Re: [CSS21][css3-text] letter-spacing, word-spacing and justification

On Tuesday 30 July 2013 22:34:45 fantasai wrote:
> On 05/10/2013 07:17 PM, fantasai wrote:
> > Our proposal...
> 
> Steve Zilles asked for proposed text for these...
> 
> > Part I: letter-spacing: <length> allows justification
> > 
> >    This solves backwards-compatibility with such style sheets as
> >    you mention, and is also consistent with implementations.
> >    
> >    It is also consistent with how 'word-spacing' behaves: <length>
> >    values there allow justification.
> >    
> >    (Note: This would be a change from CSS2.1, so will need to be
> >    backported.)
> 
> Proposed text, added to 'letter-spacing' section;
> 
>   | Depending on the justification rules in effect, user agents may
>   | further increase or decrease the space between characters
>   | in order to justify text. See 'text-justify' for details.
> > 
> > Part II: Add 'fixed' keyword to disallow justification
> > 
> >    We have a problem if we allow justification for letter-spacing
> >    always; German typesetting rules requires that it not be
> >    allowed! So here is a proposal --
> >    
> >      letter-spacing: normal | <length> || fixed
> >    
> >    If 'fixed' keyword is specified, then justification cannot alter
> >    letter-spacing, only word-spacing.
> > 
> > I think Part I is important to take. I am open to other suggestions 
> > to solve the use case in Part II...
> 
> Proposed text:
>   | fixed
>   | 
>   |   When this keyword is specified, user agents must not adjust
>   |   spacing between characters in order to justify text.
>   |   Justification is only allowed at expansion opportunities
>   |   provided by a single character (such as a word separator or
>   |   other punctuation).
>   | 
>   | Unless the ''fixed'' keyword is specified, depending on ...
>   | [above] ...

That changes the meaning of 'letter-spacing' as it has been used until now (and which I've been relying on).

Besides, using inter-letter spacing for justification is something you don't want to happen by default. If you have a really difficult text, you may want to explicitly enable it, if there is no other option.

I propose explaining under the <length> value of 'letter-spacing' that the space between letters may still be varied for the purposes of justification if 'text-justify' is set to 'distribute':

    User agents may not further increase or decrease the inter-character
    space in order to justify text <ins>except if 'text-justify' is
    'distribute'</ins>.

> 
> Relatedly, I think we need to add this to the 'text-justify' section:
>   | It is not defined in this level whether or how other factors
>   | (such as font size, letter-spacing, glyph shape, position
>   | within the line, etc.) may influence the distribution of
>   | space to expansion opportunities within the line.
> 
> because while justification space is additive with tracking, I don't 
> think we want to define that it can't account for differences in
> tracking: I'm pretty sure that adding 2px space between characters is 
> more noticeable with zero spacing than with 10px spacing, and while we 
> do want differences in letter-spacing to not be equalized away, imo 
> the UA should be allowed to bias justification space to make it less 
> noticeable.
> 
> ~fantasai



Bert
-- 
  Bert Bos                                ( W 3 C ) http://www.w3.org/

  http://www.w3.org/people/bos                               W3C/ERCIM
  bert@w3.org                             2004 Rt des Lucioles / BP 93
  +33 (0)4 92 38 76 92            06902 Sophia Antipolis Cedex, France

Received on Wednesday, 31 July 2013 18:08:34 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:39:13 UTC