latex3 / fontspec

Font selection in LaTeX for XeTeX and LuaTeX
http://latex3.github.io/fontspec/
LaTeX Project Public License v1.3c
275 stars 33 forks source link

With Renderer=HarfBuzz, \fontname output has no quotes #525

Open jfbu opened 1 month ago

jfbu commented 1 month ago

Description

With Renderer=HarfBuzz, \fontname output has no quotes.

Check/indicate

Minimal example demonstrating the issue

\documentclass{article}

\usepackage{fontspec}

\begin{document}

\fontspec{TeX Gyre Termes}

\small

\edef\foo{\fontname\font}

\fontspec[Renderer=HarfBuzz]{TeX Gyre Termes}

\edef\bar{\fontname\font}

\ttfamily

\foo

\bar

\end{document}
% Local variables:
% TeX-engine: luatex
% End:

Capture d’écran 2024-07-19 à 18 51 26

Further details

I am using \small because without it, the second line in output ends with at 10pt and I wanted to exclude that it may have to do with missing quotes.

For background I hit againts this while updating a mathastext work-around to also take care of Renderer=HarfBuzz. Due to missing quotes, an error arose later when using the transmogrified output of \fontname.

edit: mathastext 1.4 soon to get released works around this at macro level.

It may be that this has nothing to do with fontspec and does not belong here.

However for non-expert the world of LuaLaTeX font is simply too complex to try to disentangle what belongs to fontspec, what belongs to luaotfload and what belongs to LuaTeX proper or perhaps again something else.

jfbu commented 1 month ago

EDIT. Only after posting I made the link with a problem I had encountered some time ago where I was forced to use TeXGyreTermes and not TeX Gyre Termes.

here is the MWE.

\documentclass{book}% no (immediate) problem with article class
\usepackage{fontspec}
\defaultfontfeatures{Renderer=HarfBuzz}
%\usepackage{luaotfload}% does not solve the problem anything
\setmainfont{TeX Gyre Termes}[% no issue with TeXGyreTermes
    Numbers={OldStyle},%
]
\begin{document}
0123456789
\end{document}
% Local variables:
% TeX-engine: luatex
% End:

One gets:

$ lualatex other_fontspec_fontname
This is LuaHBTeX, Version 1.18.0 (TeX Live 2024) 
 restricted system commands enabled.
(./other_fontspec_fontname.tex
LaTeX2e <2024-06-01> patch level 2
L3 programming layer <2024-05-27>
 (/usr/local/texlive/2024/texmf-dist/tex/latex/base/book.cls
Document Class: book 2024/02/08 v1.4n Standard LaTeX document class
(/usr/local/texlive/2024/texmf-dist/tex/latex/base/bk10.clo))
(/usr/local/texlive/2024/texmf-dist/tex/latex/fontspec/fontspec.sty
(/usr/local/texlive/2024/texmf-dist/tex/latex/l3packages/xparse/xparse.sty
(/usr/local/texlive/2024/texmf-dist/tex/latex/l3kernel/expl3.sty
(/usr/local/texlive/2024/texmf-dist/tex/latex/l3backend/l3backend-luatex.def)))
 (/usr/local/texlive/2024/texmf-dist/tex/latex/fontspec/fontspec-luatex.sty
(/usr/local/texlive/2024/texmf-dist/tex/latex/base/fontenc.sty)
(/usr/local/texlive/2024/texmf-dist/tex/latex/fontspec/fontspec.cfg)))
No file other_fontspec_fontname.aux.
(/usr/local/texlive/2024/texmf-dist/tex/latex/base/ts1cmr.fd)

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

? X
 700 words of node memory still in use:
   5 hlist, 1 vlist, 2 rule, 1 local_par, 6 dir, 8 glue, 3 kern, 2 penalty, 11 
glyph, 9 attribute, 63 glue_spec, 9 attribute_list, 6 temp, 3 if_stack, 1 write
 nodes
   avail lists: 1:1,2:9,3:2,4:1,6:1,7:14,9:1

warning  (pdf backend): no pages of output.
Transcript written on other_fontspec_fontname.log.

I am attaching the full log. other_fontspec_fontname.log

khaledhosny commented 1 month ago

See https://github.com/latex3/luaotfload/issues/285

jfbu commented 1 month ago

@khaledhosny ouch, I should have minimally checked. Does look like a duplicate indeed.