File tree Expand file tree Collapse file tree 3 files changed +21
-3
lines changed Expand file tree Collapse file tree 3 files changed +21
-3
lines changed Original file line number Diff line number Diff line change
1
+ AFM.get_fullname() and get_familyname() no longer raise an
2
+ exception if the AFM file does not specify these optional
3
+ attributes, but returns a guess based on the required FontName
4
+ attribute.
5
+
1
6
Deprecated all mlab2 functions in mlab
2
7
3
8
matplotlib.image.imread now no longer always returns RGBA -- if
Original file line number Diff line number Diff line change
1
+ 2008-10-05 Fix problem with AFM files that don't specify the font's
2
+ full name or family name. - JKS
3
+
1
4
2008-09-11 Fix use of backticks in PS - MGD
2
5
3
6
2008-09-07 Changed full arrows slightly to avoid an xpdf rendering
Original file line number Diff line number Diff line change 34
34
John D. Hunter <jdhunter@ace.bsd.uchicago.edu>
35
35
"""
36
36
37
- import sys , os
37
+ import sys , os , re
38
38
from _mathtext_data import uni2type1
39
39
40
40
#Convert string the a python type
@@ -433,11 +433,21 @@ def get_fontname(self):
433
433
434
434
def get_fullname (self ):
435
435
"Return the font full name, eg, Times-Roman"
436
- return self ._header ['FullName' ]
436
+ name = self ._header .get ('FullName' )
437
+ if name is None : # use FontName as a substitute
438
+ name = self ._header ['FontName' ]
439
+ return name
437
440
438
441
def get_familyname (self ):
439
442
"Return the font family name, eg, Times"
440
- return self ._header ['FamilyName' ]
443
+ name = self ._header .get ('FamilyName' )
444
+ if name is not None :
445
+ return name
446
+
447
+ # FamilyName not specified so we'll make a guess
448
+ name = self .get_fullname ()
449
+ extras = r'(?i)([ -](regular|plain|italic|oblique|bold|semibold|light|ultralight|extra|condensed))+$'
450
+ return re .sub (extras , '' , name )
441
451
442
452
def get_weight (self ):
443
453
"Return the font weight, eg, 'Bold' or 'Roman'"
You can’t perform that action at this time.
0 commit comments