Using bits 6-7 of the table directory flags byte as a two-bit per-table version number

As discussed on the call today, I propose that we redefine the upper two 
bits of the flags byte for each table in the table directory[1], 
described as " reserved for future extensions" in the current draft, to 
be a two-bit version number (i.e. with values 0-3) representing the kind 
of transformation or preprocessing that has been applied to the 
individual table.

For all tables except 'glyf' and 'loca', transformation version 0 will 
be the null transform (no preprocessing: the original table is simply 
passed to the Brotli compressor for inclusion in the compressed stream). 
For 'glyf' and 'loca', version 0 is the transformed format as described 
in the current draft spec.

Then for the 'hmtx' and 'vmtx' tables, we can also specify 
transformation version 1, which will be the sidebearing-removal that we 
have been discussing recently.

The spec will need to specify that a decoder encountering a table 
transformation version it doesn't know about MUST reject the entire 
font, as it cannot be correctly decoded. (This would already be the 
correct response to the "reserved" bits being non-zero, although the 
current draft doesn't make this explicit.)

This will allow us to introduce transformations for additional tables, 
and/or improved transformations for the currently-transformed ones, 
without breaking compatibility with existing fonts. Decoders will be 
able to tell from the per-table version number how the transformed table 
should be decoded, so older fonts that do not use the new transform will 
continue to work.

JK

[1] http://www.w3.org/TR/WOFF2/#table_dir_format

Received on Wednesday, 27 May 2015 16:30:05 UTC