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

Function generate_fontconfig_pattern

lib/matplotlib/_fontconfig_pattern.py:103–111  ·  view source on GitHub ↗

Convert a `.FontProperties` to a fontconfig pattern string.

(d)

Source from the content-addressed store, hash-verified

101
102
103def generate_fontconfig_pattern(d):
104 """Convert a `.FontProperties` to a fontconfig pattern string."""
105 kvs = [(k, getattr(d, f"get_{k}")())
106 for k in ["style", "variant", "weight", "stretch", "file", "size"]]
107 # Families is given first without a leading keyword. Other entries (which
108 # are necessarily scalar) are given as key=value, skipping Nones.
109 return (",".join(_family_escape(f) for f in d.get_family())
110 + "".join(f":{k}={_value_escape(str(v))}"
111 for k, v in kvs if v is not None))

Callers 1

Calls 2

joinMethod · 0.80
get_familyMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…