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

A message from Sairus Patel:

Dear John,
 
I’m a developer working in several text engines at Adobe, including CSS engines, and am also Adobe’s technical representative to the OpenType and Open Font Format specifications. I had a couple of questions about http://www.w3.org/TR/2009/WD-css3-fonts-20090618/ (though they probably apply to previous versions of CSS as well):
 
1. How does the CSS ‘font-family’ property correlate to the various kinds of family names in the OpenType (or Open Font Format) specification?
 
** name ID 1: the 4-face family name. At most 4 faces can share this family name. E.g. “Minion Pro SmBd”.
** name ID 16: the preferred or typographic family name. Any number of faces can share this family name. E.g. “Minion Pro”.
** name ID 21: the weight/width/slope (WWS) family name. Faces that share this family name can differ only in weight, width, or slope. E.g. “Minion Pro Display”.
 
Name IDs 16 or 21 (the latter in particular) would seem like good candidates. However, there is no Windows GDI API to look up fonts by these kinds of family names. This means that a CSS lookup can’t be implemented using only OS APIs on Windows GDI – the implementation would have to parse the font tables directly and cache results, making for software that is larger and slower than it needs to be. And caching results across software instances (say, in a font cache file on the user’s disk) may be prohibited in that software’s architecture due to security concerns.
 
2. <font-face-name> indicates that “For TrueType and OpenType fonts, the full font name as defined in the font name table is used to reference a given face.”
 
However, there is no way to do a full font name lookup on CFF OpenType fonts using Windows GDI APIs. Thus, <font-face-name> is not implementable by an application on GDI that doesn’t have the luxury of parsing font tables directly and caching the values across software instances.
 
<font-face-name> further says: “Additionally, for TrueType and OpenType fonts user agents may optionally support Postscript name lookup on platforms where that is appropriate.”
 
It sounds like CSS is saying a full name or a PostScript name may be present, and there is no syntax to distinguishing between the two. Technically speaking, this could lead to ambiguities; e.g. a font may have full name F and PostScript Name P, but another font could have full name P.
 
And since PostScript name lookups aren’t available for TrueType fonts on Windows GDI, it isn’t clear why an author would ever use the PostScript name in <font-face-name>.
 
I’m wondering if these concerns have been raised before. I look forward to discussing this.
 
Best,
Sairus Patel

Received on Tuesday, 22 June 2010 06:15:02 UTC