Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7443388

Browse files
committed
Canonicalize weights extracted for AFM fonts.
1 parent 0fec7f1 commit 7443388

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/matplotlib/font_manager.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,8 @@ def afmFontProperty(fontpath, font):
422422
variant = 'normal'
423423

424424
weight = font.get_weight().lower()
425+
if weight not in weight_dict:
426+
weight = 'normal'
425427

426428
# Stretch can be absolute and relative
427429
# Absolute stretches are: ultra-condensed, extra-condensed, condensed,
@@ -935,7 +937,7 @@ class FontManager(object):
935937
# Increment this version number whenever the font cache data
936938
# format or behavior has changed and requires a existing font
937939
# cache files to be rebuilt.
938-
__version__ = 300
940+
__version__ = 310
939941

940942
def __init__(self, size=None, weight='normal'):
941943
self._version = self.__version__

0 commit comments

Comments
 (0)