diff --git a/doc/api/next_api_changes/2018-01-07-AL.rst b/doc/api/next_api_changes/2018-01-07-AL.rst new file mode 100644 index 000000000000..5de677905af0 --- /dev/null +++ b/doc/api/next_api_changes/2018-01-07-AL.rst @@ -0,0 +1,5 @@ +Deprecations +```````````` + +``TextToPath.glyph_to_path`` is deprecated (call ``font.get_path()`` and +manually transform the path instead). diff --git a/lib/matplotlib/textpath.py b/lib/matplotlib/textpath.py index 91b5079f06a1..df4b520e7846 100644 --- a/lib/matplotlib/textpath.py +++ b/lib/matplotlib/textpath.py @@ -67,6 +67,9 @@ def _get_char_id_ps(self, font, ccode): char_id = urllib.parse.quote('%s-%d' % (ps_name, ccode)) return char_id + @cbook.deprecated( + "3.1", + alternative="font.get_path() and manual translation of the vertices") def glyph_to_path(self, font, currx=0.): """ convert the ft2font glyph to vertices and codes. @@ -215,7 +218,7 @@ def get_glyphs_with_font(self, font, s, glyph_map=None, char_id = self._get_char_id(font, ccode) if char_id not in glyph_map: - glyph_map_new[char_id] = self.glyph_to_path(font) + glyph_map_new[char_id] = font.get_path() currx += kern / 64 @@ -266,7 +269,7 @@ def get_glyphs_mathtext(self, prop, s, glyph_map=None, font.clear() font.set_size(self.FONT_SCALE, self.DPI) glyph = font.load_char(ccode, flags=LOAD_NO_HINTING) - glyph_map_new[char_id] = self.glyph_to_path(font) + glyph_map_new[char_id] = font.get_path() xpositions.append(ox) ypositions.append(oy) @@ -343,7 +346,7 @@ def get_glyphs_tex(self, prop, s, glyph_map=None, glyph0 = font.load_char(glyph, flags=ft2font_flag) - glyph_map_new[char_id] = self.glyph_to_path(font) + glyph_map_new[char_id] = font.get_path() glyph_ids.append(char_id) xpositions.append(x1)