fontations icon indicating copy to clipboard operation
fontations copied to clipboard

Avar2 support in font identification and contour variations / situations where coords are provided

Open drott opened this issue 1 year ago • 2 comments

In https://docs.rs/read-fonts/latest/read_fonts/tables/avar/type.Avar.html#method.version it says that Major version is set to 1.

  1. For identification of avar2 fonts in Blink it would be useful if this API would be able to return 2 for avar2 fonts.

  2. For applying axis variations and retrieving paths in Skrifa, Glyph::draw, and in situations where normalized coords are provided, Skrifa would need to know how to apply avar2 axes.

CC @behdad

drott avatar Aug 08 '24 14:08 drott

I believe it should currently report version 2 if the table specifies that so identification will work. The actual application of avar2 is not done yet but that should be a relatively small patch. I think it’s just detecting the IVS and applying a delta to each coord using the avar1 adjusted coord set.

edit: this code has recently moved to read-fonts (https://github.com/googlefonts/fontations/blob/13d90b875093520e35d6f0bcd422f2b2eed2619a/read-fonts/src/tables/fvar.rs#L42) so allocation of the additional temporary storage will be a bit tricky. I’d like to use the stack for this when possible with a fallback to heap if necessary and that means taking an unconditional dependency on the alloc crate.

dfrg avatar Aug 08 '24 14:08 dfrg

Yeah, applying the ItemVariationStore only. It's this code: https://github.com/harfbuzz/harfbuzz/blob/f35b0a63b1c30923e91b612399c4387e64432b91/src/hb-ot-var-avar-table.hh#L318-L347

behdad avatar Aug 08 '24 16:08 behdad