ab-glyph icon indicating copy to clipboard operation
ab-glyph copied to clipboard

Setting font variations

Open NathanRoyer opened this issue 2 years ago • 1 comments

Hello,

First of all, thanks for ab_glyph and glyph_brush; ab_glyph is what's used to render glyphs in my acrylic crate.

I was wondering how I could configure a font's variations? I see that ttf-parser has a Face::set_variation method, is this method available from ab_glyph?

I'd like to reference https://lorp.github.io/samsa/src/samsa-gui.html which is a great tool for playing with font variations.

Thank you very much.

NathanRoyer avatar May 21 '22 22:05 NathanRoyer

Hello, currently ab_glyph hasn't exposed ttf-parser's variable font methods.

That should be doable, a couple of things come to mind after a quick look:

  • Having a &mut self method in ab_glyph works less well with FontArc so perhaps a fn with_variation(self, ...) move approach would work better.
  • The new methods would explicitly require ttf-parser feature "variable-font" so we should probably add that (so it works in no-std) or expose it in ab-glyph as a feature too.

alexheretic avatar May 22 '22 05:05 alexheretic