fontconfig-rs icon indicating copy to clipboard operation
fontconfig-rs copied to clipboard

Sort substitute

Open wezm opened this issue 6 months ago • 2 comments

  • Call default_substitute and config_substitute in sort_fonts.
  • Make sort_fonts a method of Pattern, which makes it consistent with font_match.
  • Expose default_substitute and config_substitute in public API in case they are needed in other situations.

Fixes #45

wezm avatar May 13 '25 00:05 wezm

@kjarosh does this seem reasonable?

wezm avatar May 13 '25 00:05 wezm

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.

kjarosh avatar May 14 '25 10:05 kjarosh

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.

wezm avatar May 19 '25 23:05 wezm