@@ -319,6 +319,7 @@ class FontEntry:
319
319
"""
320
320
321
321
fname : str = ''
322
+ index : int = 0
322
323
name : str = ''
323
324
style : str = 'normal'
324
325
variant : str = 'normal'
@@ -465,7 +466,8 @@ def get_weight(): # From fontconfig's FcFreeTypeQueryFaceInternal.
465
466
raise NotImplementedError ("Non-scalable fonts are not supported" )
466
467
size = 'scalable'
467
468
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 )
469
471
470
472
471
473
def afmFontProperty (fontpath , font ):
@@ -535,7 +537,7 @@ def afmFontProperty(fontpath, font):
535
537
536
538
size = 'scalable'
537
539
538
- return FontEntry (fontpath , name , style , variant , weight , stretch , size )
540
+ return FontEntry (fontpath , 0 , name , style , variant , weight , stretch , size )
539
541
540
542
541
543
def _cleanup_fontproperties_init (init_method ):
@@ -1069,7 +1071,7 @@ class FontManager:
1069
1071
# Increment this version number whenever the font cache data
1070
1072
# format or behavior has changed and requires an existing font
1071
1073
# cache files to be rebuilt.
1072
- __version__ = '3.11.0a1 '
1074
+ __version__ = '3.11.0a2 '
1073
1075
1074
1076
def __init__ (self , size = None , weight = 'normal' ):
1075
1077
self ._version = self .__version__
@@ -1134,6 +1136,10 @@ def addfont(self, path):
1134
1136
font = ft2font .FT2Font (path )
1135
1137
prop = ttfFontProperty (font )
1136
1138
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 )
1137
1143
self ._findfont_cached .cache_clear ()
1138
1144
1139
1145
@property
0 commit comments