Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c6c3a45

Browse files
committed
Trigger font fallback for Agg backend
1 parent 88da97f commit c6c3a45

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/matplotlib/backends/backend_agg.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
from matplotlib.backend_bases import (
3636
_Backend, _check_savefig_extra_args, FigureCanvasBase, FigureManagerBase,
3737
RendererBase)
38-
from matplotlib.font_manager import findfont, get_font
38+
from matplotlib.font_manager import find_fontsprop, get_font
3939
from matplotlib.ft2font import (LOAD_FORCE_AUTOHINT, LOAD_NO_HINTING,
4040
LOAD_DEFAULT, LOAD_NO_AUTOHINT)
4141
from matplotlib.mathtext import MathTextParser
@@ -186,6 +186,7 @@ def draw_text(self, gc, x, y, s, prop, angle, ismath=False, mtext=None):
186186
# We pass '0' for angle here, since it will be rotated (in raster
187187
# space) in the following call to draw_text_image).
188188
font.set_text(s, 0, flags=flags)
189+
189190
font.draw_glyphs_to_bitmap(
190191
antialiased=mpl.rcParams['text.antialiased'])
191192
d = font.get_descent() / 64.0
@@ -251,7 +252,7 @@ def _get_agg_font(self, prop):
251252
"""
252253
Get the font for text instance t, caching for efficiency
253254
"""
254-
fname = findfont(prop)
255+
fname = find_fontsprop(prop)
255256
font = get_font(fname)
256257

257258
font.clear()

0 commit comments

Comments
 (0)