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

Skip to content

Commit fe2b338

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 a linked fonts twice and makes sure that linked fonts are referenced consistently in PDFs files. The link resolution cannot happend in addfont() since this would break the *directory* argument of findfont().
1 parent 4a78af5 commit fe2b338

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
< 6436 td data-grid-cell-id="diff-aca801331b4c856bff720af0575b9ad63f402c893abd7d939e5547ba961ee324-1241-1240-0" data-selected="false" role="gridcell" style="background-color:var(--diffBlob-deletionNum-bgColor, var(--diffBlob-deletion-bgColor-num));text-align:center" tabindex="-1" valign="top" class="focusable-grid-cell diff-line-number position-relative left-side">1241
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"])
-
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