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

breaking font selection with LuaLaTeX and fontspec #650

Closed
cabohah opened this issue Jul 2, 2024 · 6 comments
Closed

breaking font selection with LuaLaTeX and fontspec #650

cabohah opened this issue Jul 2, 2024 · 6 comments

Comments

@cabohah
Copy link

cabohah commented Jul 2, 2024

It seems, that polyglossia breaks fonts names with whitespaces when using LuaLaTeX and fontspec, e.g.:

\documentclass{report}
\usepackage{fontspec}
\usepackage{polyglossia}
\setmainfont[Ligatures=TeX]{TeX Gyre Termes}
\begin{document}
  \slshape
  This is a sentence.
\end{document}

results in:

luaotfload | db : Reload initiated (formats: otf,ttf,ttc); reason: Font "TeX" not found.
./test.tex:6: Font \TU/TeXGyreTermes(0)/m/it/10=name:TeX not loadable: metric data not found or bad.
<to be read again> 
G
l.6   \slshape

So it seems, that the font name is TeX.

A workaround would be to load polyglossia after \setmainfont or to use TeXGyreTermes (without spaces) as font name.

There error does not occur with XeLaTeX instead of LuaLaTeX.

See also https://tex.stackexchange.com/q/721772/277964.

I'm not absolutely sure, that this is a polyglossia issue, but because the error does not occur without polyglossia or when using babel instead of polyglossia, I report it here.

@cfr42
Copy link

cfr42 commented Jul 2, 2024

It's an issue with the Harfbuzz renderer rather than polyglossia. You can reproduce without polyglossia:

\documentclass{book}
\usepackage{fontspec}
\setmainfont[Ligatures=TeX,Renderer=Harfbuzz]{TeX Gyre Termes}

\begin{document}
\slshape 
This is a sentence.
\end{document}

@amunn
Copy link

amunn commented Jul 2, 2024

The problem is caused by the fact that polyglossia uses the HarfBuzz renderer by default. So I'm not sure this is a polyglossia problem. It's really a fontspec problem:

\documentclass{book}
\usepackage{fontspec}
\setmainfont[Ligatures=TeX,Renderer=HarfBuzz]{TeX Gyre Termes}

\begin{document}
This is a sentence.
\end{document}

@Udi-Fogiel
Copy link
Collaborator

You can change the default renderer with the luatexrenderer option of the package, FWIW.

@cfr42
Copy link

cfr42 commented Jul 2, 2024

It is not really class dependent, I don't think. The difference between article and book is probably in what they do at \begin{document}.

\documentclass{article}
\usepackage{fontspec}
\setmainfont[Ligatures=TeX,Renderer=Harfbuzz]{TeX Gyre Termes}

\begin{document}
\slshape 
This is a sentence.
\end{document}

also reproduces.

@cabohah
Copy link
Author

cabohah commented Jul 2, 2024

It's also class dependent, because this example works for me with article or report class.

Not if you add, e.g., \slshape into an example using article or report.

@Udi-Fogiel
Copy link
Collaborator

This is a bug in luaotfload, I've reported it in latex3/luaotfload#285.

I'm closing this ticket, but feel free to reopen it if you think my analyze is wrong.

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

4 participants