Conversation
|
The weights for the same name do not match between the two dictionaries, that seems wrong. When we look at the weights to do font matching to we look at the name or the numeric value? |
|
|
Ah, I missed the difference between ultrabold and ultrablack. Please add all the obvious missing keys in this pass so we do this once rather than N times. I'm going to also remind you have our LLM use policy (https://matplotlib.org/devdocs/devel/contribute.html#use-of-generative-ai). |
I have added the remaining obvious missing keys specially black category ones which includes ultrablack, superblack and extrablack. |
|
https://gitlab.freedesktop.org/fontconfig/fontconfig/-/blob/main/src/fcfreetype.c#L944-968 Should be treated as the authoritative list of weight names and their equivalence unless from looking at the git history we can sort out a good reason why the other names were previously excluded (or why they should be excluded now). |
That makes sense, thanks for clarifying. Would you like me to extend weight_dict further to include additional names like thin and extralight, or keep this change limited to the current additions as per the requirement. |
PR summary
This PR fixes an inconsistency in how font weights are handled. Some weight names like extrabold, superbold, and ultrabold were already supported internally when parsing font metadata, but they were not accepted when passed directly as user input. This created a mismatch where these values could be read from fonts but not used explicitly.
To fix this, I added the missing weight names to weight_dict so that user input handling is consistent with internal parsing. This keeps existing behavior unchanged while resolving the asymmetry. I also updated the existing test to cover these cases.
AI Disclosure
PR checklist