GNOME Bugzilla – Bug 786016
support variable fonts
Last modified: 2018-01-04 05:12:00 UTC
What we need in pango:
1) some new font description syntax to specify axis values
2) passing those axis values to fontconfig/freetype when selecting fonts
3) some new font family api to get information about available axes
*** Bug 786985 has been marked as a duplicate of this bug. ***
While fixing this, I like to also fix this old issue:
Suggested api is:
pango_font_description_set_variation_settings (PangoFontDescription *desc,
const char *settings);
With a syntax like
we could use @ to make the variation settings part:
"Noto Sans @wght=600,wdth=70"
We need a separate pango_font_description_to_display, which would convert
the variation settings to a human-readable string, using axis names, etc.
To get more useful names for variation axes, we need the font face to lookup
I pushed some very preliminary work in wip/matthiasc/font-variations.
I just adds a string to PangoFontDescription, with some setters and getters.
Next step is to figure out how this gets passed down to actually loading a font. Is see
We store a shallow copy of the font description in the fontsetkey, and at some point we generate FcPatterns, and load an FcFont from it.
I think we can treat font variations like we treat the matrix here.
In the pangocairo case, we further have
Which gets us close to the place where we create a cairo scaled font. We can pass the font variations down there and keep them in the _PangoCairoFontPrivateScaledFontData struct.
There is no cairo api to create a scaled font with variation settings. Do we need one ?
I guess the only place where we can really apply the font variation settings is in pango_cairo_fc_font_lock_face - where we can call FT_Set_Var_Design_Coordinates, right before handing out the FT_Face object.
Any place higher up risks that we run into issues with the several layers of font caching leading to unintentional sharing of FT_Face instances that have variation settings applied
I've put some more code into that branch, but it doesn't work
Created attachment 359792 [details] [review]
This one works. It requires a cairo patch that has been sent to the list.
The patch adds new api, and i've marked it as PANGO_AVAILABLE_IN_1_42, which i guess means that we should branch off a stable 1.40 branch and finally open a new development cycle before landing this
Can you push your Pango stuff to a github or git.gnome branch as well?
its here https://git.gnome.org/browse/pango/log/?h=wip/matthiasc/font-variations