[XeTeX] AMS/CM fonts in OpenType/CFF format

Marcel Fabian Krüger tex at 2krueger.de
Wed Nov 17 12:04:56 CET 2021

On Wed, Nov 17, 2021 at 10:29:09AM +0000, Philip Taylor (Hellenic Institute) wrote:
> Many thanks for your comments, Marcel, but I am still somewhat confused. 
> The XeTeX manual says :
> > This distinction between file name lookups and system font name lookups
> > is crucial
> > to understanding XƎTEX’s behavior and to writing portable documents (in
> > short: don’t
> > use system fonts).
> >     System font name lookups use (except on Mac OS X) the fontconfig
> > library; running
> > fc-list should show you the font names available. E.g.,
> > 
> >         \font\1="Liberation Serif" /look for OS-installed font/
> which suggested to me that it was the string quotes that were forcing XeTeX
> to look for an OS-installed (i.e., system) font. And when I try :

Looking at the code again I realized that the quotes actually *do* make
a difference: If the name is quoted XeTeX will first look for a system
font and use a TFM font only if no system font is found, if the name is
not quoted it will forst look for a TFM font.

If you want a IMO clearer syntax, you can use LuaTeX with luaotfload.
There we still emulate the XeTeX like syntax, but additionally allow you
explicitly state how the font should be looked up, e.g.

\font \cmr {name:cmr10} \cmr % Untested, LuaTeX with luaotfload only.
                             % Quotes would work too.
                             % So would omitting both in this case.

> > \font \cmr = "cmr10:"
> > 
> > \cmr
> > 
> > The quick brown fox jumps right over the laxy dog's back.
> > 
> > \end
> > 
> I am told :
> > This is XeTeX, Version 3.141592653-2.6-0.999993 (TeX Live 2021/W32TeX)
> > (preloaded format=xetex)
> > 
> > restricted \write18 enabled.
> > 
> > entering extended mode
> > 
> > (./untitled-5.tex
> > 
> > ! Font \cmr=cmr10: not loadable: Metric (TFM) file or installed font not
> > found.
> > 
> > <to be read again>
> > 
> > \cmr
> > 
> > l.4 \cmr
> > 
> > ?
> > 
> As reported earlier, Tom's "cmr10.otf" /is/ installed, but your suggested
> syntax appears not to find it.  And it is not found with "\font \cmr =
> "CMR10 Regular:", but /is/ found with \font \cmr = "CMR10:".  Curiouser and
> curiouser !

If you use name based lookup, you have to specify the actual font name.
According to otfinfo this is for cmr10.otf:

% otfinfo -i cmr10.otf
Family:              CMR10
Subfamily:           Regular
Full name:           CMR10
PostScript name:     CMR10
Version:             Version 1.000;hotconv 1.1.0;makeotfexe 2.6.0
Unique ID:           1.000;UKWN;CMR10
Vendor ID:           UKWN

As you can see, neither of the names is "CMR10 Regular" and also not
"cmr10". In luaotfload the lookup is case insensitive, but XeTeX uses
system libraries which will often be case sensitive.

> Oh, and \font \cmr = "CMR9:" fails, so at least I have a way of forcing a
> system font to be used, even if I have to upper-case the name.  But I am
> still very concerned that \font \cmr = "CMR10.xyz:" finds the font and
> reports no error.

Well, if the same happens in luaotfload please write a bug report. If
you want someone to tell you that XeTeX's font lookup rules are nice,
consistent or intuitive you are talking with the wrong person...


More information about the XeTeX mailing list.