Skip to content

Commit 9dec376

Browse files
tacaswellmeeseeksmachine
authored andcommitted
Backport PR matplotlib#32101: Cairo: Switch back to character codes for mathtext
1 parent 46e6353 commit 9dec376

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)