Skip to content
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

Skip over broken TTF font when creating cache #5233

Merged
merged 2 commits into from Oct 13, 2015

Conversation

mdboom
Copy link
Member

@mdboom mdboom commented Oct 12, 2015

Fixes #5232.

@@ -587,7 +587,7 @@ def createFontList(fontfiles, fontext='ttf'):
continue
try:
prop = ttfFontProperty(font)
except KeyError:
except KeyError, RuntimeError:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

python3 requires () on this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doh!

mdboom added a commit that referenced this pull request Oct 13, 2015
Skip over broken TTF font when creating cache
@mdboom mdboom merged commit cbb8f62 into matplotlib:master Oct 13, 2015
mdboom added a commit that referenced this pull request Oct 13, 2015
Skip over broken TTF font when creating cache
@tacaswell
Copy link
Member

back ported as 0cb18e0

@QuLogic QuLogic added this to the next point release (1.5.0) milestone Oct 13, 2015
@mdboom mdboom deleted the skip-over-broken-font branch November 10, 2015 02:46
@JGalvezTT
Copy link

I'm still getting the same error. When I try to

import matplotlib.font_manager

I get an error in the function

ttfFontProperty(Font)

on the line 396

@JGalvezTT
Copy link

I added ValueError at line 592. Seems to work now.

except KeyError, RuntimeError:

@tacaswell
Copy link
Member

@JGalvezTT What version of mpl are you using?

@JGalvezTT
Copy link

@tacaswell, I'm using 1.5.1 on Anaconda. I got it to work by adding ValueError as an exception on the line 592. But now I'm getting error in other libraries (Opencv). So it might be that something is wrong on my set up.

@dov
Copy link

dov commented Jul 7, 2016

I also got this error on fedora 24, matplotlib version 1.5.2rc2. The bad font was "Truetypewriter PolyglOTT" font available from: http://www.fontsaddict.com/font/truetypewriter-polyglott.html . The error trace was:

/usr/lib64/python2.7/site-packages/matplotlib/font_manager.py:273: UserWarning: Matplotlib is building the font cache using fc-list. This may take a moment.
  warnings.warn('Matplotlib is building the font cache using fc-list. This may take a moment.')
Traceback (most recent call last):
  File "<stdin>", line 20, in <module>
  File "/usr/lib64/python2.7/site-packages/matplotlib/pyplot.py", line 29, in <module>
    import matplotlib.colorbar
  File "/usr/lib64/python2.7/site-packages/matplotlib/colorbar.py", line 34, in <module>
    import matplotlib.collections as collections
  File "/usr/lib64/python2.7/site-packages/matplotlib/collections.py", line 27, in <module>
    import matplotlib.backend_bases as backend_bases
  File "/usr/lib64/python2.7/site-packages/matplotlib/backend_bases.py", line 62, in <module>
    import matplotlib.textpath as textpath
  File "/usr/lib64/python2.7/site-packages/matplotlib/textpath.py", line 15, in <module>
    import matplotlib.font_manager as font_manager
  File "/usr/lib64/python2.7/site-packages/matplotlib/font_manager.py", line 1421, in <module>
    _rebuild()
  File "/usr/lib64/python2.7/site-packages/matplotlib/font_manager.py", line 1406, in _rebuild
    fontManager = FontManager()
  File "/usr/lib64/python2.7/site-packages/matplotlib/font_manager.py", line 1059, in __init__
    self.ttflist = createFontList(self.ttffiles)
  File "/usr/lib64/python2.7/site-packages/matplotlib/font_manager.py", line 590, in createFontList
    prop = ttfFontProperty(font)
  File "/usr/lib64/python2.7/site-packages/matplotlib/font_manager.py", line 396, in ttfFontProperty
    sfnt = font.get_sfnt()
ValueError: No SFNT name table

@tacaswell
Copy link
Member

@dov can you make a new issue? This fell through the cracks for 1.5.x 😞

@dov
Copy link

dov commented Jul 7, 2016

Ok. I did. See: #6702 . Unfortunately I seem to have erased the font that caused the crash. :-(

tacaswell added a commit to tacaswell/matplotlib that referenced this pull request Jul 9, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants