MPEGGroup / OpenFontFormat

Official MPEG repository to discuss issues on Open Font Format (ISO/IEC 14496-22)
31 stars 6 forks source link

[AMD2 WD: COLR v1] Add paint formats for more compact representations in non-variable fonts #43

Closed PeterConstable closed 3 years ago

PeterConstable commented 3 years ago

In the working draft presented at the January SC29 meeting (m55831-COLR_v1_updates-14496-22-AMD2.docx), various paint table formats have structures that allow for delta-set indices in variable fonts. In non-variable fonts, these fields are present but un-used. These result in significant size increases without benefit in non-variable fonts.

For example, for specifying a linear gradient, the size of the paint table is 40 bytes, not counting the ColorLine subtable; and 24 of 40 bytes (60%) is for un-used delta-set indices. The size of the ColorLine subtable is 8 × numStops + 3, of which 4 × numStops (36% to 50%) is for un-used delta-set indices.

The actual size impact on a non-variable, COLR v1 font will depend on the nature of the colour glyph descriptions used. Using preliminary versions of Google's Noto Emoji font using COLR v1, it was estimated that about 12% of the file size is un-used delta-set indices.

It would be worthwhile, then, to revise the proposed COLR v1 formats to allow for more compact representation in non-variable fonts.

The following are the v1 structures that include delta-set indices:

A few alternative designs have been considered by Google and Microsoft engineers:

It was determined that additional non-variable paint table formats provide the best balance between improved efficiency for non-variable fonts and additional complexity in the structures.

Thus, additional paint (and member) formats for more-compact non-variable representation should be added; these would be non-variable counterparts to the structures listed above.

PeterConstable commented 3 years ago

The draft in the Google Fonts repo has been updated to address this issue. The following is the main pull request for that change:

PeterConstable commented 3 years ago

Using preliminary versions of Google's Noto Emoji font using COLR v1, it was estimated that about 12% of the file size is un-used delta-set indices.

After updating Google's implementation to use the additional paint formats, the actual reduction in file size for Noto Emoji COLR v1 was 16%.

svgeesus commented 3 years ago

This looks like a useful addition! No need for non-variable fonts to pay a size tax.

vlevantovsky commented 3 years ago

Proposed changes have been incorporated as part of the input contribution m56342.