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

Method _as_unicode_or_name

lib/matplotlib/dviread.py:128–140  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

126 if entry.encoding is not None else self.glyph)
127
128 def _as_unicode_or_name(self):
129 if self.font.subfont:
130 raise NotImplementedError("Indexing TTC fonts is not supported yet")
131 path = self.font.resolve_path()
132 if path.name.lower().endswith("pk"):
133 # PK fonts have no encoding information; report glyphs as ASCII but
134 # with a "?" to indicate that this is just a guess.
135 return (f"{chr(self.glyph)}?" if chr(self.glyph).isprintable() else
136 f"pk{self.glyph:#02x}")
137 face = font_manager.get_font(path)
138 glyph_name = face.get_glyph_name(self.index)
139 glyph_str = fontTools.agl.toUnicode(glyph_name)
140 return glyph_str or glyph_name
141
142
143# Opcode argument parsing

Callers 3

dviread.pyFile · 0.80
test_dvireadFunction · 0.80
test_dviread_pkFunction · 0.80

Calls 3

resolve_pathMethod · 0.80
get_fontMethod · 0.80
get_glyph_nameMethod · 0.80

Tested by 2

test_dvireadFunction · 0.64
test_dviread_pkFunction · 0.64