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
Mixing Arial with mathtext on Windows 8 fails #1710
Conversation
Sample code to reproduce: #!/usr/bin/env python import numpy as np t = np.arange(0.01, 1.0, 0.1) fp = fm.FontProperties(family='Arial') #plt.title('Arial font without mathtext',fontproperties=fp) plt.show() Traceback is as follows: Exception in Tkinter callback |
@dhyams Can you reproduce this on version 1.2? |
Yes, the stack trace above is from 1.2. |
The configuration of the computer tested on:
All installs were fresh from the download, as well. |
Thanks @dhyams. I'm not able to reproduce this on my mac. |
Right; this is a Windows 8 only bug...on Windows 7 it works just fine. |
…synthesize them.
Can you try the attached patch and verify it works on Window 8? It will require a recompile of C++ code. I was able to confirm it resolves the issue when using the |
Mixing Arial with mathtext on Windows 8 fails
When a font doesn't have a glyph name, we should synthesize. This fixes the Arial font problems under Windows 8.
Along with quite a few other fonts as well, but I've not been able to identify exactly which ones; but Arial is the easiest one to test. Trying to use the Arial font with some mathtext in the string that you are trying to show leads to a lengthy stack trace (when I get the chance I'll regenerate it and post it).
Reference:
http://matplotlib.1069221.n5.nabble.com/mathtext-and-fonts-under-Windows-8-td40172.html
A related fix from some other software:
http://code.google.com/p/sumatrapdf/issues/detail?id=2056
http://code.google.com/p/sumatrapdf/source/diff?spec=svn6770&r=6770&format=side&path=/trunk/mupdf/pdf/pdf_font.c
According to a poster in that thread,
"It seems that at least some of the fonts in Windows 8 no longer contain a glyph names table. MuPDF has under some circumstances relied too much on such a table being present. I've adjusted the logic so that it no longer does. The next (pre)release version (2.2.6770 or later) should thus be able to display PDF documents without embedded fonts under Windows 8 as intended. Thanks again for all your help for debugging this issue."