1

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 : Font names database loaded from /usr/local/texlive/2015/texmf-
var/luatex-cache/generic/names/luaotfload-names.luc
luaotfload | db : Version mismatch; expected 2.600, got 2.510.
luaotfload | db : Force rebuild.(load luc: /usr/lo

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

luaotfload | load : Lookup/name: "Vollkorn" -> "Vollkorn-Regular.otf"

luaotfload | load : Lookup/name: "VollkornBold" -> "Vollkorn-Bold.ttf"
luaotfload | load : Lookup/name: "VollkornBoldItalic" -> "Vollkorn-BoldItalic.tt
f"
luaotfload | load : Lookup/name: "VollkornItalic" -> "Vollkorn-Italic.ttf"

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

file /usr/local/texlive/2015/texmf-var/luatex-cache/generic/names/luaotfload-lookup-cache.lua

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

/usr/local/texlive/2015/texmf-var/luatex-cache/generic/names/luaotfload-names.lua.gz

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).
Transcript written on testluaotfload.log.

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.

16
  • 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] Dec 14, 2015 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, 2015 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, 2015 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, 2015 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, 2015 at 10:25

1 Answer 1

2

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 the search has to be "fuzzy" and so can easily find the wrong font.

You can try to force the correct extension with \setmainfont{...}[Extension=.otf] and by using file names instead of font names.

4
  • For people interested in the case at hand this meant using \setmainfont{Vollkorn}[UprightFont={* -Regular}, ItalicFont={* -Italic}, BoldFont={* -Bold}, BoldItalicFont={* -BoldItalic}, Extension={.otf}].
    – user4686
    Dec 14, 2015 at 10:27
  • I do suspect nevertheless some incoherency in the lualatex font loading. If a latter answer addresses this issue I might have to move the tick ...
    – user4686
    Dec 14, 2015 at 10:28
  • @jfbu: It is not possible to check if there is a but in fontspec and/or luaotfload without the actual fonts. Beside this: fonts use various methods to name the existing font shapes and if fontspec/luaotfload where to picky some fonts would fail. So one has sometimes to live with side effects. I e.g. had the curious problem that a tex file was used as font: github.com/wspr/fontspec/issues/220. Dec 14, 2015 at 13:24
  • For the record if people owning a mac pass by and are adventurous enough to check, link for what I believe are the fonts I installed in texmf-local some years back, in particular as truetype, and link to the newer release, from which I extracted the opentype ones. I am not sure the actual font variant matters, but steps to reproduce are to put the v2.1 truetype fonts in texmf-local with the suitable texhash, and the v3 opentype fonts in ~/Library/fonts.
    – user4686
    Dec 14, 2015 at 14:43

You must log in to answer this question.