-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
PGF backend (LaTeX) on macOS: font-not-found #10307
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
Comments
Sorry, can't reproduce; only difference is that I'm using python 3. |
I'd guess xetex does not use fontconfig on osx but osx's own font management subsystem; does |
The |
fc-list is reporting fonts in a nonstandard location (from OSX's point of view, which normally puts fonts in /Library/Fonts etc), so it'd still be worth checking whether system_profiler SPFontsDataType is finding them. Likewise, does \setmainfont{...} work in a standalone tex example (independently of mpl)? |
I can't find Vera Sans in the output of When I use \documentclass[12pt]{article}
\usepackage{lipsum}
\usepackage{fontspec}
\setmainfont{Bitstream Vera Serif}%font_not_found
%\setmainfont{Times New Roman}%works
\begin{document}
\section*{My Paper}
\lipsum
\end{document} This behavior is expected.
fixes the issues for both, XeLaTex and matplotlib. But at least on macOS, the default rc list settings do not run out of the box. |
I see that backend_pgf (line 45) unconditionally uses fc-list to get the list of available fonts on OSX (on Linux too, but that's correct there). This bug report shows that this is incorrect and should be fixed to use e.g. system_profiler; but that is pretty slow so the fix will probably involve playing with the font cache. Alternatively we could just let xelatex do the check, per https://tex.stackexchange.com/questions/53443/how-to-check-if-a-font-exists-in-xelatex (or other googlable things). Labeling as medium difficulty as both solutions are fairly self-contained, though touching rather unused parts of the code and possibly involving some tex coding. On a side note, there's the question of why backend_pgf defaults to xelatex and usetex to latex... (that's going to be more fun to uniformize...) |
The underlying issue is here:
Maybe this is related: Interestingly, matplotlib/lib/matplotlib/font_manager.py Line 333 in d7f69fe
|
Can you try whether
works for you? (actually we probably want to sanitize the font name to remove raw braces if someone is really wicked, but whatever) |
I applied the patch to the master 86083dd. I get the following traceback:
However, if I convert |
Get rid of the
and
and try again? (we should already be controlling the interactionmode from Python anyways) |
By the way, I guess this issue also raises the following question: should matplotlib try to find non-system-installed fonts? The OP has some fonts in /opt/X11/share/... which is nonstandard for OSX and apparently not recognized by OSX's |
With the latest master:
git diff:
|
"DejaVu Serif" is not installed at all. |
Should be closed by #10339 (see #10339 (comment)). Feel free to reopen if I missed something. |
With default parameters the script fails to write the pgf file to disk. Running the script triggers an exception (see code block and message below). Setting
pgf.rcfonts
toFalse
fixes the issue for me, but the parameter is set toTrue
by default.Maybe related: #2097
Code for reproduction
Terminal output
fc-list
Matplotlib version
print(matplotlib.get_backend())
): MacOSXThe text was updated successfully, but these errors were encountered: