Open anthrotype opened 5 years ago
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
).
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 https://github.com/khaledhosny/ots/issues/190, which uses the google/woff2 library to decode WOFF2 fonts.