google / iconvg

IconVG is a compact, binary format for simple vector graphics: icons, logos, glyphs and emoji.
Apache License 2.0
676 stars 11 forks source link

"The suggested palette is encoded in at least one byte." unclear #14

Closed Hixie closed 2 years ago

Hixie commented 3 years ago

The MID 1 section of the spec says:

The suggested palette is encoded in at least one byte. The low 6 bits of that byte form a number N. [...] The chunk then contains N+1 explicit colors, in that 1, 2, 3 or 4 byte encoding.

It's not clear what the "at least one byte" part of this means. Since N cannot be negative, and there's always N+1 colors, wouldn't a more accurate statement be "at least two bytes"? It may be clearer to just say "The low 6 bits of the first byte of the metadata block after the MID form a number N...".

See also https://github.com/google/iconvg/issues/11.

Hixie commented 3 years ago

(In my initial reading I assumed the statement was vacuously true in that every metadata block has at least the MID encoded in at least one byte, so the palette block is obviously at least one byte, as any block would be, but that doesn't make much sense in the context of "form a number N", unless we're supposed to re-use the MID byte's bits? But I'm pretty sure that's not what was intended.)