Comment 16 for bug 475889

Revision history for this message
In , Nicolas-mailhot-laposte (nicolas-mailhot-laposte) wrote :

It is normal that font sub-families are not limited to n,r,b,bi. The Opentype spec allowed more subfamilies a long time ago. So fonts with the same family name are going to be merged with lots of different sub-families.

Now the people that write the Opentype spec did it in two times :
1. at first they did not put any constraint on font subfamily names; "red beetle" was a valid style name
2. then when microsoft tried to make use of the new fonts in vista it realised apps needed a fixed list of possible subfamilies to be able manage them (it is not possible to use CSS font style operators when a valid subfamily can be "naughty crocodile"). So in a later spec version they restricted the possible subfamilies to a specific list (defined in their WWS whitepaper)

Right now fontconfig does not check if fonts conform to spec 2. even though it is known such fonts are application-unfriendly (ms transforms the font subfamily names with heuristics to make sure apps have a name conforming to 2. even if the font itself is broken). So it lets any font subfamily pass in a merged font. But what is broken is the font files, not fontconfig.

Also, some apps like openoffice.org were written with assumptions such as "only n,r,b,bi styles can exist". They are slowly being fixed but in the meanwhile they are broken with modern fonts. And the fix is not to hide modern fonts from them in fontconfig, the fix is to change those apps. Since only n,r,b,bi styles existed for a long time, finding the problem bits of code and fixing them is slow

To understand this mess you need to read
http://nim.fedorapeople.org/Understanding%20fonts%20and%20fontconfig.tar.gz
http://blogs.msdn.com/text/attachment/2249036.ashx
http://blogs.adobe.com/typblography/typotechnica2007/Font%20names.pdf
http://blogs.adobe.com/typblography/atypi2006/CSS%20&%20OT%2015.pdf

Executive summary:
1. If a font does not expose a WWS-compliant style name it is broken today (no funny names, no deviation even if it existed in the past even in some widely used proprietary fonts)
2. If an app can not use a font with a WWS-compliant style the app is broken (n,r,b,bi is not a reasonable asumption anymore)
3. It would be nice if fontconfig changed style names to be WWS-compliant, but it is a workaround at best and fontconfig is usually not the broken bit (it's either 1. or 2.)

PS The same fonts won't behave the same way in all apps because every app does not read the same font naming metadata. Fontconfig reads the most recent one (as defined in the OpenType spec). If the font author put correct info in older naming layers, but didn't put correct info in the recent fields (because he didn't have any modern app to test with), the font will work in old apps but not in modern apps (such as those that use modern fontconfig versions)