Skip to content

Fix false positive in googlefonts/colorfont_tables for variable fonts with non-varying SVG glyphs - #5060

Open
Sanjays2402 wants to merge 1 commit into
fonttools:mainfrom
Sanjays2402:fix-colorfont-tables-variable-svg
Open

Sanjays2402 wants to merge 1 commit into
fonttools:mainfrom
Sanjays2402:fix-colorfont-tables-variable-svg

Conversation

@Sanjays2402

Copy link
Copy Markdown

Description

Fixes #4946.

The googlefonts/colorfont_tables check unconditionally emitted a
variable-svg FAIL for every variable font containing an SVG table, on the
grounds that SVG does not support OpenType Variations. But not every glyph
in a variable font varies: a variable font whose SVG color glyphs have no
variation data renders identically at every point in the design space, so
flagging it is a false positive (e.g. aliftype/raqq v2.00).

The check now inspects the SVG table's document list and only emits
variable-svg when at least one of the covered color glyphs actually has
variation data — in gvar, or via blend operators in CFF2 charstrings
(including called subroutines). Fonts with a degenerate/empty SVG table
keep the previous conservative behavior. The check rationale was updated
to describe this.

Test evidence

  • Reproduced the bug with the font linked in the issue (Raqq v2.00):
    before the fix it got FAIL variable-svg; after the fix it no longer
    does (45 SVG color glyphs, none with variation data).
  • Extended tests/test_checks_googlefonts_colorfont_tables.py:
    • a variable font with an SVG table covering glyphs with no gvar
      variation data now PASSes;
    • a variable font whose SVG-covered glyph does have gvar variation
      data still FAILs with variable-svg;
    • a new CFF2 test using source-sans-pro/VAR/SourceSansVariable-Italic.otf:
      SVG covering space (no blend ops) does not FAIL, SVG covering A
      (has blend ops) FAILs with variable-svg.
  • pytest tests/test_checks_googlefonts_colorfont_tables.py: 2 passed.
  • black --check clean on both changed files; pylint clean on the check module.
  • Updated CHANGELOG.md.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[colorfont_tables] Fails for any variable font with SVG table

1 participant