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

Graciously return non-variable advance when glyf-based advance fails #4706

Closed
drott opened this issue May 8, 2024 · 2 comments
Closed

Graciously return non-variable advance when glyf-based advance fails #4706

drott opened this issue May 8, 2024 · 2 comments

Comments

@drott
Copy link
Collaborator

drott commented May 8, 2024

In get_advance_with_var_unscaled when the font is variable, first an HVAR based advance is attempted to be computed. If that fails, a glyf based / phantom-points advance is to be computed.

This value is unconditionally returned, even though the glyf based advance with computation could fail (for example when there is no glyf table).

IMO in this case, it'd be more robust behavior to still return the non-variable advance from line 402:
unsigned int advance = get_advance_without_var_unscaled (glyph);

Can we do sth like:

     unsigned int glyf_advance = _glyf_get_advance_with_var_unscaled (font, glyph, T::tableTag == HB_OT_TAG_vmtx);
      if (!glyf_advance) {
        return advance;
      } else {
        return glyf_advance;
      }
@drott
Copy link
Collaborator Author

drott commented May 8, 2024

CC @nedley

@behdad behdad closed this as completed in 3609ebb May 13, 2024
@drott
Copy link
Collaborator Author

drott commented May 17, 2024

Thanks, @behdad !

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

1 participant