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

Method glyph_name_or_index

lib/matplotlib/dviread.py:96–126  ·  view source on GitHub ↗

The glyph name, the native charmap glyph index, or the raw glyph index. If the font is a TrueType file (which can currently only happen for DVI files generated by xetex or luatex), then this number is the raw index of the glyph, which can be passed to FT_Load_Glyph/

(self)

Source from the content-addressed store, hash-verified

94
95 @property # To be deprecated together with font_path, font_size, font_effects.
96 def glyph_name_or_index(self):
97 """
98 The glyph name, the native charmap glyph index, or the raw glyph index.
99
100 If the font is a TrueType file (which can currently only happen for
101 DVI files generated by xetex or luatex), then this number is the raw
102 index of the glyph, which can be passed to FT_Load_Glyph/load_glyph.
103
104 Otherwise, the font is a PostScript font. For such fonts, if
105 :file:`pdftex.map` specifies an encoding for this glyph's font,
106 that is a mapping of glyph indices to Adobe glyph names; which
107 is used by this property to convert dvi numbers to glyph names.
108 Callers can then convert glyph names to glyph indices (with
109 FT_Get_Name_Index/get_name_index), and load the glyph using
110 FT_Load_Glyph/load_glyph.
111
112 If :file:`pdftex.map` specifies no encoding for a PostScript font,
113 this number is an index to the font's "native" charmap; glyphs should
114 directly load using FT_Load_Char/load_char after selecting the native
115 charmap.
116 """
117 # The last section is only true on luatex since luaotfload 3.23; this
118 # must be checked by the code generated by texmanager. (luaotfload's
119 # docs states "No one should rely on the mapping between DVI character
120 # codes and font glyphs [prior to v3.15] unless they tightly
121 # control all involved versions and are deeply familiar with the
122 # implementation", but a further mapping bug was fixed in luaotfload
123 # commit 8f2dca4, first included in v3.23).
124 entry = PsfontsMap(find_tex_file("pdftex.map"))[self.font.texname]
125 return (_parse_enc(entry.encoding)[self.glyph]
126 if entry.encoding is not None else self.glyph)
127
128 def _as_unicode_or_name(self):
129 if self.font.subfont:

Callers

nothing calls this directly

Calls 3

PsfontsMapClass · 0.85
find_tex_fileFunction · 0.85
_parse_encFunction · 0.85

Tested by

no test coverage detected