Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 770d59d

Browse filesBrowse files
authored
Merge pull request #15249 from anntzer/fallback_to_default
In findfont(fallback_to_default=False), throw if default font is missing
2 parents 56cfb43 + 8a543b5 commit 770d59d
Copy full SHA for 770d59d

File tree

Expand file treeCollapse file tree

1 file changed

+2
-5
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+2
-5
lines changed

‎lib/matplotlib/font_manager.py

Copy file name to clipboardExpand all lines: lib/matplotlib/font_manager.py
+2-5Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1284,11 +1284,8 @@ def _findfont_cached(self, prop, fontext, directory, fallback_to_default,
12841284
default_prop.set_family(self.defaultFamily[fontext])
12851285
return self.findfont(default_prop, fontext, directory, False)
12861286
else:
1287-
# This is a hard fail -- we can't find anything reasonable,
1288-
# so just return the DejaVuSans.ttf
1289-
_log.warning('findfont: Could not match %s. Returning %s.',
1290-
prop, self.defaultFont[fontext])
1291-
result = self.defaultFont[fontext]
1287+
raise ValueError(f"Failed to find font {prop}, and fallback "
1288+
f"to the default font was disabled")
12921289
else:
12931290
_log.debug('findfont: Matching %s to %s (%r) with score of %f.',
12941291
prop, best_font.name, best_font.fname, best_score)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.