MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / get_glyphs_with_font

Method get_glyphs_with_font

lib/matplotlib/textpath.py:134–165  ·  view source on GitHub ↗

Convert string *s* to vertices and codes using the provided ttf font.

(self, font, s, glyph_map=None,
                             return_new_glyphs_only=False, *, features=None,
                             language=None)

Source from the content-addressed store, hash-verified

132 return verts, codes
133
134 def get_glyphs_with_font(self, font, s, glyph_map=None,
135 return_new_glyphs_only=False, *, features=None,
136 language=None):
137 """
138 Convert string *s* to vertices and codes using the provided ttf font.
139 """
140
141 if glyph_map is None:
142 glyph_map = OrderedDict()
143
144 if return_new_glyphs_only:
145 glyph_map_new = OrderedDict()
146 else:
147 glyph_map_new = glyph_map
148
149 xpositions = []
150 ypositions = []
151 glyph_reprs = []
152 for item in _text_helpers.layout(s, font, features=features, language=language):
153 glyph_repr = self._get_glyph_repr(item.ft_object, item.glyph_index)
154 glyph_reprs.append(glyph_repr)
155 xpositions.append(item.x)
156 ypositions.append(item.y)
157 if glyph_repr not in glyph_map:
158 glyph_map_new[glyph_repr] = item.ft_object.get_path()
159
160 sizes = [1.] * len(xpositions)
161
162 rects = []
163
164 return (list(zip(glyph_reprs, xpositions, ypositions, sizes)),
165 glyph_map_new, rects)
166
167 def get_glyphs_mathtext(self, prop, s, glyph_map=None,
168 return_new_glyphs_only=False):

Callers 2

get_text_pathMethod · 0.95
_draw_text_as_pathMethod · 0.80

Calls 2

_get_glyph_reprMethod · 0.95
get_pathMethod · 0.45

Tested by

no test coverage detected