2929from ._mathtext_data import (
3030 latex_to_bakoma , stix_glyph_fixes , stix_virtual_fonts , tex2uni )
3131from .font_manager import FontProperties , findfont , get_font
32- from .ft2font import FT2Font , FT2Image , KERNING_DEFAULT
32+ from .ft2font import FT2Font , FT2Image , Kerning , LoadFlags
3333
3434from packaging .version import parse as parse_version
3535from pyparsing import __version__ as pyparsing_version
@@ -227,14 +227,14 @@ class Fonts(abc.ABC):
227227 to do the actual drawing.
228228 """
229229
230- def __init__ (self , default_font_prop : FontProperties , load_glyph_flags : int ):
230+ def __init__ (self , default_font_prop : FontProperties , load_glyph_flags : LoadFlags ):
231231 """
232232 Parameters
233233 ----------
234234 default_font_prop : `~.font_manager.FontProperties`
235235 The default non-math font, or the base font for Unicode (generic)
236236 font rendering.
237- load_glyph_flags : int
237+ load_glyph_flags : `.ft2font.LoadFlags`
238238 Flags passed to the glyph loader (e.g. ``FT_Load_Glyph`` and
239239 ``FT_Load_Char`` for FreeType-based fonts).
240240 """
@@ -332,7 +332,7 @@ class TruetypeFonts(Fonts, metaclass=abc.ABCMeta):
332332 (through FT2Font).
333333 """
334334
335- def __init__ (self , default_font_prop : FontProperties , load_glyph_flags : int ):
335+ def __init__ (self , default_font_prop : FontProperties , load_glyph_flags : LoadFlags ):
336336 super ().__init__ (default_font_prop , load_glyph_flags )
337337 # Per-instance cache.
338338 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,
426426 info1 = self ._get_info (font1 , fontclass1 , sym1 , fontsize1 , dpi )
427427 info2 = self ._get_info (font2 , fontclass2 , sym2 , fontsize2 , dpi )
428428 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
430430 return super ().get_kern (font1 , fontclass1 , sym1 , fontsize1 ,
431431 font2 , fontclass2 , sym2 , fontsize2 , dpi )
432432
@@ -448,7 +448,7 @@ class BakomaFonts(TruetypeFonts):
448448 'ex' : 'cmex10' ,
449449 }
450450
451- def __init__ (self , default_font_prop : FontProperties , load_glyph_flags : int ):
451+ def __init__ (self , default_font_prop : FontProperties , load_glyph_flags : LoadFlags ):
452452 self ._stix_fallback = StixFonts (default_font_prop , load_glyph_flags )
453453
454454 super ().__init__ (default_font_prop , load_glyph_flags )
@@ -557,7 +557,7 @@ class UnicodeFonts(TruetypeFonts):
557557 0x2212 : 0x00A1 , # Minus sign.
558558 }
559559
560- def __init__ (self , default_font_prop : FontProperties , load_glyph_flags : int ):
560+ def __init__ (self , default_font_prop : FontProperties , load_glyph_flags : LoadFlags ):
561561 # This must come first so the backend's owner is set correctly
562562 fallback_rc = mpl .rcParams ['mathtext.fallback' ]
563563 font_cls : type [TruetypeFonts ] | None = {
@@ -672,7 +672,7 @@ def get_sized_alternatives_for_symbol(self, fontname: str,
672672class DejaVuFonts (UnicodeFonts , metaclass = abc .ABCMeta ):
673673 _fontmap : dict [str | int , str ] = {}
674674
675- def __init__ (self , default_font_prop : FontProperties , load_glyph_flags : int ):
675+ def __init__ (self , default_font_prop : FontProperties , load_glyph_flags : LoadFlags ):
676676 # This must come first so the backend's owner is set correctly
677677 if isinstance (self , DejaVuSerifFonts ):
678678 self ._fallback_font = StixFonts (default_font_prop , load_glyph_flags )
@@ -776,7 +776,7 @@ class StixFonts(UnicodeFonts):
776776 _fallback_font = None
777777 _sans = False
778778
779- def __init__ (self , default_font_prop : FontProperties , load_glyph_flags : int ):
779+ def __init__ (self , default_font_prop : FontProperties , load_glyph_flags : LoadFlags ):
780780 TruetypeFonts .__init__ (self , default_font_prop , load_glyph_flags )
781781 for key , name in self ._fontmap .items ():
782782 fullpath = findfont (name )
0 commit comments