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
.
\setmainfont{...}[Extension=.otf]
Extension=.otf
triggers (or seems to trigger) loading by filenames and thus theBold= ...
etc must be changed accordingly (fortunately here adding an hyphen is the only needed step).Extension={.otf}
but getluaotfload | load : path lookup of "Vollkorn.otf" unsuccessful, falling back to file:
. Then I addedUprightFont={* Regular}
but getluaotfload | load : path lookup of "VollkornRegular.otf" unsuccessful, falling back to file:
. The filename on the system isVollkorn-Regular.otf
. Thus I finally triedUprightFont={* -Regular}
and it does work, but I had to add-
to the specs of all other variants.mac os
but must handle also alinux
situation.