Invalid font weight mapping between Pango and CSS
Hi, I noticed that when using custom font weights in zathura, the following error is triggered:
error: Unable to load CSS: <data>:7:15unknown value for property
This corresponds to the @font-weight@
property being set in girara.
I have tracked down the issue to https://git.pwmt.org/pwmt/girara/-/blob/develop/girara/session.c#L103: where the font weight is retrieved as a numeric value from pango and mapped to a CSS value string. It seems however that many of the mappings are not valid, when compared the documented GTK values: https://docs.gtk.org/gtk3/css-properties.html#font-properties
The fix is quite simple, though I see two ways to implement it;
- Update the mapping to the correct documented values
- Remove the mapping, and simply convert the weight value retrieved to a string, as the GTK CSS parser also accepts this.
I've implemented the second method on my local system and it does indeed resolve the issue, however pango can theoretically return a weight value of 1000 (ultraheavy), which is not documented as valid in GTK.