boring-expansion-spec icon indicating copy to clipboard operation
boring-expansion-spec copied to clipboard

[`COLR`v1] Relax requirement on not drawing unbounded glyphs

Open behdad opened this issue 7 months ago • 4 comments

The COLR table spec currently has these two paragraphs under the boundedness section [1]:

First, it says glyphs must be bounded, essentially making any unbounded glyph invalid:

A valid color glyph definition must define a bounded region

However, it goes on to specify, with a must, that implementations must not render the color glyph if the graph is not bounded:

If a clip box is provided for a color glyph, the color glyph is bounded, and no inspection of the Paint graph is required to determine boundedness. If no clip box is defined for a color glyph, however, applications must confirm that the color glyph definition is bounded, and must not render the color glyph if the defining graph is not bounded.

This is inconvenient for the implementations, because it requires a boundedness computation on the glyph graph before any painting can be started. Since those glyphs are invalid anyway, this is unnecessary burden.

This would be akin to requiring that CFF(2) invalid charstrings must not draw anything.

I suggest relaxing the spec by removing the requirement, and just say if the graph is not bounded, the results are undefined.

I have checked three implementations: FreeType and Fontations do NOT implement the boundedness requirement. HarfBuzz does.

[1] https://learn.microsoft.com/en-us/typography/opentype/spec/colr#metrics-and-boundedness-of-color-glyphs-using-version-1-formats

behdad avatar Apr 22 '25 20:04 behdad

cc @PeterCon @drott @dfrg @rsheeter

behdad avatar Apr 22 '25 20:04 behdad

I am supportive of such a change.

drott avatar Apr 23 '25 06:04 drott

This also seems reasonable to me.

dfrg avatar Apr 23 '25 12:04 dfrg

+1

rsheeter avatar Apr 23 '25 18:04 rsheeter