Clarification on the size of overlapSimpleBitmap [WOFF2]

I'm in the process of implementing support for the new overlapSimpleBitmap
field in the woff2 encoder and decoder. The current text is potentially
underspecified on what size the array should be. The following text is
provided (from https://www.w3.org/TR/WOFF2/#glyf_table_format):

"A numGlyphs-long bit array that provides values for the overlap flag [bit
6] for each simple glyph. (Flag values for composite glyphs are already
encoded as part of the compositeStream[])."

However the other bitmap array, bboxBitmap which has similar text, but
later has a sentence that explicitly defines the size:

"The total number of bytes in bboxBitmap is equal to 4 * floor((numGlyphs +
31) / 32)"

This effectively sets the size of the bbboxBitmap to be multiples of 4
bytes, even though only ceil(numGlyphs/8) bytes are actually needed (I'm
curious if anyone knows the reason why this is sized to multiples of 4?)

My interpretation of the current text is that overlapSimpleBitmap should be
sized to ceil(numGlyphs/8) and *not *(4 * floor((numGlyphs + 31) / 32))
like bboxBitmap, but I wonder if we should make that more explicit? There's
potential for confusion if an implementer uses the same sizing rules from
bboxBitmap when implementing overlapSimpleBitmap.

Thoughts?

Received on Thursday, 17 March 2022 00:00:14 UTC