When loading a font by name, what is the search mechanism being used? How is the matching done? (It's marked TODO in the documentation)
I have many problems, for example: a "Hoefler Text Engraved" font is replacing the default "Hoefler Text" with bold \fontspec{Hoefler Text} \textbf{...}
. Some of its metadata in fontforge:
PS Names
Family Name: Hoefler Text
Weight: Normal
TTF Names
Family: Hoefler Text Engraved
Styles (Subfamily): Regular
Preferred Family: Hoefler Text
Preferred Styles: Engraved
What does fontspec/fontconfig read in the file to match the requested font? (in this case "Hoefler Text/Bold"
Best Answer
The detail depends on both the engine in use (XeTeX or LuaTeX) and also the operating system in question. However, in general the answer is '
fontspec
does not actually do this'. More precisely,fontspec
relies on features of the engine to load fonts. XeTeX and LuaTeX use different approaches to font loading. XeTeX contains operating system-dependent code, which therefore uses features of the system (as Windows, Mac OS X and Linux have different approaches to font management). On the other hand, the LuaTeX approach is implemented in Lua, using feature of the LuaTeX engine.Coupled with these considerations, not all fonts are equal. Even if they have the same name, they may not be from the same supplier. Some fonts are regrettably 'faulty' in their internals, and this tends to show up when loading with
fontspec
.Thus if you have an issue loading a particular font, then it's not just a question of saying '
fontspec
can't find the font', but rather 'usingfontspec
with <engine> on <platform> cannot load font <name> from <supplier>'.