Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit de38ef2

Browse files
authored
Merge pull request #13119 from anntzer/glyph_to_path_currx
Deprecate TextToPath.glyph_to_path.
2 parents e673374 + 2c8b2c7 commit de38ef2

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Deprecations
2+
````````````
3+
4+
``TextToPath.glyph_to_path`` is deprecated (call ``font.get_path()`` and
5+
manually transform the path instead).

lib/matplotlib/textpath.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ def _get_char_id_ps(self, font, ccode):
6767
char_id = urllib.parse.quote('%s-%d' % (ps_name, ccode))
6868
return char_id
6969

70+
@cbook.deprecated(
71+
"3.1",
72+
alternative="font.get_path() and manual translation of the vertices")
7073
def glyph_to_path(self, font, currx=0.):
7174
"""
7275
convert the ft2font glyph to vertices and codes.
@@ -215,7 +218,7 @@ def get_glyphs_with_font(self, font, s, glyph_map=None,
215218

216219
char_id = self._get_char_id(font, ccode)
217220
if char_id not in glyph_map:
218-
glyph_map_new[char_id] = self.glyph_to_path(font)
221+
glyph_map_new[char_id] = font.get_path()
219222

220223
currx += kern / 64
221224

@@ -266,7 +269,7 @@ def get_glyphs_mathtext(self, prop, s, glyph_map=None,
266269
font.clear()
267270
font.set_size(self.FONT_SCALE, self.DPI)
268271
glyph = font.load_char(ccode, flags=LOAD_NO_HINTING)
269-
glyph_map_new[char_id] = self.glyph_to_path(font)
272+
glyph_map_new[char_id] = font.get_path()
270273

271274
xpositions.append(ox)
272275
ypositions.append(oy)
@@ -343,7 +346,7 @@ def get_glyphs_tex(self, prop, s, glyph_map=None,
343346

344347
glyph0 = font.load_char(glyph, flags=ft2font_flag)
345348

346-
glyph_map_new[char_id] = self.glyph_to_path(font)
349+
glyph_map_new[char_id] = font.get_path()
347350

348351
glyph_ids.append(char_id)
349352
xpositions.append(x1)

0 commit comments

Comments
 (0)