Skip to content

Comments

Fix smart components not decomposed at default location#1894

Merged
anthrotype merged 2 commits intomainfrom
fix-smart-component-default-location
Feb 17, 2026
Merged

Fix smart components not decomposed at default location#1894
anthrotype merged 2 commits intomainfrom
fix-smart-component-default-location

Conversation

@anthrotype
Copy link
Member

  • Add failing regression test for smart components with empty smart_component_values
  • Fix by checking the referenced glyph's smart_component_axes instead of the component's values
  • Rename as_smart_component() to as_component() since it's now a plain enum accessor (like the existing as_path).

Port of googlefonts/glyphsLib#1135

Fixes #1893

When a smart component is newly placed without adjusting any slider,
Glyphs.app omits the 'piece' attribute, so smart_component_values is
empty. fontc currently panics on the assert in instantiate_for_layer.

Regression test for googlefonts/glyphsLib#1134
When a smart component is newly placed without adjusting any slider,
Glyphs.app doesn't store the 'piece' attribute, so smart_component_values
is empty. The check on non-empty values short-circuited and skipped
decomposition entirely.

Fix by checking the referenced glyph's smart_component_axes as the
primary indicator that a component is smart, and default to the axis
default value when smart_component_values doesn't specify one.

Also rename as_smart_component() to as_component() since it's now a
plain enum accessor (matching the existing as_path() pattern), with
the smartness determination at the call site.

Port of googlefonts/glyphsLib#1135
Fixes #1893
@anthrotype
Copy link
Member Author

https://github.com/googlefonts/fontc/actions/runs/22106385935/job/63890221910?pr=1894#step:6:342

thread 'font::tests::instantiate_smart_component_at_default_empty_values' (5155) panicked at glyphs-reader/src/smart_components.rs:58:5:
assertion failed: !component.smart_component_values.is_empty()

@anthrotype anthrotype requested a review from cmyr February 17, 2026 16:24
@anthrotype anthrotype added this pull request to the merge queue Feb 17, 2026
Merged via the queue into main with commit ea38a3e Feb 17, 2026
13 checks passed
@anthrotype anthrotype deleted the fix-smart-component-default-location branch February 17, 2026 16:50
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.

Smart components not decomposed when newly placed at default location

2 participants