latex3 / fontspec

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

"Jost*" font (with asterisk in font name), error: '"JostJost*" cannot be found' #437

Open korakinos opened 3 years ago

korakinos commented 3 years ago

Description

Trying to compile a LaTeX document using the typeface "Jost*" (with an asterisk in the name) fails with:

tex: Invalid filename `JostJost*/OT:script=latn;language=dflt;', contains '*'

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

Discussion on the XeTeX mailing list arrived at the suggestion that this could be a bug in fontspec. (Probably not one in latex2e.) This bug report is mostly a summary of what has been discussed on the mailing list so far.

Check/indicate

Minimal example demonstrating the issue

\documentclass{article}
\usepackage{fontspec}
\setsansfont{Jost*}
\begin{document}
\LARGE
\sffamily this is an example \textit{italics}, \textbf{bold},
and \textbf{\textit{bold italics}}.

\end{document}

Further details

\documentclass{article}
\usepackage{fontspec}
\setsansfont{Jost-500-Medium.otf}[
 BoldFont = Jost-700-Bold.otf ,
 ItalicFont = Jost-500-MediumItalic.otf,
 BoldItalicFont = Jost-700-BoldItalic.otf]

\begin{document}
\LARGE
\sffamily this is an example \textit{italics}, \textbf{bold},
and \textbf{\textit{bold italics}}.

\end{document}

for fontname in sys.argv[1:]: font = fontforge.open(fontname) font.familyname = "Jost" font.generate(fontname+"-starless.otf")


After installing the newly created "starless" fonts and referring to them by "Jost" (without asterisk) from LaTeX, the test file is compiled correctly and without issue.
wspr commented 2 years ago

fontspec uses * as a way to abbreviate font names. I didn't think anyone would define a font name using it. I'll keep this open to consider adding a "NoStar" feature to disable that behaviour.

wspr commented 2 months ago

I've tried to fix this and unless I'm missing something obvious I think LaTeX itself is also struggling with the star in the name of the font. I won't close this yet but I don't think this is a simple one. For anyone reading, suggest loading the font by filename instead!