Skip to content

Overcome limitations in gvar? #150

Open
@davelab6

Description

@simoncozens has been hacking up what is effectively merging a font like Roboto Flex into a font like the MegaMerged Noto Sans, and he said today:

Okay. I have a font which works and is now weighing in at 15Mb. I was wrong about the "sparse masters" in gvar; we do need to extend the outlines out to the corner masters, and because of the way OT variations work - they're made up of "tentpoles", and so to make there be a null variation between wght=1-400 (and other places) - we need to add opposing tent-pegs to keep the "canvas" taut. This means we need to add tuple variation entries per glyph to "support" those corner masters at opsz=6-17, opsz=18-144, wght=1-400 and wght=800-1000, so around six more tuple variation entries per glyph than are in the Classic mega-merged font. This is what's blowing up the gvar table. (Note that the gvar table in the Flex font is 6k per glyph, so if there were a full Flex designspace over all the glyphs in the Classic we would expect the gvar table alone to be around 51 megabytes.) The point being, by embedding a subset designspace inside a large design space I don't think there is a reasonable way to make it any smaller.

I suspect that the current spec's gvar has limitations that real-world projects are (about to be) running into.

@justvanrossum also wrote me recently,

Having many fvar axes (whether used in VARC or gvar or other doesn’t matter) makes gvar variations bloaty.

A glyph with (say) 300 master shapes may still compile if the font has (say) 25 axes, but will overflow (with the same master shapes) if the font has (say) 45 axes.

gvar compilation overflows if the compiled variations for a single glyph exceed 65536 bytes.

So, this happens on “atomic elements”: variable glyphs that are used as components, but themselves are made of outlines.

The same would happen in a VARC-less font with that number of axes and that number of variations in a single glyph.

Do we need to explore spec changes that overcome limitations in gvar?

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions