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

[css3-text] when does 'letter-spacing' disable ligatures?

From: John Daggett <jdaggett@mozilla.com>
Date: Wed, 14 Aug 2013 07:35:38 -0700 (PDT)
To: www-style list <www-style@w3.org>
Message-ID: <2141117517.3109623.1376490938280.JavaMail.zimbra@mozilla.com>

The current definition of the 'letter-spacing' property says:

# When the effective letter-spacing between two characters is not zero
# (due to either justification or non-zero computed ‘letter-spacing’),
# user agents should not apply optional ligatures. 

So if either 'letter-spacing: 0px' is set or somehow the combination
of 'letter-spacing' plus added expansion/compression due to
'text-justify: auto' or 'text-justify: distribute' results in no
additional spacing between letters, ligatures are enabled.  Any other
non-normal value for 'letter-spacing' or when justification adds
inter-character spacing, ligatures are disabled.

The problem with this is that it leads to a rather ugly discontinuity,
since ligatures typically don't have the same width as the underlying
individual glyphs.

See the example below:

http://people.mozilla.org/~jdaggett/tests/letterspacinganimation.html

Here letter-spacing is varied from a small negative value to a small
positive value.  In the upper example I've set it up to explicitly
mimic the behavior defined in the CSS3 Text spec.  Note how the text
jumps around at the 'letter-spacing: 0px' point.  That's because the
ligature pops in, affecting the overall width, then pops out again,
undoing the width change.

I think simply disabling ligatures when 'letter-spacing' is set to a
non-normal value would result in fewer problems like this.  This is the
behavior in the lower example.

Cheers,

John Daggett
Received on Wednesday, 14 August 2013 14:36:05 UTC

This archive was generated by hypermail 2.4.0 : Monday, 23 January 2023 02:14:30 UTC