148148from matplotlib .afm import AFM
149149from matplotlib .cbook import enumerate , iterable , Bunch , get_realpath_and_stat , \
150150 is_string_like
151- from matplotlib .ft2font import FT2Font , KERNING_UNFITTED
151+ from matplotlib .ft2font import FT2Font , KERNING_DEFAULT , LOAD_DEFAULT , LOAD_NO_HINTING
152152from matplotlib .font_manager import fontManager , FontProperties
153153from matplotlib ._mathtext_data import latex_to_bakoma , \
154154 latex_to_standard , tex2uni , type12uni , tex2type1 , uni2type1
@@ -237,6 +237,9 @@ def get_results(self):
237237 """Return a backend specific tuple of things to return to the
238238 backend after all processing is done."""
239239 raise NotImplementedError ()
240+
241+ def get_hinting_type (self ):
242+ return LOAD_NO_HINTING
240243
241244class MathtextBackendAgg (MathtextBackend ):
242245 def set_canvas_size (self , w , h ):
@@ -261,7 +264,10 @@ def get_results(self):
261264 self .height ,
262265 self .fonts_object .get_fonts (),
263266 self .fonts_object .get_used_characters ())
264-
267+
268+ def get_hinting_type (self ):
269+ return LOAD_DEFAULT
270+
265271class MathtextBackendPs (MathtextBackend ):
266272 def __init__ (self ):
267273 self .pswriter = StringIO ()
@@ -487,7 +493,9 @@ def _get_info (self, fontname, sym, fontsize, dpi, mark_as_used=True):
487493
488494 font = cached_font .font
489495 font .set_size (fontsize , dpi )
490- glyph = font .load_char (num )
496+ glyph = font .load_char (
497+ num ,
498+ flags = self .mathtext_backend .get_hinting_type ())
491499
492500 xmin , ymin , xmax , ymax = [val / 64.0 for val in glyph .bbox ]
493501 offset = self ._get_offset (cached_font , glyph , fontsize , dpi )
@@ -538,7 +546,7 @@ def get_kern(self, font1, sym1, fontsize1,
538546 info1 = self ._get_info (font1 , sym1 , fontsize1 , dpi )
539547 info2 = self ._get_info (font2 , sym2 , fontsize2 , dpi )
540548 font = info1 .font
541- return font .get_kerning (info1 .num , info2 .num , KERNING_UNFITTED ) / 64.0
549+ return font .get_kerning (info1 .num , info2 .num , KERNING_DEFAULT ) / 64.0
542550 return 0.0
543551
544552class BakomaFonts (TruetypeFonts ):
0 commit comments