fontspec icon indicating copy to clipboard operation
fontspec copied to clipboard

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

Open korakinos opened this issue 4 years ago • 2 comments

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

  • [X] Relevant for XeTeX [ ? ] Relevant for LuaTeX
  • [X] Issue tracker has been searched for similar issues?
  • [ ] Links to <tex.stackexchange.com> discussion if appropriate

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

  • To get the fonts for testing: The free version of the Jost* fonts can be downloaded by selecting to pay zero dollars on the download page.

  • The fonts can be referred by file name without issue:

\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}
  • xetex (not xelatex) does not have this problem. There the Jost* typefacwe can accessed by family name, not only file name.

  • As a workaround, the asterisk can be deleted from the fonts' family name, e.g. using a short fontforge script:

import fontforge
import sys

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.

korakinos avatar Dec 23 '20 19:12 korakinos

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 avatar Jan 14 '22 16:01 wspr

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!

wspr avatar May 07 '24 13:05 wspr