Skip to content

Comments

Preserve explicit anchors during smart component instantiation#1892

Merged
anthrotype merged 2 commits intomainfrom
fix-smart-components-explicit-anchors
Feb 16, 2026
Merged

Preserve explicit anchors during smart component instantiation#1892
anthrotype merged 2 commits intomainfrom
fix-smart-components-explicit-anchors

Conversation

@anthrotype
Copy link
Member

When a glyph uses smart components and also has its own explicit anchors, the smart component's interpolated anchors should not override them. The glyph's explicit anchors represent the designer's intent and take precedence over anchors propagated from smart component parts. This is consistent with similar logic in propagate_anchors.rs.

This PR fixes anchor position regressions in fonts like NotoSansNandinagari where Indic conjuncts (e.g. KaCa.Nnagari) had hand-placed anchors that were incorrectly being replaced by interpolated smart component values.

I first push a failing regression test smart_component_preserves_explicit_anchors with dedicated test fixture, then follow up with the actual fix.

Verified against NotoSansNandinagari: mark/kern goes from 99.240% to identical with fontmake (glyphsLib 6.12.7)

When a glyph uses smart components and also has its own explicit anchors
with the same name, the smart component's interpolated anchors should not
replace the glyph's explicit ones. This test currently fails.
@anthrotype anthrotype force-pushed the fix-smart-components-explicit-anchors branch from e1b0866 to e4c5cb2 Compare February 16, 2026 18:42
Smart component anchor interpolation was unconditionally replacing the
parent glyph's explicit anchors with interpolated values from the smart
component parts. Now the glyph's own anchors take precedence, and smart
component anchors are only added when no explicit anchor with that name
exists.

Fixes #1892
@anthrotype
Copy link
Member Author

test fails as expected

https://github.com/googlefonts/fontc/actions/runs/22074119486/job/63785379035?pr=1892#step:6:344

Diff < left / right > :
 Some(
     (
<        250.0,
<        600.0,
>        300.0,
>        700.0,
     ),
 )

Copy link
Contributor

@rsheeter rsheeter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Appreciate the test comments!

@anthrotype anthrotype added this pull request to the merge queue Feb 16, 2026
Merged via the queue into main with commit db13aec Feb 16, 2026
13 checks passed
@anthrotype anthrotype deleted the fix-smart-components-explicit-anchors branch February 16, 2026 19:05
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.

2 participants