8000 Resolve linked fonts in fontManager.findfont() · matplotlib/matplotlib@adb8412 · GitHub
[go: up one dir, main page]

Skip to content

Commit adb8412

Browse files
committed
Resolve linked fonts in fontManager.findfont()
The commit ensures that the realpath of linked fonts is used across the library. This prevents embedding linked fonts twice and makes sure that linked fonts are referenced consistently in PDF files. The link resolution cannot happend in addfont() since this would break the *directory* argument of findfont().
1 parent 4a78af5 commit adb8412

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/matplotlib/font_manager.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1238,9 +1238,10 @@ def findfont(self, prop, fontext='ttf', directory=None,
12381238
rc_params = tuple(tuple(rcParams[key]) for key in [
12391239
"font.serif", "font.sans-serif", "font.cursive", "font.fantasy",
12401240
"font.monospace"])
1241-
return self._findfont_cached(
1241+
filename = self._findfont_cached(
12421242
prop, fontext, directory, fallback_to_default, rebuild_if_missing,
12431243
rc_params)
1244+
return os.path.realpath(filename)
12441245

12451246
@lru_cache()
12461247
def _findfont_cached(self, prop, fontext, directory, fallback_to_default,

0 commit comments

Comments
 (0)
0