RE: Question about instructionLength of simple glyphs

Hi Jonathan,

You wrote:
> However, I did notice a couple of typos when reading through the "Decoding of Composite Glyphs" section:
>    "A decoder MUST check for presense of the bonding box"
> s/presense/presence/;  s/bonding/bounding/

Thank you, I fixed this in my local copy and will have the online version updated shortly.


> Also, the last two paragraphs of section 5.1 seem somewhat contradictory. First, we read:
>
>    "Finally, for both simple and composite glyphs, if the corresponding bit in the bounding box bit vector is set .... If the corresponding bit in the bounding box bit vector is not set, then derive the bounding box by computing..."
>
> but the next paragraph goes on to insist that
>
>    "A composite glyph MUST have an explicitly supplied bounding box..."
>
> which means that the "if"s in the preceding paragraph were not really applicable to composite glyphs; in particular, the second "if" suggests that we might need to compute a bounding box (for a composite glyph), but then we go on to prohibit this.

Yes, this definitely needed a clarification. I changed the second sentence to read "For simple glyphs, if the corresponding bit in the bounding box bit vector is not set, then derive the bounding box by computing the minimum and maximum x and y coordinates in the outline ..." so only the first of this paragraph is applicable to both simple and composite glyph cases.

> And a further question: what happens if the bounding box bit vector says that an explicit bounding box is provided, but the glyph is empty (numberOfContours = 0)? AFAICS, this would indicate an error by the encoder, but the spec doesn't say what the decoder should do in this case.

I don't think this should be considered an error - an empty glyph record, when converted back to 'glyf' table will still have a bounding box defined as [0,0,0,0]. So it is possible that:
1) an encoder can see an empty glyph and decide that since there are no outlines and no source to compute bounding box info - it needs to be explicitly encoded as all zeros (which is acceptable) and would set the bonding box bit with all zeros as encoded values;
2) an encoder can see an empty glyph and decide that because no outlines = no ink = bounding box is [0,0,0,0], this can be inferred from an empty glyph (so it will clear the bounding box bit telling the decoder to compute an empty bounding box (which is also acceptable);
3) an encoder generates a glyph entry for an empty glyph with bounding box bit set and non-zero values encoded - this is probably the only condition that could be treated as error, although I am not sure if it will have any effect once the font is used to render a text. Should we catch it as error condition and invalidate the woff2 file that caused it?

I think that options 1) and 2) are perfectly valid and if you agree, I will modify the spec to reflect that, not sure about the option 3) though.

Thank you,
Vlad

Received on Friday, 27 March 2015 20:43:53 UTC