From 0f757d2714040c74630e03459f9e5400e75a39fb Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Fri, 25 Mar 2022 08:47:12 +0100 Subject: [PATCH] Small simplification to textpath. - verts of glyph_map entries are created with FT2Font.get_path() and are thus already arrays; no need to convert them again. - We can always extend verts and codes regardless of whether verts1 is empty (extend will just be a noop in that case); empty verts should be exceptional anyways. --- lib/matplotlib/textpath.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/matplotlib/textpath.py b/lib/matplotlib/textpath.py index 56c279dcc732..21f98b65c698 100644 --- a/lib/matplotlib/textpath.py +++ b/lib/matplotlib/textpath.py @@ -117,14 +117,10 @@ def get_text_path(self, prop, s, ismath=False): glyph_info, glyph_map, rects = self.get_glyphs_mathtext(prop, s) verts, codes = [], [] - for glyph_id, xposition, yposition, scale in glyph_info: verts1, codes1 = glyph_map[glyph_id] - if len(verts1): - verts1 = np.array(verts1) * scale + [xposition, yposition] - verts.extend(verts1) - codes.extend(codes1) - + verts.extend(verts1 * scale + [xposition, yposition]) + codes.extend(codes1) for verts1, codes1 in rects: verts.extend(verts1) codes.extend(codes1)