-
Notifications
You must be signed in to change notification settings - Fork 193
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
Glyf table point flags bit 6 gets lost #117
Comments
Correction: The OT spec 1.8.3 does not list the flag as reserved anymore, so I think that woff2_compress ignores the flag is a legitimate bug. See https://docs.microsoft.com/de-de/typography/opentype/spec/glyf#simple-glyph-description |
Well, while I agree that this ought to be fixed so that woff2 works on all platforms, strictly speaking it's still not a bug from OT spec point of view. The flag description clearly says "it is valid to have contours overlap without having this flag set." |
I think this is a limitation of the WOFF2 transformed |
According to the OpenType spec, "The OVERLAP_SIMPLE flag is used by some rasterizer implementations to ensure that a non-zero-fill algorithm is used rather than an even-odd-fill algorithm. Implementations that always use a non-zero-fill algorithm will ignore this flag. " |
I see, it's a tough problem ... would be easiest if Apple detected the overlapping glyphs correctly ;) |
originally only MacOS rasterizer looked at those bits while they were reserved, but after the OT table allowed them, FreeType decided to also use them when present to enable oversampling (to mitigate effect of increased pixel coverage when paths overlap inside a glyph), see fonttools/fonttools#2059 |
@anthrotype pointed out on chat that |
Potentially we spend a reserved bit (https://www.w3.org/TR/WOFF2/#woff20Header) to flag the existence of a new datastructure that gives you flag bits? |
At this point, there is only one flag bit (bit 6) that we are missing in the WOFF2 transformed glyf table structure (the remaining bit 7 is reserved). The added bonus is that this particular bit (unlike all other flag bits) can only be set once, on the first flag for the glyph. So, using one reserved bit in the WOFF 2.0 header to indicate, for example, the presence of a new flag6Bitmap[] (a numGlyphs-long bit array, similar to bboxBitmap[]) in the end of the transformed 'glyf' table would be a backward compatible way of making it happen. |
What about composite glyphs with overlapping components? They also have their own distinct flag. |
Composite glyph flags values are already part of the compositeStream[]. |
Noob question: what do we have to do to make spec updates to woff2 at this point? - not too clear on the process. |
We'd need to discuss the details with Chris L., but there is definitely a path forward either as a minor version upgrade to 2.1 (which may require going through the same steps of ED/CR/Rec) or, considering the relatively small scope of changes (and if there are other spec corrections needed while we are at it), there may be an opportunity for a lightweight erratum including candidate changes. The good news is that the maintenance of the WOFF2 spec is part of the existing WG charter so that we can start this project immediately, without any additional approval, and if we go with erratum, once the candidate corrections/additions are reviewed and approved by the community they can immediately be folded into the Recommendation text as normative. |
Wow that's amazing news! Cheers Vlad! |
Proposed as agenda+ topic for WebFonts WG call next week. |
The WebFonts WG has discussed this issue during today's call, please review and submit your comments on the proposed changes. Thank you! |
Compressing a TTF to WOFF2 ignores bit 6 of any glyf table point flags. This bit is marked as reserved in the OT spec, but Apple uses it to determine the presence of overlapping contours in a glyph. See fonttools/fonttools#730 and https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6AATIntro.html:
Should the woff2_compress code be patched so the flag stays intact? I don’t have the experience in C to do it myself.
The text was updated successfully, but these errors were encountered: