latex3 / fontspec

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

Font montserrat not found although installed and found by luaotfload-tool #459

Closed maxnoe closed 9 months ago

maxnoe commented 2 years ago

Description

A sentence or two describing the issue.

Check/indicate

Minimal example demonstrating the issue

I cannot reproduce this locally, but CI builds fail using github actions using this minimal document:

\documentclass{article}

\usepackage{fontspec}
\setsansfont{Montserrat}

\begin{document}
\textsf{Hello World}
\end{document}

Further details

Build log of the CI job here: https://github.com/maxnoe/fontspec-montserrat/runs/6083185139?check_suite_focus=true

Especially interesting:

fontconfig sees the font:

$ fc-list Montserrat
/home/runner/.local/share/fonts/static/Montserrat-SemiBold.ttf: Montserrat,Montserrat SemiBold:style=SemiBold,Regular
/home/runner/.local/share/fonts/static/Montserrat-BoldItalic.ttf: Montserrat:style=Bold Italic
/home/runner/.local/share/fonts/static/Montserrat-Medium.ttf: Montserrat,Montserrat Medium:style=Medium,Regular
/home/runner/.local/share/fonts/static/Montserrat-BlackItalic.ttf: Montserrat,Montserrat Black:style=Black Italic,Italic
/home/runner/.local/share/fonts/Montserrat-VariableFont_wght.ttf: Montserrat,Montserrat Thin:style=Light
/home/runner/.local/share/fonts/static/Montserrat-Light.ttf: Montserrat,Montserrat Light:style=Light,Regular
/home/runner/.local/share/fonts/Montserrat-VariableFont_wght.ttf: Montserrat,Montserrat Thin:style=Medium
/home/runner/.local/share/fonts/Montserrat-VariableFont_wght.ttf: Montserrat,Montserrat Thin:style=SemiBold
/home/runner/.local/share/fonts/static/Montserrat-MediumItalic.ttf: Montserrat,Montserrat Medium:style=Medium Italic,Italic
/home/runner/.local/share/fonts/static/Montserrat-Black.ttf: Montserrat,Montserrat Black:style=Black,Regular
/home/runner/.local/share/fonts/Montserrat-VariableFont_wght.ttf: Montserrat,Montserrat Thin:style=ExtraLight
/home/runner/.local/share/fonts/Montserrat-Italic-VariableFont_wght.ttf: Montserrat,Montserrat Thin:style=Bold Italic
/home/runner/.local/share/fonts/static/Montserrat-Bold.ttf: Montserrat:style=Bold
/home/runner/.local/share/fonts/Montserrat-VariableFont_wght.ttf: Montserrat,Montserrat Thin:style=Regular
/home/runner/.local/share/fonts/Montserrat-Italic-VariableFont_wght.ttf: Montserrat,Montserrat Thin:style=SemiBold Italic
/home/runner/.local/share/fonts/Montserrat-Italic-VariableFont_wght.ttf: Montserrat,Montserrat Thin:style=Italic
/home/runner/.local/share/fonts/static/Montserrat-Italic.ttf: Montserrat:style=Italic
/home/runner/.local/share/fonts/Montserrat-VariableFont_wght.ttf: Montserrat,Montserrat Thin:style=Bold
/home/runner/.local/share/fonts/Montserrat-VariableFont_wght.ttf: Montserrat,Montserrat Thin:style=Thin,Regular
/home/runner/.local/share/fonts/Montserrat-VariableFont_wght.ttf: Montserrat,Montserrat Thin
/home/runner/.local/share/fonts/static/Montserrat-Thin.ttf: Montserrat,Montserrat Thin:style=Thin,Regular
/home/runner/.local/share/fonts/Montserrat-VariableFont_wght.ttf: Montserrat,Montserrat Thin:style=Black
/home/runner/.local/share/fonts/static/Montserrat-ExtraBold.ttf: Montserrat,Montserrat ExtraBold:style=ExtraBold,Regular
/home/runner/.local/share/fonts/static/Montserrat-ThinItalic.ttf: Montserrat,Montserrat Thin:style=Thin Italic,Italic
/home/runner/.local/share/fonts/Montserrat-Italic-VariableFont_wght.ttf: Montserrat,Montserrat Thin
/home/runner/.local/share/fonts/static/Montserrat-LightItalic.ttf: Montserrat,Montserrat Light:style=Light Italic,Italic
/home/runner/.local/share/fonts/static/Montserrat-ExtraBoldItalic.ttf: Montserrat,Montserrat ExtraBold:style=ExtraBold Italic,Italic
/home/runner/.local/share/fonts/static/Montserrat-Regular.ttf: Montserrat:style=Regular
/home/runner/.local/share/fonts/Montserrat-Italic-VariableFont_wght.ttf: Montserrat,Montserrat Thin:style=Black Italic
/home/runner/.local/share/fonts/static/Montserrat-ExtraLightItalic.ttf: Montserrat,Montserrat ExtraLight:style=ExtraLight Italic,Italic
/home/runner/.local/share/fonts/Montserrat-Italic-VariableFont_wght.ttf: Montserrat,Montserrat Thin:style=Thin Italic,Italic
/home/runner/.local/share/fonts/Montserrat-Italic-VariableFont_wght.ttf: Montserrat,Montserrat Thin:style=Light Italic
/home/runner/.local/share/fonts/Montserrat-VariableFont_wght.ttf: Montserrat,Montserrat Thin:style=ExtraBold
/home/runner/.local/share/fonts/Montserrat-Italic-VariableFont_wght.ttf: Montserrat,Montserrat Thin:style=ExtraLight Italic
/home/runner/.local/share/fonts/Montserrat-Italic-VariableFont_wght.ttf: Montserrat,Montserrat Thin:style=Medium Italic
/home/runner/.local/share/fonts/Montserrat-Italic-VariableFont_wght.ttf: Montserrat,Montserrat Thin:style=ExtraBold Italic
/home/runner/.local/share/fonts/static/Montserrat-ExtraLight.ttf: Montserrat,Montserrat ExtraLight:style=ExtraLight,Regular
/home/runner/.local/share/fonts/static/Montserrat-SemiBoldItalic.ttf: Montserrat,Montserrat SemiBold:style=SemiBold Italic,Italic

