[XeTeX] How to favor OTF, TTF, TYPE1 when selecting font by family name and multiple versions are installed?

Sergio Callegari sergio.callegari at unibo.it
Tue Mar 24 18:26:47 CET 2020


Hi,

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.

Furthermore, if one follows instructions such as the one in the TeXLive 
guide, Sect 3.4.4, that is "Copy the texlive-fontconfig.conf file to 
/etc/fonts/conf.d/09-texlive.conf." 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.

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.

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).

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.

For instance, consider this little test case:

\documentclass{article}
\usepackage{fontspec}
\setmainfont{Libertinus Serif}
\begin{document}
test\emph{test}\textit{test}.
\end{document}

This always compiles fine with lualatex. However, with xelatex there are 
issues. If /both/ 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.

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"?

Thanks,

Sergio


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://tug.org/pipermail/xetex/attachments/20200324/b1b9a4d7/attachment.html>


More information about the XeTeX mailing list.