[Fontconfig] Another proposal for saving custom fonts in fontconfig

Peng Wu peng.e.wu at gmail.com
Wed Jun 26 07:14:42 UTC 2019


In order to support saving custom fonts from variable fonts in pango,
we propose to saving the information in fontconfig XML.

URL: https://gitlab.gnome.org/GNOME/pango/issues/350

Here are some thoughts about C API and fontconfig XML syntax.

For C API, I think some bool property like FC_CUSTOM_FONT will need to
be added.
And some API to write or remove the custom fonts maybe also needed.

For C API:

To create the custom font file:
FcPublic FcBool
FcConfigCreateCustomFont(FcPattern *origin, FcPattern *custom);

To remove the custom font file:
FcPublic FcBool
FcConfigRemoveCustomFont(FcPattern *custom);

For fontconfig XML syntax, we have one proposal:

1. Create separate XML syntax for custom font file format to recognize
as normal fonts:

		<family>Variable Font Family</family>
		<style>Style Name</style>
		<family>Variable Font Family</family>
		<style>Custom Style Name</style>

After fontconfig finish font loading, the "origin" element will match
the existing fonts, and the "custom" element will copy and modify the
matched font,
then save the new font as normal font pattern into FcFontSet.

I will think about how to re-use the current fontconfig XML syntax,
and propose another XML syntax soon.

Feel free to comment it.


More information about the Fontconfig mailing list