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

can't decode WOFF2 where only hmtx is transformed, but not glyf #124

Open
anthrotype opened this issue Jun 12, 2019 · 1 comment
Open

can't decode WOFF2 where only hmtx is transformed, but not glyf #124

anthrotype opened this issue Jun 12, 2019 · 1 comment

Comments

@anthrotype
Copy link
Member

The following zip archive contains two WOFF2 fonts.
In the first ("TestTTF-Regular+hmtx+glyf.woff2") both the glyf (and loca) and hmtx table are transformed; in the second font ("TestTTF-Regular+hmtx-glyf.woff2") only the hmtx table is transformed, whereas the glyf and loca are stored in their original form without pre-processing transformation.

Decompressing with woff2_decompress the first font (with all tables trasformed) completes successfully, whereas attempting to decompress the second font (where only hmtx is transformed but not glyf+loca) fails.

https://github.com/khaledhosny/ots/files/3281395/test-woff2-hmtx-transform.zip

As far as I know, the WOFF2 spec doesn't say that whenever hmtx is transformed, glyf should also be transformed. Only glyf and loca have to be transformed or not transformed together.

I reported the same issue in khaledhosny/ots#190, which uses the google/woff2 library to decode WOFF2 fonts.

@anthrotype
Copy link
Member Author

I believe the issue is because the ReconstructTransformedHmtx method requires that WOFF2FontInfo.x_mins (vector of the glyphs' xMin bbox coordinate) is first populated; but this only happens within the ReconstructGlyf method, which is not run when glyf table is not transformed (i.e. has the bits 6-7 of the table directory entry's flags set to the value of 3).

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