RE: [css3-fonts] Relationship between OpenType and CSS font names

What I'm hearing is that CSS does not specify how CSS authoring software should set font-family, for OpenType fonts.

Since OT provides several kinds of family names, authoring software is essentially on their own.

For example, there is no conformant way to generate font-family when using the XP/Vista/Win7 font Arial Black, which has name ID 1 "Arial Black" and name ID 16 "Arial". Would you say this is an accurate statement?

(I'm not familiar with CSS' approach to conformance -- OT and OFF certainly don't have any rigorous conformance standards.)

> Are you saying you want large font families like Minion Pro to work with
> the same name on Windows and OSX?

Certainly. A web page can be viewed on any platform. If the user has the Minion Pro family installed, the fonts "should" work.

Note that it woud be acceptable to use the OT 4-face family name (name ID 1) for font-family ("Minion Pro SmBd", etc) -- it's just the CSS spec doesn't say so. (Remember that GDI is present in Vista as well as Windows 7. Also, in my experiments, Mac OS APIs appear to match on on name ID 1 with certain caveats.)

It would be acceptable even if CSS specified that OpenType's WWS (Weight/Width/Slope) family name as specified by name ID 21 and OS/2.fsSelection bit 8 is to be used. We know that we'd need to parse font tables on XP to get this to work in a UA, but at least the CSS spec would be clear, and a UA that needs to call only GDI can be justified in not doing a full implementation on GDI.

> Plus there are features in CSS3 that will make the above constraints impossible
> using only GDI, you need to use some form of OpenType Layout engine.

Could you please point me to a description of these features?

Thanks,
Sairus

-----Original Message-----
From: John Daggett [mailto:jdaggett@mozilla.com] 
Sent: Wednesday, June 23, 2010 3:25 AM
To: Sairus Patel
Cc: www-style; www-font
Subject: Re: [css3-fonts] Relationship between OpenType and CSS font names

Hi Sairus,

> Thanks for your prompt and detailed response, John. Just to be
> clear, this is the scope of the effort I'm involved in:
> 
> a. A user (or authoring tool) creates HTML with CSS that specifies
> an OS-installed font via a {family-name + weight/width/slope
> properties} descriptor or a font-face-name descriptor.
> 
> b. A UA must be able to precisely match the desired font when this
> HTML is viewed on XP and Mac OS, when the desired font is installed
> on those OSes.
> 
> c. The above should work for any reasonably well-formed OT fonts,
> whether or not they ship with the OS. Adobe's font library is a good
> place to start.
> 
> d. The UA must not parse font tables directly, for efficiency
> reasons. The only interface to the font is by OS APIs.
> 
> e. The font descriptor must be cross-platform. That is, a single
> font descriptor must be used for both XP and Mac OS. Multiple font
> descriptors for the same font, one for each platform, are not
> allowed.

These are difficult constraints to satisfy unfortunately.  Each
platform has it's own special voodoo to deal with.  If you're only
using GDI, you're going to have trouble matching preferred family
names, since as you know GDI provides no way of sniffing the preferred
family name without reading tables.  Localized family names will not
work in all locales, since GDI matching is based on locale (e.g.
Japanese font names will only match when the Windows system locale is
Japanese, play around with Kozuka Gothic Pro). Similarly, font
matching behavior of localized names is tricky on OSX, proper OS API's
for dealing with this are only available on 10.6.

The last constraint (e) I don't quite understand.  Typically platforms
don't share font families beyond the basic web fonts.  Are you saying
you want large font families like Minion Pro to work with the same
name on Windows and OSX?

A larger question is are you targeting CSS 2.1?  Or CSS3 Fonts?  CSS
2.1 doesn't have tight conformance family naming constraints.  CSS3
Fonts conformance will be tighter but there are still problems rooted
in OpenType spec problems that we can't completely fix.  Plus there
are features in CSS3 that will make the above constraints impossible
using only GDI, you need to use some form of OpenType Layout engine.

> Arial Black comes with XP and Vista as well [source:
> http://www.microsoft.com/typography/fonts]. Office 2007 adds Arial
> Narrow (4 faces), which, like Arial Black and the standard 4 faces
> of Arial, use the same preferred family name, "Arial".

Sure, but ask what faces belong to the 'Arial' family and you'll get
different answers from GDI (basic 4 faces) and DirectWrite (basic 4
faces plus black face).

A similar disparity exists on OSX, if you use Carbon interfaces as
Flash has for a long time you get different answers for what faces
belong to which family compared to Cocoa APIs.  What users see in
FontBook will match the Cocoa API and will be closer to what
DirectWrite APIs report.  I would strongly suggest you base your
project(s) on these APIs, with some level of fallback code for dealing
with our dear friend Windows XP.

Regards,

John Daggett

Received on Wednesday, 23 June 2010 20:01:21 UTC