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

[css3-fonts] simplifying font-variant-ligatures, proposal 2

From: John Daggett <jdaggett@mozilla.com>
Date: Wed, 22 Feb 2012 21:22:36 -0800 (PST)
To: www-style list <www-style@w3.org>
Message-ID: <288940166.338070.1329974556436.JavaMail.root@zimbra1.shared.sjc1.mozilla.com>
Given the reaction to my original proposal for simplifying
font-variant-ligatures, I'd like to propose a smaller set of changes,
ones that hopefully cover the majority of use cases while making the
syntax less verbose.

As noted previously, the current syntax is:

  font-variant-ligatures: normal | inherit | [ <common-lig-values> || <discretionary-lig-values> || <historical-lig-values> ]


  <common-lig-values>        = [ common-ligatures | no-common-ligatures ]
  <discretionary-lig-values> = [ discretionary-ligatures | no-discretionary-ligatures ]
  <historical-lig-values>    = [ historical-ligatures | no-historical-ligatures ]

OpenType defines certain features as "on by default" and this includes
the common ligature feature 'liga'. So the property values here are not
completely boolean properties, they are really tri-state with possible
states being "use defaults", "explicitly on" or "explicitly off".  In
the default 'font-variant-ligatures: normal' case, 'fi' ligatures will
appear but discretionary ligatures such as 'st' and 'ct' ligatures won't
(fonts can choose which ligatures are classified under which feature but
these examples are a typical pattern).

Additionally, features can be enabled/disabled per-font via
@font-face rules:

  @font-face {
    font-family: DefaultText;
    src: url(xxx.woff) format("woff");
    font-variant: discretionary-ligatures;

  body { font-family: DefaultText; }

  /* override font-specific setting, common ligatures on by default */
  span.special { font-variant-ligatures: no-discretionary-ligatures; }

I think we can eliminate a couple of these 'no-xxx' values by defining
'common-ligatures' to mean "base only" and have the other values
(discretionary, historical) be additive:

  font-variant-ligatures: normal | inherit | no-ligatures | [ common-ligatures || discretionary-ligatures || historical-ligatures ]

In terms of OpenType features this would translate to:

  normal                  == use defaults, both OpenType and font-specific
  no-ligatures            == liga=0, clig=0, dlig=0, hlig=0
  common-ligatures        == liga=1, clig=1, dlig=0, hlig=0 *
  discretionary-ligatures == dlig=1
  historical-ligatures    == hlig=1

  * = (dlig/hlig) explicitly turned off when (discretionary-ligatures/historical-ligatures) 
      not also listed

Note: I've added 'clig' == "contextual ligatures" to common-ligatures,
moving it from 'contextual' in 'font-variant-alternates'.

Using the new syntax with the example above:

  /* override font-specific setting, enable only common ligatures explicitly */
  span.special { font-variant-ligatures: common-ligatures; }

The only situation this wouldn't cover would be one where an
author explicitly wants to disable common ligatures but wants to enable
only historical ligatures (or only discretionary ligatures).


John Daggett
Received on Thursday, 23 February 2012 05:23:04 UTC

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