Expose bit 6 of the `glyf` first outline flags byte
See original GitHub issueMy 160413-EvenOddTT issue exposes a problem that the macOS Sierra rasterizer sometimes displays overlapping TT (glyf
) contours as “white”. This behavior can be suppressed if one sets “bit 6 of the first Outline Flag byte to 1”. While the official Apple TrueType spec and the OpenType spec treat this bit as “reserved”, Apple’s introductory chapter to AAT explains that this bit is actually used to control the rendering of overlapping contours in the Apple rasterizer. Currently, no easy-to-use tools expose this bit, so setting it requires binary work.
It would be useful if this bit was exposed to fontTools and/or to the .ttx
dump.
I’m not sure how to do it elegantly, especially since the contour.pt
structure in fontTools is not a straight binary dump but is a bit prettified. Since the official spec treats the flag as reserved, and the AAT chapter only mentions the first flags byte of a glyph, an option in fontTools could trigger .ttx
to dump/merge the following syntax, and of course a .flag6
boolean attribute could be added to the pt
object:
<TTGlyph name="O" xMin="59" yMin="0" xMax="768" yMax="702">
<contour>
<pt x="674" y="440" on="1" flag6="1"/>
<pt x="674" y="269" on="1"/>
<pt x="140" y="269" on="1"/>
<pt x="140" y="440" on="1"/>
</contour>
<instructions><assembly>
</assembly></instructions>
</TTGlyph>
A prettier implementation would be to introduce a boolean attribute on a fontTools.ttLib.tables._g_l_y_f.Glyph
level, akin to isComposite
but named hasOvelaps
or hasOverlapsAAT
, that would conditionally appear in the .ttx
dump as an optional attribute of the <TTGlyph>
element (if it is set in the font), and would be coordinated with the bit 6 of the first flag byte of the glyf
strucutre for the glyph. The name hasOverlapsAAT
would hint at its origin.
<TTGlyph name="O" xMin="59" yMin="0" xMax="768" yMax="702" hasOverlapsAAT="1">
<contour>
<pt x="674" y="440" on="1"/>
<pt x="674" y="269" on="1"/>
<pt x="140" y="269" on="1"/>
<pt x="140" y="440" on="1"/>
</contour>
<instructions><assembly>
</assembly></instructions>
</TTGlyph>
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:8 (2 by maintainers)
Top GitHub Comments
https://github.com/twardoch/test-fonts/blob/master/varia/160413-EvenOddTT/EvenOddTT-mod.ttf
Already fixed.