Skip to content

Deprecate TextToPath.glyph_to_path. #13119

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions doc/api/next_api_changes/2018-01-07-AL.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Deprecations
````````````
``TextToPath.glyph_to_path`` is deprecated (call ``font.get_path()`` and
manually transform the path instead).
9 changes: 6 additions & 3 deletions lib/matplotlib/textpath.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down