# LuaLaTeX font loader picks Regular variant from system font repertory but Bold from texmf-local

I have on my system for some years TrueType versions of a an older release of a (free) font (Vollkorn) in my texmf-local.

I have now downloaded the more recent release, which has more variants, and made the OpenType files system wide available (to be more precise they are in my ~/Library/Fonts, on Mac OS X).

With xelatex, no problem with

\setmainfont{Vollkorn}[ItalicFont={* Italic},
BoldFont={* Bold}, BoldItalicFont={* Bold Italic}]

the new (OpenType) fonts are used. Full code:

\documentclass{article}

\usepackage{fontspec}
\setmainfont{Vollkorn}[%
%Numbers=Lining,
ItalicFont={* Italic},BoldFont={* Bold}, BoldItalicFont={* Bold Italic}]

\begin{document}

1234567890

\bfseries 1234567890

\itshape 1234567890

\mdseries 1234567890

\end{document}

But with lualatex, well initially I didn't know how to use luaotfload-tool (it appears mkluatexfontdb has disappeared ? no such link in texbin) but anyhow today's TL update had a luatex update, and compiling the document above under lualatex triggered a database rebuild :

luaotfload | db : Version mismatch; expected 2.600, got 2.510.

However my document uses the new OpenType only for the Regular variant:

f"

I went to explore a bit the relevant files, and in

I see:

return {
["Vollkorn##655360"]={ "Vollkorn-Regular.otf", false },
["Vollkorn:mode=node;script=latn;language=DFLT;+tlig;+trep;##655360"]={ "Vollkorn-Regular.otf", false },
["VollkornBold##655360"]={ "Vollkorn-Bold.ttf", false },
["VollkornBold:mode=node;script=latn;language=DFLT;+tlig;+trep;##655360"]={ "Vollkorn-Bold.ttf", false },
["VollkornBoldItalic##655360"]={ "Vollkorn-BoldItalic.ttf", false },
["VollkornBoldItalic:mode=node;script=latn;language=DFLT;+tlig;+trep;##655360"]={ "Vollkorn-BoldItalic.ttf", false },
["VollkornItalic##655360"]={ "Vollkorn-Italic.ttf", false },
["VollkornItalic:mode=node;script=latn;language=DFLT;+tlig;+trep;##655360"]={ "Vollkorn-Italic.ttf", false },
}

but in

I do find for example :

["base"]={
["local"]={},
["system"]={
lines skipped
["Vollkorn-Bold.otf"]=1287,
["Vollkorn-BoldItalic.otf"]=1288,
["Vollkorn-Italic.otf"]=1289,
["Vollkorn-Medium.otf"]=1290,
["Vollkorn-MediumItalic.otf"]=1291,
["Vollkorn-Regular.otf"]=1292,
["Vollkorn-Semibold.otf"]=1293,
["Vollkorn-SemiboldItalic.otf"]=1294,
lines skipped
["texmf"]={
["Vollkorn-Bold.ttf"]=973,
["Vollkorn-BoldItalic.ttf"]=974,
["Vollkorn-Italic.ttf"]=975,
["Vollkorn-Regular.ttf"]=976,

Thus all files seem to be correctly indexed and identified. Why then is only Vollkorn Regular picked as the new OpenType fonts, but for Bold, Italic and Bold Italic the document uses the old ttf files ?

</usr/local/texlive/2015/texmf-local/fonts/truetype/friedrichalthausen/vollkorn/
Vollkorn-Italic.ttf></usr/local/texlive/2015/texmf-local/fonts/truetype/friedric
halthausen/vollkorn/Vollkorn-BoldItalic.ttf></usr/local/texlive/2015/texmf-local
/fonts/truetype/friedrichalthausen/vollkorn/Vollkorn-Bold.ttf></Users/XXXXXXXX/Librar
y/Fonts/Vollkorn-Regular.otf>
Output written on testvollkorn.pdf (1 page, 26788 bytes).

A work around was given by Ulrike Fischer in her answer which I am accepting.

However, may naive user gut feeling is that something incoherent happens with the font loading by lualatex in this case. Thus, if a latter answer addresses or refutes my hunch, I will consider validating it instead.

I am adding some info after extra testing I did following comments by @phg. I exchanged the newer otf files from my $HOME/Library/Fonts/ (this is Mac OS) with the older ttf files in a sub repertory location in texmf-local. Did a texhash and luaotfload-tool --update. I henceforth observed the exact same phenomenon with \setmainfont{Vollkorn}[ItalicFont={* Italic}, BoldFont={* Bold}, BoldItalicFont={* Bold Italic}] as before: the upright font used in the document ends up being the one from$HOME/Library/Fonts/, the others are from texmf-local.

I briefly thought at that point that the explanation was that a font whose filename is Vollkorn-Regular.{otf,ttf} will be found by luaotfload only if in a system repertory if requested by \setmainfont under name Vollkorn. But this interpretation is plain wrong :

If I simply remove the otf font from the system repertory, do a luaotfload-tool --update and try again with :

\usepackage{fontspec}
\setmainfont{Vollkorn}[%
ItalicFont={* Italic},BoldFont={* Bold}, BoldItalicFont={* Bold Italic}]

then compilation succeeds and the log shows:

</usr/local/texlive/2015/texmf-local/fonts/truetype/friedrichalthausen/vollkorn/
Vollkorn-Italic.ttf></usr/local/texlive/2015/texmf-local/fonts/truetype/friedric
halthausen/vollkorn/Vollkorn-BoldItalic.ttf></usr/local/texlive/2015/texmf-local
/fonts/truetype/friedrichalthausen/vollkorn/Vollkorn-Bold.ttf></usr/local/texliv
e/2015/texmf-local/fonts/truetype/friedrichalthausen/vollkorn/Vollkorn-Regular.t
tf>
Output written on testluaotfload.pdf (1 page, 25202 bytes).

All files were found in texmf-local.

If I move back the otf file to its ~/Library/Fonts system user location, it will be used. The strange thing in such situation is that this happens only for the upright shape. For Bold, Italic, and Bold Italic, the texmf-local located files are preferred over the font files in ~/Library/Fonts.

• It is not a good idea to have more than one version of a font available (also with xelatex). To find a font by name fontspec and lualatex has to check various variants (and various extensions) and can easily find the wrong font. You can try to force the correct extension with \setmainfont{...}[Extension=.otf] – Ulrike Fischer Dec 14 '15 at 9:52
• As your suggestion solved my problem could you make it an answer ? but it raises an other issue which is that Extension=.otf triggers (or seems to trigger) loading by filenames and thus the Bold= ... etc must be changed accordingly (fortunately here adding an hyphen is the only needed step). – user4686 Dec 14 '15 at 10:10
• (this comment was before the previous one, but I needed to fix typos). I just tried Extension={.otf} but get luaotfload | load : path lookup of "Vollkorn.otf" unsuccessful, falling back to file:. Then I added UprightFont={* Regular} but get luaotfload | load : path lookup of "VollkornRegular.otf" unsuccessful, falling back to file:. The filename on the system is Vollkorn-Regular.otf. Thus I finally tried UprightFont={* -Regular} and it does work, but I had to add - to the specs of all other variants. – user4686 Dec 14 '15 at 10:14
• You could also just specify the path to your font to ensure that it loads the font you want. – Sverre Dec 14 '15 at 10:15
• @Sverre, I wish to compile on different locations where I have similar set-ups but absolute paths will differ. Particularly I can have as here a mac os but must handle also a linux situation. – user4686 Dec 14 '15 at 10:25