W3C home > Mailing lists > Public > www-style@w3.org > December 2012

Re: [css3-text] letter-spacing doesn't normatively specify the correct way to apply spacing

From: John Daggett <jdaggett@mozilla.com>
Date: Sun, 2 Dec 2012 19:11:15 -0800 (PST)
To: www-style@w3.org
Message-ID: <364971534.2976894.1354504275173.JavaMail.root@mozilla.com>
fantasai wrote:

> > A long time ago in a galaxy far, far away at the San Diego F2F, we
> > discussed the CSS3 letter-spacing property [1]: During the
> > discussion above, David and Elika asserted that given the rules in
> > the spec describing how letter spacing is handled at element
> > boundaries, the effect is the same if letter spacing is applied
> > only at the trailing edge versus being split between the leading
> > and trailing edges.  I fiddled around with this some more and came
> > up with a testcase that demonstrates where this assertion fails:
> >
> >    http://people.mozilla.org/~jdaggett/tests/hebrewletterspacing.html
> >
> > In this example, the span with the red background covers from the
> > beginning of the text through the middle of the numeric value. 
> > But because spacing is only applied along the trailing edge, in
> > Firefox there is double letter spacing at one bidi break and none
> > at the other.  With a model that requires letter spacing to be
> > split on both sides of each letter, the letter spacing applied
> > will be identical at both bidi breaks.
> Firefox is clearly wrong because, as we explained before,
> letter-spacing defines the amount of space *between characters*. If
> there is double that amount or half that amount between characters,
> it is not that amount and is therefore wrong. What needs to be
> clarified in the spec perhaps is that "between" is defined visually,
> i.e. after reordering, not before.
> The model in the spec requires full spacing between
>    1 and ,
>    , and 3
>    ו and א
>    ו and ה
> and zero spacing between any other letters.

You didn't look carefully at the example, the letter-spacing is the
same across the line.  So the spacing should be the same across the
line and never zero as you list above.

My point with the red span was to show that the visual formatting
model is not defined by the spec and the existing practice of adding
spacing just on the trailing/right edge is not the visually ideal one.
In San Diego you and David asserted that a trailing edge model was
equivalent to one where the spacing is applied equally on both sides
of a letter and I'm saying that's not correct.

I can't find any spec wording, either for letter-spacing or
background-color that specifies how the inter-letter spacing within an
element is included within the inline box.  

Consider this set of examples:


Note how A<span>B</span>C renders with letter spacing applied, in all
implementations when the span is colored red a lopsided box is
produced.  In the RTL case, how this is rendered varies by user agent.

In the third set of examples, note how A<span>bet-123</span>C renders.
If the letter spacing is different within the span, what's the spacing
between A and 1?  This *isn't* an element boundary so there's nothing
in the spec to resolve what the spacing should be.

Since all current implementations apply letter spacing at the
beginning and end of lines, there's an opportunity here to fix things.
As part of that I think we should explicitly detail a model that
makes more sense visually than what existing implementations use.


John Daggett
Received on Monday, 3 December 2012 03:11:44 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:24 UTC