| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
I do not think we can change the mapping between string as integer weights as we take both as input. I am mostly 👎 on no longer picking up fonts that we used to pick up (even if the weights are a bit off). #7931 is likely related, but does not fully fix this problem? |
Sorry, something went wrong.
I tested it using HEAD (a9a8634) with Fira Sans and each run I seem to get a random choice of: /usr/share/fonts/TTF/FiraSans-Book.ttf /usr/share/fonts/TTF/FiraSans-Eight.ttf /usr/share/fonts/TTF/FiraSans-Four.ttf /usr/share/fonts/TTF/FiraSans-Hair.ttf /usr/share/fonts/TTF/FiraSans-Regular.ttf /usr/share/fonts/TTF/FiraSans-Thin.ttf /usr/share/fonts/TTF/FiraSans-Two.ttf /usr/share/fonts/TTF/FiraSans-Ultra.ttf Tested using: # while rm -fr ~/.cache/matplotlib && python foo.py; do :; done
import matplotlib
matplotlib.use("Agg")
matplotlib.rcParams["font.sans-serif"] = "Fira Sans"
matplotlib.rcParams["font.weight"] = "regular"
import matplotlib.pyplot as plt
print(matplotlib.font_manager.findfont("Fira Sans"))
plt.plot([1, 2], [3, 4])
plt.savefig("foo.png") |
Sorry, something went wrong.
OK I've restored them and pushed "Thin" down to 50 instead of 100.
Perhaps we could deprioritize them and mark their weights as “uncertain”. They should still get picked up as if their weight is Regular, but if a “definitely” Regular font is found, then it takes precedence. |
Sorry, something went wrong.
@Rufflewind I could not reproduce your results. |
Sorry, something went wrong.
|
I re-reproduced my results on a clean Arch container: (venv) [rf@arch-container matplotlib]$ while rm -fr ~/.cache/matplotlib && python foo.py; do :; done /home/rf/.fonts/FiraSans-Eight.otf /home/rf/.fonts/FiraSans-Book.otf /home/rf/.fonts/FiraSans-Eight.otf /home/rf/.fonts/FiraSans-Two.otf /home/rf/.fonts/FiraSans-Four.otf /home/rf/.fonts/FiraSans-Hair.otf /home/rf/.fonts/FiraSans-Four.otf /home/rf/.fonts/FiraSans-Hair.otf /home/rf/.fonts/FiraSans-Book.otf /home/rf/.fonts/FiraSans-Regular.otf /home/rf/.fonts/FiraSans-Thin.otf /home/rf/.fonts/FiraSans-Eight.otf /home/rf/.fonts/FiraSans-Book.otf /home/rf/.fonts/FiraSans-Eight.otf /home/rf/.fonts/FiraSans-Four.otf … |
Sorry, something went wrong.
|
@Rufflewind Thank you for re-reproducing the results. fc-scan ~/.fonts/FiraSans-Regular.otf shows that fullname field have changed from "Fira Sans Regular" to "Fira Sans".
Ref: #8587 |
Sorry, something went wrong.
|
'powercycled' PR to re-trigger CI |
Sorry, something went wrong.
|
I made three modification in #8607. In my opinion, the first and third are not improving, but bug fix. |
Sorry, something went wrong.
|
Superseded by #16203; thanks for the pr. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
PR Summary
Bandaid-ish fix for #8550. Would like some feedback on whether these are good/bad ideas.
Add more font weights and change some existing ones to better fit Mozzila's developer wiki:
Added:
Changed:
Improve the font-weight guessing logic. In particular, rather than trusting style_flags (which is very limited and inexpressive), the code now inspects style_name for keywords. Some limited testing this on the fonts of my system indicates that most sensible cases are covered. Otherwise, just bail with KeyError so that the font won’t get registered (mitigates Matplotlib chooses the wrong font for unrecognized weights #8550).
The few fonts where the new logic fails have really exotic subfamilies like “Retina” or “Four Italic”, which don’t really map well to the existing font system anyway so I don’t think it’s much of a loss. We could still check for style_flags & BOLD, but testing revealed only one font where this mattered (Latin Modern Sans Quotation, which is actually not bold despite the bold flag being set!).
PR Checklist