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

Method from_luatex

lib/matplotlib/dviread.py:676–698  ·  view source on GitHub ↗
(cls, scale, texname)

Source from the content-addressed store, hash-verified

674
675 @classmethod
676 def from_luatex(cls, scale, texname):
677 path_b, sep, rest = texname[1:].rpartition(b"]")
678 if not (texname.startswith(b"[") and sep and rest[:1] in [b"", b":"]):
679 raise ValueError(f"Invalid modern font name: {texname}")
680 # utf8 on Windows, not utf16!
681 path = path_b.decode("utf8") if os.name == "nt" else os.fsdecode(path_b)
682 subfont = 0
683 effects = {}
684 if rest[1:]:
685 for kv in rest[1:].decode("ascii").split(";"):
686 key, val = kv.split("=", 1)
687 if key == "index":
688 subfont = val
689 elif key in ["embolden", "slant", "extend"]:
690 effects[key] = int(val) / 65536
691 else:
692 _log.warning("Ignoring invalid key-value pair: %r", kv)
693 metrics = TtfMetrics(path)
694 font = cls(scale, metrics, texname, vf=None)
695 font._path = Path(path)
696 font.subfont = subfont
697 font.effects = effects
698 return font
699
700 @classmethod
701 def from_xetex(cls, scale, texname, subfont, effects):

Callers 1

_fnt_def_realMethod · 0.80

Calls 2

TtfMetricsClass · 0.85
PathClass · 0.85

Tested by

no test coverage detected