cosmic-text icon indicating copy to clipboard operation
cosmic-text copied to clipboard

Full support for fontconfig

Open tjw123hh opened this issue 1 year ago • 2 comments

https://github.com/RazrFalcon/fontdb/issues/56#issuecomment-1667516630 suggests that we should entirely avoid using fontdb and directly use fontconfig to index fonts on Linux. Perhaps we should have a better solution?

Originally posted by @tjw123hh in https://github.com/pop-os/cosmic-text/issues/174#issuecomment-2216816485

tjw123hh avatar Jul 09 '24 07:07 tjw123hh

Looking at the #[cfg(feature = "fontconfig")] code in fontdb, it seems to me it's pretty close to a solid fontconfig replacement. It uses fontconfig-parser to parse the config files, so most of what needs to be done is finding the paths where the config files are located, and then dealing correctly with the aliases defined in those config files. There are some problems with the latter part with the current fontdb code. (On my system, the current fontdb code fails to resolve .family_name(Family::Monospace) to a font that actually exists, whereas fontconfig has not such problems.)

Though I get that the fontdb maintainer doesn't want to maintain a whole fontconfig replacement within fontdb.

tmke8 avatar Sep 28 '24 09:09 tmke8

So can we avoid fontdb and use fontconfig API instead?

tjw123hh avatar Feb 16 '25 02:02 tjw123hh