Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
drott opened this issue Aug 8, 2024 · 2 comments

Comments

@drott
Copy link
Contributor

drott commented Aug 8, 2024

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

@dfrg
Copy link
Member

dfrg commented Aug 8, 2024

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 (

pub fn user_to_normalized(
) 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.

@behdad
Copy link
Contributor

behdad commented Aug 8, 2024

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

@dfrg dfrg mentioned this issue Aug 29, 2024
simoncozens added a commit that referenced this issue Aug 30, 2024
simoncozens added a commit that referenced this issue Aug 30, 2024
simoncozens added a commit that referenced this issue Sep 4, 2024
simoncozens added a commit that referenced this issue Sep 9, 2024
simoncozens added a commit that referenced this issue Sep 10, 2024
cmyr pushed a commit that referenced this issue Sep 10, 2024
* Add avar2 fields

* Regenerate for avar2

* Add avar2checker (Laurence Penney)

* Test case

* Support avar2 in user_to_normalized

* avar2 support requires alloc

See #1074 (comment)

* Add provenance details for avar2checker

* Unneeded

* Tidy up is_some && unwrap

* Use stack allocation

* Unneeded
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants