<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<p>Hi,</p>
<p>It may happen to have multiple versions of the same font
installed. This is because tex distributions often carry around an
OTF/TTF version of a font for xetex/luatex and a type1 version for
the older engines.</p>
<p>Furthermore, if one follows instructions such as the one in the
TeXLive guide, Sect 3.4.4, that is "Copy the <span class="ec-lmtt-10">texlive-fontconfig.conf </span>file to <span class="ec-lmtt-10">/etc/fonts/conf.d/09-texlive.conf</span>." to
make all the fonts from the tex distribution known to the system,
then multiple versions of the same font, with different font
formats start being advertised as system fonts.</p>
<p>When asked to select a font by symbolic name, xetex and luatex
generally work well. However, in case there is both a system wide
type1 and OTF or TTF version of the same font, it would seem
appropriate to have a way to tell the engine which version to
favor, without having to change the font selection paradigm down
to a "by filename" selection.</p>
<p>In general terms, it is nice to be able to select a font by
properties, such as the "family name" without having to go low
level with filenames that may make documents less portable (it is
not the first time that I exchange a document with someone missing
a font system wide, resorting to installing it locally in ~/.fonts
and getting a different filename even if the font is the right
one). Yet, if one cannot specify the font type along with the
family name, in case a font exists in two versions, one may end up
with the engine picking the poorer option (e.g. TYPE1 may be older
or not have all the features of the OTF counterpart).</p>
<p>Furthermore, xetex seems to currently deal particularly bad (at
least on linux) with the case where multiple versions of the same
font (with different types) are advertised to the system.</p>
<p>For instance, consider this little test case:</p>
<pre><span class="pl-k">\documentclass</span>{<span class="pl-c1">article</span>}
<span class="pl-k">\usepackage</span>{<span class="pl-c1">fontspec</span>}
<span class="pl-c1">\setmainfont</span>{Libertinus Serif}
<span class="pl-c1">\begin</span>{<span class="pl-smi">document</span>}
test <span class="pl-c1">\emph</span>{<span class="pl-mi">test</span>} <span class="pl-c1">\textit</span>{<span class="pl-mi">test</span>}.
<span class="pl-c1">\end</span>{<span class="pl-smi">document</span>}
</pre>
<p>This always compiles fine with lualatex. However, with xelatex
there are issues. If <i>both</i> the OTF and TYPE1 versions of
the Libertinus Serif font are advertised to fontconfig, xetex
starts picking wrong fonts. On my system, (Ubungu 19.10 with
pristine TeXLive 2019 updated via tlmgr until the 2020 freezing
started), the second and third "test" get typeset in bolditalic,
rather than italic. Similarly, semibold would be used in place of
bolditalic if required.</p>
<p>Hence, I wonder, is there a way to tell xetex something like
"always favor OTF if multiple versions of the same font are
returned by fontconfig"?<br>
</p>
<p>Thanks,</p>
<p>Sergio<br>
</p>
<p><br>
</p>
<pre>
</pre>
</body>
</html>