W3C home > Mailing lists > Public > www-style@w3.org > June 2009

Re: [OpenType] advanced font features in CSS

From: Giovanni Campagna <scampa.giovanni@gmail.com>
Date: Tue, 30 Jun 2009 15:16:56 +0200
Message-ID: <65307430906300616x38820eaw65ba14e508b3c6af@mail.gmail.com>
To: John Daggett <jdaggett@mozilla.com>
Cc: www-style <www-style@w3.org>, opentype-migration-list <opentype-migration-list@indx.co.uk>
2009/6/30 John Daggett <jdaggett@mozilla.com>:
> Hi Paul,
>
>> I would like to propose that W3C might consider something like what I did for WPF.
>> (http://msdn.microsoft.com/en-us/library/system.windows.documents.typography_properties.aspx)
>>
>> The thought behind the approach I used was to make the naming to be technology independent.
>> Thus, any smart font technology, i.e. AAT, Graphite, OpenType, etc., can be used to implement the layout.
>
> The WPF approach is definitely interesting, that's why I included it in the list of references.
> Some properties/values are directly based on those in WPF.
>
> The one downside is that it leads to a *lot* of properties, I was hoping to put together something
> simpler. †For example, do you think all the ss## properties need to be separate boolean
> properties, as in WPF?

We still have shorthand properties if you don't want many different
properties. You could go with:

font-variant-alternates: <integer> [<integer> [<integer>] ]
mapping (in that order) to AnnotationAlternates, ContextualAlternates,
StylisticAlternates. Initial is 0 0 0. Absence is 0

font-variant-ligatures: [ contextual || discretionary || historical ||
standard ] | no-ligatures
mapping (true if present, false otherwise) to ContextualLigatures,
DiscretionaryLigatures, HistoricalLigatures, StandardLigatures. Use
no-ligatures to set all to false.

font-variant-capitals: normal-caps || small-caps || petite-caps ||
unicase || titling
mapping to the Capitals feature. I assume that all-* version are not
needed, given text-transform:lowercase

font-variant-east-asian: [ expert-forms || [ jis78 | jis83 | jis90 |
jis04 | hojo-kanji | nlc-kanji | simplified | traditional |
traditional-names ] || [ proportional-width | half-width | full-width
| third-width | quarter-width ] | normal-east-asian
mapping to the boolean EastAsianExpertForms, and to the enumerate
EastAsianLanguage and EastAsianWidth features. The absence of a
feature indicates normal for that feature. Normal-east-asian is normal
for all.

font-variant-swashes: <integer> [<integer>]
mapping (in that order) to StandardSwashes and ContextualSwashes.
Initial is 0 0. Absence is 0

font-variant-stylesets: <integer>+
mapping to the various Stylesets##. A present integer is true, an
absent is false. Numbers that don't exists

font-variant-numeric: [[ proportional-numbers | tabular-numbers ] || [
slashed-fraction | stacked-fraction ] || [ lining-numbers |
old-style-numbers ] || slashed-zero ] | normal-numbers
mapping to the NumeralAlignment, Fraction, NumeralStyle and
SlashedZero features. The absence of a feature indicates normal for
that feature. Normal-numbers sets all to normal

font-variant-misc: [ case-sensitive-forms || capital-spacing ||
math-greek || historical-forms || [ superscript | subscript | inferior
| ordinal | ruby ] ] | normal-variant
mapping to CaseSensitiveForms, CapitalSpacing, MathematicalGreek,
HistoricalForms and Variant. Absence indicates false for boolean and
normal for enumeration. Normal-variant sets Variant to normal and the
rest to false.

lastly, the full shorthand:
font-variant: normal | [ [<font-variant-ligatures> ||
<font-variant-capitals> || <font-variant-east-asian> ||
<font-variant-numeric> || <font-variant-misc>] [ "/"
<font-variant-swashes> [ "/" <font-variant-stylesets> [ "/"
<font-variant-alternates> ] ] ] | [ "/" "/" <font-variant-stylesets> [
"/" <font-variant-alternates> ] ] | ["/" "/" "/"
<font-variant-alternates> ] ]

The syntax is rather arcane but it is necessary to avoid keywords for
swashes / alternates / stylesets. It is similar to the border-image
shorthand syntax. Properties that are not set explicitly are set to
the initial value, as usual.

This model should allow to set independently all properties in the WPF
page (except Kerning, which is mapped to a separate kerning property,
defined by SVG), only using 8 properties plus the shorthand.

Hope this helps,

Giovanni

> Cheers,
>
> John
>
> -----Original Message-----
> From: listmaster@indx.co.uk [mailto:listmaster@indx.co.uk] On Behalf Of John Daggett
> Sent: Monday, June 29, 2009 2:12 AM
> To: multiple recipients of OpenType - sent by
> Subject: [OpenType] advanced font features in CSS
>
> Message from OpenType list:
>
>
> I just wanted to let folks know that Iíve posted a proposal for adding
> advanced font feature support to CSS to the www-style mailing list:
>
> †http://lists.w3.org/Archives/Public/www-style/2009Jun/0506.html
>
> The basic idea is to enable control of ligatures, alternates, swashes
> and numerical formatting features available in OpenType and AAT fonts
> within webpages in a relatively simple manner. The proposal lists
> specific mappings of font-variant-xxx properties/values to OpenType/AAT
> features but I donít expect to get this right the first time, Iím sure
> it will take a few iterations to hone. Iím especially interested in
> hearing about features omitted or overlooked that folks feel are
> actually valuable to support.
>
> Any comments/thoughts/ideas would be most helpful, posted here or on the
> www-style mailing list.
>
> John Daggett
> Mozilla Japan
>
>
> subscribe: opentype-migration-sub@indx.co.uk
> unsubscribe: opentype-migration-unsub@indx.co.uk
> messages: opentype-migration-list@indx.co.uk
>
>
>
>
>
Received on Tuesday, 30 June 2009 13:17:38 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:19 GMT