[XeTeX] Why do I get small caps/random font?

Jonathan Kew jonathan_kew at sil.org
Mon Jun 5 20:51:00 CEST 2006

On 5 Jun 2006, at 5:11 pm, Ralf Stubner wrote:

> Jonathan Kew <jonathan_kew at sil.org> writes:
>> The problem is that "Latin Modern Roman" is a family name shared by
>> dozens of LM fonts. If you don't specify anything more precise, xetex
>> is supposed to try and use "the regular face" from that family. But
>> it has a hard time identifying which of all the "Latin Modern Roman"
>> fonts is the one you really want. And things are further confused by
>> the fact that OpenType fonts may have multiple family and style  
>> names.
> Is this a font issue (the font should provide more/better information
> about itself), a fontconfig issue (fontconfig does not get all  
> relevant
> information out of the font or does not pass this information on to
> xetex) or a xetex issue (xetex should make better use of the  
> information
> provided)?

All of the above! :)

Actually, in the case of xetex, it's not really fontconfig's fault,  
as I don't use fontconfig for that level of matching; xetex relies on  
fontconfig only to get a list of all fonts with a given family name,  
and then does its own management of the faces available within the  

Why? Two reasons: first, to help ensure the behavior is similar on  
all systems, including those that don't use fontconfig at all; and  
second, because fontconfig's searching/matching behavior isn't really  
suited to xetex anyway. It basically offers two kinds of behavior,  
exemplified by the fc-match and fc-list utilities. "Match" is not  
useful for xetex, because it always tries to return something, even  
if the requested font isn't found. And "list" may return a whole  
collection of fonts, so xetex would still have to try and figure out  
which one to use.

So the problems in xetex are not a fontconfig issue...

> I am asking because I have seen this sort of random behaviour
> from fontconfig in conjunction with Latin Modern fonts in Type 1  
> format
> as well as with other families with many fonts in them (see
> <URL:http://bugs.debian.org/354537>). Already using 'fc-match' on the
> commandline gives sometimes very strange results.

...but it's interesting (and in a sense, reassuring!) to know that  
fontconfig suffers similar confusion!

I think some reorganization of the family could help, especially if  
this can include moving things like Small Caps into a font feature  
rather than a separate face, but of course the LM project has roots  
in the legacy (La)TeX way of doing things, where separate fonts are  
used (and the whole issue of managing the family is pushed into the  
LaTeX support package). I think the LM team will be open to  
considering such things, but need to think it all through carefully  
before I'll be ready to make concrete suggestions to them.

>> If an OpenType 'size' (optical size) feature gets added to LM, that
>> will help somewhat, as then xetex will be able to choose among the
>> different design sizes. And in that case, perhaps the size can be
>> removed from the OpenType style names. Merging the small caps into
>> the normal font (and accessing the small caps as an OpenType feature)
>> would also help.
> Both features are desireable indeed. Would it be possible to use  
> them at
> the same time?

Yes, indeed. Families like Brioso Pro demonstrate this beautifully.

> While LM comes in many design sizes, there are only 10pt
> small caps.

Ah ... that's a problem. I hadn't looked at the set in that much  
detail yet.

> Would activation of the smcp feature automatically switch to
> this design size? Or would one have to add the 10pt small caps to all
> design sizes?

The latter. The reason is that optical sizing takes precedence.  
Although it relies on an OpenType feature tag to hold the key  
information in each face, optical sizing is really at a very  
different level from typical OT layout features such as small caps.  
Normal layout features involve glyph substitutions and positioning  
adjustments, all within the repertoire of a single "physical" font.  
The optical size feature, however, involves choosing among a  
collection of distinct fonts (e.g., the Caption, Text, Subhead, Title  
and Display faces). Each of these is a completely separate OpenType  
font, and contains its own independently-defined set of layout features.

So xetex uses the 'opsz' feature to choose a face from a rich family,  
regardless of what other features each face supports; and glyph-level  
features such as 'smcp' can only be specified and used in the context  
of a specific face. (It would normally make sense for all the faces  
in an optically-sized family to support the same layout features, of  
course, but nothing in the architecture *requires* this.)


More information about the XeTeX mailing list