@@ -71,27 +71,27 @@ def parse(self, s, dpi=72, prop=None, *, antialiased=None):
71
71
Depending on the *output* type, this returns either a `VectorParse` or
72
72
a `RasterParse`.
73
73
"""
74
- # lru_cache can't decorate parse() directly because prop
75
- # is mutable; key the cache using an internal copy (see
76
- # text._get_text_metrics_with_cache for a similar case).
74
+ # lru_cache can't decorate parse() directly because prop is
75
+ # mutable, so we key the cache using an internal copy (see
76
+ # Text._get_text_metrics_with_cache for a similar case); likewise,
77
+ # we need to check the mutable state of the text.antialiased and
78
+ # text.hinting rcParams.
77
79
prop = prop .copy () if prop is not None else None
78
80
antialiased = mpl ._val_or_rc (antialiased , 'text.antialiased' )
79
- return self ._parse_cached (s , dpi , prop , antialiased )
80
-
81
- @functools .lru_cache (50 )
82
- def _parse_cached (self , s , dpi , prop , antialiased ):
83
81
from matplotlib .backends import backend_agg
82
+ load_glyph_flags = {
83
+ "vector" : LOAD_NO_HINTING ,
84
+ "raster" : backend_agg .get_hinting_flag (),
85
+ }[self ._output_type ]
86
+ return self ._parse_cached (s , dpi , prop , antialiased , load_glyph_flags )
84
87
88
+ @functools .lru_cache (50 )
89
+ def _parse_cached (self , s , dpi , prop , antialiased , load_glyph_flags ):
85
90
if prop is None :
86
91
prop = FontProperties ()
87
92
fontset_class = _api .check_getitem (
88
93
self ._font_type_mapping , fontset = prop .get_math_fontfamily ())
89
- load_glyph_flags = {
90
- "vector" : LOAD_NO_HINTING ,
91
- "raster" : backend_agg .get_hinting_flag (),
92
- }[self ._output_type ]
93
94
fontset = fontset_class (prop , load_glyph_flags )
94
-
95
95
fontsize = prop .get_size_in_points ()
96
96
97
97
if self ._parser is None : # Cache the parser globally.
0 commit comments