fontconfig-rs
fontconfig-rs copied to clipboard
Sort substitute
- Call
default_substituteandconfig_substituteinsort_fonts. - Make
sort_fontsa method ofPattern, which makes it consistent withfont_match. - Expose
default_substituteandconfig_substitutein public API in case they are needed in other situations.
Fixes #45
@kjarosh does this seem reasonable?
Thanks @wezm for the fixes, I appreciate it!
I think it's a good move to expose default_substitute and config_substitute. Calling them in sort_fonts also works for me.
However, I'm wondering if there's a reason those calls are separate in fontconfig. I'm not experienced enough with fontconfig to say it for sure, but it's possible there are some use cases which require not calling substitutions before sorting or matching fonts.
Edit: or maybe it's about selecting a different config for substitutions or using FcConfigSubstituteWithPat.
However, I'm wondering if there's a reason those calls are separate in fontconfig. I'm not experienced enough with fontconfig to say it for sure, but it's possible there are some use cases which require not calling substitutions before sorting or matching fonts.
I'm not sure if there are such cases either, but since this just brings sort_fonts in line with font_match I think it reasonable unless someone cites other use cases.