Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot resolve font by name in xelatex #643

Open
callegar opened this issue Oct 31, 2024 · 1 comment
Open

Cannot resolve font by name in xelatex #643

callegar opened this issue Oct 31, 2024 · 1 comment

Comments

@callegar
Copy link

Description

In unicode engines it should be possible to resolve fonts both by name (e.g. "TeX Gyre Termes") or by filename (e.g. "latinmodern-math.otf).

Unfortunately, this is broken for math fonts when using unicode-math in combination with xelatex.

In the template for providing a minimal test case you say "filename only please", but selection by "preferred family name" should work too, and works just fine with LuaLaTeX.

Add info or delete as appropriate:

  • Relevant for XeTeX
  • Issue tracker has been searched for similar issues? Yes

Minimal example demonstrating the issue

\documentclass{article}
\usepackage{fontspec}
\usepackage{unicode-math}
\setmainfont{TeX Gyre Termes}
\setmathfont{TeX Gyre Termes Math}
\begin{document}
$x$
\end{document}

In this case, when it comes to resolve TeX Gyre Termes Math, fontspec/unicode-math happily get something else (most likely TeX Gyre Termes), complaints that the font does not have the Math Script, and goes on typesetting math using Latin Modern Math.

However, on my system resolving TeX Gyre Termes Math is fine:

fc-match "TeX Gyre Termes Math"
texgyretermes-math.otf: "TeX Gyre Termes Math" "Regular"

The main issue here is not that the font is not found. It is that fontspec/unicode-math believe that they have found a font, yet getting the wrong one.

Unclear to me if the issue is with fontspec or unicode-math or xetex itself, though.

Further details

@hvoss49
Copy link

hvoss49 commented Oct 31, 2024

XeTeX finds fonts by symbolic name only for system fonts and not the one from the TeX distribution. You can set a link from the system fonts to the TeX fonts, e.g. for macOS in ~/Library/Fonts

ln -s /usr/local/texlive/2024/texmf-dist/fonts/opentype/ ~/Library/Fonts/tl-opentype

with updating the font catalog with fc-cache -v -f it will find the font by symbolic name.
LuaTeX is different, because it handles the font search by an own font list for system and TeX fonts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants