@@ -319,6 +319,7 @@ class FontEntry:
319319 """
320320
321321 fname : str = ''
322+ index : int = 0
322323 name : str = ''
323324 style : str = 'normal'
324325 variant : str = 'normal'
@@ -465,7 +466,8 @@ def get_weight(): # From fontconfig's FcFreeTypeQueryFaceInternal.
465466 raise NotImplementedError ("Non-scalable fonts are not supported" )
466467 size = 'scalable'
467468
468- return FontEntry (font .fname , name , style , variant , weight , stretch , size )
469+ return FontEntry (font .fname , font .face_index , name ,
470+ style , variant , weight , stretch , size )
469471
470472
471473def afmFontProperty (fontpath , font ):
@@ -535,7 +537,7 @@ def afmFontProperty(fontpath, font):
535537
536538 size = 'scalable'
537539
538- return FontEntry (fontpath , name , style , variant , weight , stretch , size )
540+ return FontEntry (fontpath , 0 , name , style , variant , weight , stretch , size )
539541
540542
541543def _cleanup_fontproperties_init (init_method ):
@@ -1069,7 +1071,7 @@ class FontManager:
10691071 # Increment this version number whenever the font cache data
10701072 # format or behavior has changed and requires an existing font
10711073 # cache files to be rebuilt.
1072- __version__ = '3.11.0a1 '
1074+ __version__ = '3.11.0a2 '
10731075
10741076 def __init__ (self , size = None , weight = 'normal' ):
10751077 self ._version = self .__version__
@@ -1134,6 +1136,10 @@ def addfont(self, path):
11341136 font = ft2font .FT2Font (path )
11351137 prop = ttfFontProperty (font )
11361138 self .ttflist .append (prop )
1139+ for face_index in range (1 , font .num_faces ):
1140+ subfont = ft2font .FT2Font (path , face_index = face_index )
1141+ prop = ttfFontProperty (subfont )
1142+ self .ttflist .append (prop )
11371143 self ._findfont_cached .cache_clear ()
11381144
11391145 @property
0 commit comments