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

Function _to_fontspec

lib/matplotlib/backends/backend_pgf.py:41–49  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

39def _get_preamble():
40 """Prepare a LaTeX preamble based on the rcParams configuration."""
41 def _to_fontspec():
42 for command, family in [("setmainfont", "serif"),
43 ("setsansfont", "sans\\-serif"),
44 ("setmonofont", "monospace")]:
45 font_path = fm.findfont(family)
46 path = pathlib.Path(font_path)
47 yield r" \%s{%s}[Path=\detokenize{%s/}%s]" % (
48 command, path.name, path.parent.as_posix(),
49 f',FontIndex={font_path.face_index:d}' if path.suffix == '.ttc' else '')
50
51 font_size_pt = FontProperties(size=mpl.rcParams["font.size"]).get_size_in_points()
52 return "\n".join([

Callers 1

_get_preambleFunction · 0.85

Calls 1

findfontMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…