Commit Graph
1 Commits
Author SHA1 Message Date
Qunxin Liu bf6414323c [subset] Fix empty ClassDef not intersecting class zero (#6262)
* [subset] Fix empty ClassDefFormat2 not intersecting class zero

An empty ClassDef (rangeCount == 0) assigns class zero to every glyph, but
ClassDefFormat2::intersects_class() and intersected_classes() reported no
intersection when glyphs is not empty.

Adds a subset test that fails before and passes after.

* [subset] Fix empty ClassDefFormat1 not intersecting class zero

Same bug as the previous commit, in the format 1 variant. When glyphCount is
zero and startGlyphID is zero, `startGlyph + classValue.len - 1` underflows
to 0xFFFFFFFF, so neither of the two comparisons can be true and class zero
is never reported. (With a nonzero startGlyphID it happens to work.)

harfbuzz always serializes an empty ClassDef as format 2, so this is only
reachable with fonts produced by other tools.

Extends the previous test with a hand-built format 1 variant of the font.
2026-09-15 20:16:33 -06:00