Skip to content

Commit 8103dae

Browse files
authored
Merge pull request matplotlib#32102 from meeseeksmachine/auto-backport-of-pr-32101-on-v3.11.x
Backport PR matplotlib#32101 on branch v3.11.x (Cairo: Switch back to character codes for mathtext)
2 parents 46e6353 + 9dec376 commit 8103dae

1 file changed

Lines changed: 3 additions & 7 deletions

File tree

lib/matplotlib/backends/backend_cairo.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
import functools
1010
import gzip
11-
import itertools
1211
import math
1312

1413
import numpy as np
@@ -249,15 +248,12 @@ def _draw_mathtext(self, gc, x, y, s, prop, angle):
249248
if angle:
250249
ctx.rotate(np.deg2rad(-angle))
251250

252-
for (font, fontsize), font_glyphs in itertools.groupby(
253-
glyphs, key=lambda info: (info[0], info[1])):
251+
for font, fontsize, ccode, _glyph_index, ox, oy in glyphs:
254252
ctx.new_path()
253+
ctx.move_to(ox, -oy)
255254
ctx.select_font_face(*_cairo_font_args_from_font_prop(ttfFontProperty(font)))
256255
ctx.set_font_size(self.points_to_pixels(fontsize))
257-
ctx.show_glyphs([
258-
(glyph_index, ox, -oy)
259-
for _font, _size, _ccode, glyph_index, ox, oy in font_glyphs
260-
])
256+
ctx.show_text(chr(ccode))
261257

262258
for ox, oy, w, h in rects:
263259
ctx.new_path()

0 commit comments

Comments
 (0)