29
29
from ._mathtext_data import (
30
30
latex_to_bakoma , stix_glyph_fixes , stix_virtual_fonts , tex2uni )
31
31
from .font_manager import FontProperties , findfont , get_font
32
- from .ft2font import FT2Font , FT2Image , KERNING_DEFAULT
32
+ from .ft2font import FT2Font , FT2Image , Kerning , LoadFlags
33
33
34
34
from packaging .version import parse as parse_version
35
35
from pyparsing import __version__ as pyparsing_version
@@ -227,14 +227,14 @@ class Fonts(abc.ABC):
227
227
to do the actual drawing.
228
228
"""
229
229
230
- def __init__ (self , default_font_prop : FontProperties , load_glyph_flags : int ):
230
+ def __init__ (self , default_font_prop : FontProperties , load_glyph_flags : LoadFlags ):
231
231
"""
232
232
Parameters
233
233
----------
234
234
default_font_prop : `~.font_manager.FontProperties`
235
235
The default non-math font, or the base font for Unicode (generic)
236
236
font rendering.
237
- load_glyph_flags : int
237
+ load_glyph_flags : `.ft2font.LoadFlags`
238
238
Flags passed to the glyph loader (e.g. ``FT_Load_Glyph`` and
239
239
``FT_Load_Char`` for FreeType-based fonts).
240
240
"""
@@ -332,7 +332,7 @@ class TruetypeFonts(Fonts, metaclass=abc.ABCMeta):
332
332
(through FT2Font).
333
333
"""
334
334
335
- def __init__ (self , default_font_prop : FontProperties , load_glyph_flags : int ):
335
+ def __init__ (self , default_font_prop : FontProperties , load_glyph_flags : LoadFlags ):
336
336
super ().__init__ (default_font_prop , load_glyph_flags )
337
337
# Per-instance cache.
338
338
self ._get_info = functools .cache (self ._get_info ) # type: ignore[method-assign]
@@ -426,7 +426,7 @@ def get_kern(self, font1: str, fontclass1: str, sym1: str, fontsize1: float,
426
426
info1 = self ._get_info (font1 , fontclass1 , sym1 , fontsize1 , dpi )
427
427
info2 = self ._get_info (font2 , fontclass2 , sym2 , fontsize2 , dpi )
428
428
font = info1 .font
429
- return font .get_kerning (info1 .num , info2 .num , KERNING_DEFAULT ) / 64
429
+ return font .get_kerning (info1 .num , info2 .num , Kerning . DEFAULT ) / 64
430
430
return super ().get_kern (font1 , fontclass1 , sym1 , fontsize1 ,
431
431
font2 , fontclass2 , sym2 , fontsize2 , dpi )
432
432
@@ -448,7 +448,7 @@ class BakomaFonts(TruetypeFonts):
448
448
'ex' : 'cmex10' ,
449
449
}
450
450
451
- def __init__ (self , default_font_prop : FontProperties , load_glyph_flags : int ):
451
+ def __init__ (self , default_font_prop : FontProperties , load_glyph_flags : LoadFlags ):
452
452
self ._stix_fallback = StixFonts (default_font_prop , load_glyph_flags )
453
453
454
454
super ().__init__ (default_font_prop , load_glyph_flags )
@@ -557,7 +557,7 @@ class UnicodeFonts(TruetypeFonts):
557
557
0x2212 : 0x00A1 , # Minus sign.
558
558
}
559
559
560
- def __init__ (self , default_font_prop : FontProperties , load_glyph_flags : int ):
560
+ def __init__ (self , default_font_prop : FontProperties , load_glyph_flags : LoadFlags ):
561
561
# This must come first so the backend's owner is set correctly
562
562
fallback_rc = mpl .rcParams ['mathtext.fallback' ]
563
563
font_cls : type [TruetypeFonts ] | None = {
@@ -672,7 +672,7 @@ def get_sized_alternatives_for_symbol(self, fontname: str,
672
672
class DejaVuFonts (UnicodeFonts , metaclass = abc .ABCMeta ):
673
673
_fontmap : dict [str | int , str ] = {}
674
674
675
- def __init__ (self , default_font_prop : FontProperties , load_glyph_flags : int ):
675
+ def __init__ (self , default_font_prop : FontProperties , load_glyph_flags : LoadFlags ):
676
676
# This must come first so the backend's owner is set correctly
677
677
if isinstance (self , DejaVuSerifFonts ):
678
678
self ._fallback_font = StixFonts (default_font_prop , load_glyph_flags )
@@ -776,7 +776,7 @@ class StixFonts(UnicodeFonts):
776
776
_fallback_font = None
777
777
_sans = False
778
778
779
- def __init__ (self , default_font_prop : FontProperties , load_glyph_flags : int ):
779
+ def __init__ (self , default_font_prop : FontProperties , load_glyph_flags : LoadFlags ):
780
780
TruetypeFonts .__init__ (self , default_font_prop , load_glyph_flags )
781
781
for key , name in self ._fontmap .items ():
782
782
fullpath = findfont (name )
0 commit comments