I’d like to propose a feature to enhance user control over FontConfig, particularly to address potential limitations in web applications.
The goal is to allow users to upload and manage their own fonts, organization structured under their individual directories. While it's feasible to configure FontConfig by setting various environment variables (such as HOME, XDG_DATA_HOME, XDG_CACHE_HOME, and FONTCONFIG_PATH), there is a significant challenge in a web context: the risk of race conditions. When multiple requests are processed simultaneously, the environment variables set by one request can easily be overwritten by another, leading to inconsistencies and errors.
Having recently integrated FontConfig into a PHP C extension, I believe there's a straightforward solution. I propose the addition of new command-line options that would enable individual font and configuration directories without relying on environment variables. For instance:
Allowing these options to be specified multiple times would enable users to add several configuration or font directories as needed.
The FontConfig library is relatively easy to work with, and I envision that, after parsing these inputs, we could effectively utilize functions such as:
Implementing this feature would significantly improve the flexibility and user experience of font management in web applications, reducing the likelihood of conflicts and race conditions. Thank you for considering this request!
The goal is to allow users to upload and manage their own fonts, organization structured under their individual directories. While it's feasible to configure FontConfig by setting various environment variables (such as HOME, XDG_DATA_HOME, XDG_CACHE_HOME, and FONTCONFIG_PATH), there is a significant challenge in a web context: the risk of race conditions. When multiple requests are processed simultaneously, the environment variables set by one request can easily be overwritten by another, leading to inconsistencies and errors.
Having recently integrated FontConfig into a PHP C extension, I believe there's a straightforward solution. I propose the addition of new command-line options that would enable individual font and configuration directories without relying on environment variables. For instance:
- --fontconfig--config-dir=/mnt/user/078123/fonts
- --fontconfig--font-dir=/mnt/other/customfont
Allowing these options to be specified multiple times would enable users to add several configuration or font directories as needed.
The FontConfig library is relatively easy to work with, and I envision that, after parsing these inputs, we could effectively utilize functions such as:
- FcBool FcConfigAddConfigDir(FcConfig *config, const FcChar8 *d)
- FcBool FcConfigAddFontDir(FcConfig *config, const FcChar8 *d, const FcChar8 *m, const FcChar8 *salt)
Implementing this feature would significantly improve the flexibility and user experience of font management in web applications, reducing the likelihood of conflicts and race conditions. Thank you for considering this request!