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

Method __init__

lib/matplotlib/_mathtext.py:588–622  ·  view source on GitHub ↗
(self, default_font_prop: FontProperties, load_glyph_flags: LoadFlags)

Source from the content-addressed store, hash-verified

586 }
587
588 def __init__(self, default_font_prop: FontProperties, load_glyph_flags: LoadFlags):
589 # This must come first so the backend's owner is set correctly
590 fallback_rc = mpl.rcParams['mathtext.fallback']
591 font_cls: type[TruetypeFonts] | None = {
592 'stix': StixFonts,
593 'stixsans': StixSansFonts,
594 'cm': BakomaFonts
595 }.get(fallback_rc)
596 self._fallback_font = (font_cls(default_font_prop, load_glyph_flags)
597 if font_cls else None)
598
599 super().__init__(default_font_prop, load_glyph_flags)
600 for texfont in "cal rm tt it bf sf bfit".split():
601 prop = mpl.rcParams['mathtext.' + texfont] # type: ignore[index]
602 font = findfont(prop)
603 self.fontmap[texfont] = font
604 prop = FontProperties('cmex10')
605 font = findfont(prop)
606 self.fontmap['ex'] = font
607
608 # include STIX sized alternatives for glyphs if fallback is STIX
609 if isinstance(self._fallback_font, StixFonts):
610 stixsizedaltfonts = {
611 '0': 'STIXGeneral',
612 '1': 'STIXSizeOneSym',
613 '2': 'STIXSizeTwoSym',
614 '3': 'STIXSizeThreeSym',
615 '4': 'STIXSizeFourSym',
616 '5': 'STIXSizeFiveSym',
617 }
618
619 for size, name in stixsizedaltfonts.items():
620 fullpath = findfont(name)
621 self.fontmap[size] = fullpath
622 self.fontmap[name] = fullpath
623
624 _slanted_symbols = set(r"\int \oint".split())
625

Callers

nothing calls this directly

Calls 3

FontPropertiesClass · 0.85
getMethod · 0.45
__init__Method · 0.45

Tested by

no test coverage detected