| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1345,9 +1345,12 @@ def findfont(self, prop, fontext='ttf', directory=None, | |||
| 1345 | 1345 | rc_params = tuple(tuple(mpl.rcParams[key]) for key in [ | |
| 1346 | 1346 | "font.serif", "font.sans-serif", "font.cursive", "font.fantasy", | |
| 1347 | 1347 | "font.monospace"]) | |
| 1348 | - return self._findfont_cached( | ||
| 1348 | + ret = self._findfont_cached( | ||
| 1349 | 1349 | prop, fontext, directory, fallback_to_default, rebuild_if_missing, | |
| 1350 | 1350 | rc_params) | |
| 1351 | + if isinstance(ret, Exception): | ||
| 1352 | + raise ret | ||
| 1353 | + return ret | ||
| 1351 | 1354 | ||
| 1352 | 1355 | def get_font_names(self): | |
| 1353 | 1356 | """Return the list of available fonts.""" | |
@@ -1496,8 +1499,9 @@ def _findfont_cached(self, prop, fontext, directory, fallback_to_default, | |||
| 1496 | 1499 | return self.findfont(default_prop, fontext, directory, | |
| 1497 | 1500 | fallback_to_default=False) | |
| 1498 | 1501 | else: | |
| 1499 | - raise ValueError(f"Failed to find font {prop}, and fallback " | ||
| 1500 | - f"to the default font was disabled") | ||
| 1502 | + # yes return, exceptions are not cached | ||
| 1503 | + return ValueError(f"Failed to find font {prop}, and fallback " | ||
| 1504 | + f"to the default font was disabled") | ||
| 1501 | 1505 | else: | |
| 1502 | 1506 | _log.debug('findfont: Matching %s to %s (%r) with score of %f.', | |
| 1503 | 1507 | prop, best_font.name, best_font.fname, best_score) | |
@@ -1516,7 +1520,8 @@ def _findfont_cached(self, prop, fontext, directory, fallback_to_default, | |||
| 1516 | 1520 | return self.findfont( | |
| 1517 | 1521 | prop, fontext, directory, rebuild_if_missing=False) | |
| 1518 | 1522 | else: | |
| 1519 | - raise ValueError("No valid font could be found") | ||
| 1523 | + # yes return, exceptions are not cached | ||
| 1524 | + return ValueError("No valid font could be found") | ||
| 1520 | 1525 | ||
| 1521 | 1526 | return _cached_realpath(result) | |
| 1522 | 1527 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments