Satty icon indicating copy to clipboard operation
Satty copied to clipboard

Feature idea: add fallback fonts automatically

Open RobertMueller2 opened this issue 2 months ago • 2 comments

Followup for #308 and #298

The idea is to explore using an advanced text engine like Pango or Cosmic Text to determine fallback fonts for the entered text, these could be used for femtovg rendering.

Femtovg itself considers fallback fonts, but it depends on which fonts have been added. https://github.com/femtovg/femtovg/blob/master/examples/text.rs

While #298 provides a configuration option for this, the convenience isn't great.

https://docs.gtk.org/Pango/method.Fontset.get_font.html https://github.com/femtovg/femtovg/blob/master/examples/external_text.rs

An important point, next to convenience, should be performance. The font loading mechanism shouldn't lead to additional sluggishness.

RobertMueller2 avatar Oct 16 '25 05:10 RobertMueller2

Just a thought: we could also consider contributing to femtovg, if thats a better place for these things... afterall we could give something back!

gabm avatar Oct 16 '25 06:10 gabm

Sure, when we get to that point, we can ask. But since the external text example does make use of cosmic_text, I'm not sure if the project will want to have any more sophisticated fallback font loading. I'm personally not sure if I'll ever have the knowledge of making this super useful, then again, it can probably be researched in both the above.

Also, different thought, we're already using fontconfig, I think we may even be able to get fallback fonts that way.

RobertMueller2 avatar Oct 16 '25 16:10 RobertMueller2