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

Method _get_glyph

lib/matplotlib/_mathtext.py:726–740  ·  view source on GitHub ↗
(self, fontname: str, font_class: str,
                   sym: str)

Source from the content-addressed store, hash-verified

724 self.fontmap[name] = fullpath
725
726 def _get_glyph(self, fontname: str, font_class: str,
727 sym: str) -> tuple[FT2Font, CharacterCodeType, bool]:
728 # Override prime symbol to use Bakoma.
729 if sym == r'\prime':
730 return self.bakoma._get_glyph(fontname, font_class, sym)
731 else:
732 # check whether the glyph is available in the display font
733 uniindex = get_unicode_index(sym)
734 font = self._get_font('ex')
735 if font is not None:
736 glyphindex = font.get_char_index(uniindex)
737 if glyphindex != 0:
738 return super()._get_glyph('ex', font_class, sym)
739 # otherwise return regular glyph
740 return super()._get_glyph(fontname, font_class, sym)
741
742
743class DejaVuSerifFonts(DejaVuFonts):

Callers

nothing calls this directly

Calls 4

get_unicode_indexFunction · 0.85
get_char_indexMethod · 0.80
_get_glyphMethod · 0.45
_get_fontMethod · 0.45

Tested by

no test coverage detected