Luaotfload-tool sees the font:

$ luaotfload --find='Montserrat'
luaotfload | resolve : Font "Montserrat" found!
luaotfload | resolve : Resolved file name "/home/runner/.local/share/fonts/static/Montserrat-Regular.ttf"

otfinfo produces the correct name:

$ otfinfo -a /home/runner/.local/share/fonts/static/Montserrat-Regular.ttf
Montserrat

But then, running the compilation fails:

/home/runner/.local/texlive/2022/bin/x86_64-linux/lualatex
This is LuaHBTeX, Version 1.15.0 (TeX Live 2022) 
 restricted system commands enabled.
(./test.tex
LaTeX2e <2021-11-15> patch level 1
 L3 programming layer <2022-04-10>
(/home/runner/.local/texlive/2022/texmf-dist/tex/latex/base/article.cls
Document Class: article 2021/10/04 v1.4n Standard LaTeX document class
(/home/runner/.local/texlive/2022/texmf-dist/tex/latex/base/size10.clo))
(/home/runner/.local/texlive/2022/texmf-dist/tex/latex/fontspec/fontspec.sty
(/home/runner/.local/texlive/2022/texmf-dist/tex/latex/l3packages/xparse/xparse
.sty (/home/runner/.local/texlive/2022/texmf-dist/tex/latex/l3kernel/expl3.sty
(/home/runner/.local/texlive/2022/texmf-dist/tex/latex/l3backend/l3backend-luat
ex.def)))
(/home/runner/.local/texlive/2022/texmf-dist/tex/latex/fontspec/fontspec-luatex
.sty (/home/runner/.local/texlive/2022/texmf-dist/tex/latex/base/fontenc.sty)
(/home/runner/.local/texlive/2022/texmf-dist/tex/latex/fontspec/fontspec.cfg)))

! Package fontspec Error: The font "Montserrat" cannot be found.

For immediate help type H <return>.
 ...                                              

l.7 

? 
! Emergency stop.
 ...                                              

l.7 

 375 words of node memory still in use:
   2 hlist, 1 rule, 1 dir, 3 kern, 1 glyph, 3 attribute, 48 glue_spec, 3 attrib
ute_list, 1 write nodes
   avail lists: 2:13,3:2,4:1,5:2,7:2,9:3
!  ==> Fatal error occurred, no output PDF file produced!
Transcript written on test.log.

Any help would be greatly appreciated.

This used to work, at least until a couple of weeks ago (using TeX Live 2021, it now fails with both TeX Live 2021 and 2022).

u-fischer commented 2 years ago

To quote Marcel (https://tex.stackexchange.com/a/645963/2388)

The font loading in LuaTeX basically either succeeds or it fails, it doesn't communicate why it failed. Since a not found font is by far the most common cause for being unable to load a font that's what the error message sais, but actually it just indicates that "something" went wrong.

So probably there is some error with the font but you are using an unusual set, the montserrat on ctan contains otf and not ttf files. So it it quite difficult to say more.

khaledhosny commented 9 months ago

Since fontspec does not load the fonts itself, this does not sound like a fontspec issue. It might be that luaotfload is confused because you have both static and variable versions of the font installed while they have the same family name, or may be something else, bit definitely not a fontspec issue.