1
0
mirror of https://github.com/freetype/freetype.git synced 2026-10-23 11:08:54 +03:00
Files
Behdad Esfahbod (بهداد اسفهبد) 3f12a8a617 [autofit] Limit default GSUB coverage to reachable glyphs.
A lookup can be registered under several scripts while substituting inputs
from only one of them.  Collecting every output assigns those glyphs to the
first processed script, regardless of the inputs' styles.  In Google Sans
this assigns the Latin rvrn alternates to Cyrillic; missing Cyrillic blue
zones then disable their hinting and darkening.

* src/autofit/afshaper.c (af_shaper_get_coverage_hb): Seed default coverage
  with glyphs already assigned to the style and compute their substitution
  closure through the collected lookups.
  Keep the special feature coverages and their style precedence intact.

* src/autofit/ft-hb-decls.h: Add `hb_ot_layout_lookups_substitute_closure`.

* tests/issue-1441/*: New files, adding synthetic regression fonts covering
  shared lookups, both feature variation records, chained substitutions,
  ligatures, DFLT-only features, unreachable outputs, and preservation of
  the small-cap style.

The full Meson test suite passes with linked, dynamic, and disabled
HarfBuzz.  The regression fails before the fix.  Google Sans alternates
retain Latin styles and stem darkening after the fix.

Assisted-by: OpenAI Codex

Fixes issue #1441.
2026-10-08 06:14:26 +02:00
..

Shared GSUB lookup coverage regression

The two synthetic variable fonts have Latin cmap glyphs and GSUB lookups shared by cyrl and latn. One font also has Cyrillic cmap glyphs. The base rvrn feature is empty; its substitutions occur in two FeatureVariations records covering different parts of the weight axis.

The test verifies that Latin substitutes inherit the Latin base glyphs' style, including outputs from both variation records, a chained substitution, a ligature, and a feature registered only under DFLT. Cyrillic substitutes inherit the Cyrillic style only in the font with Cyrillic cmap glyphs. An unreachable substitution keeps its fallback style, and a dedicated small-cap style remains distinct from the default style. Loading the Latin substitutes must preserve their classification after blue-zone initialization.

Before the fix, the shared lookup outputs get claimed by Cyrillic, which is processed first. When the font has no Cyrillic blue-zone characters, metric initialization disables hinting for those outputs. This also disables stem darkening for glyphs such as Google Sans's G.BRACKET.18 and y.BRACKET.18, as reported in issue #1441.

make-fonts.py uses only Python's standard library and generates the fonts at build time. No external font or Python package is needed for this test. The test is enabled for linked or dynamically loaded HarfBuzz builds; dynamic builds skip it if no usable HarfBuzz library is available.

From the source root:

meson setup out -Dtests=enabled -Dharfbuzz=enabled
meson test -C out issue-1441 --print-errorlogs

Use -Dharfbuzz=dynamic to exercise the dynamic HarfBuzz bridge. The generator, driver, and generated data are provided under the FreeType project license, LICENSE.TXT.