Skip to content

[glyphs] maintain start point when reversing closed path#1956

Merged
cmyr merged 1 commit intomainfrom
glyphs-smartcomp-flip-winding
Apr 15, 2026
Merged

[glyphs] maintain start point when reversing closed path#1956
cmyr merged 1 commit intomainfrom
glyphs-smartcomp-flip-winding

Conversation

@cmyr
Copy link
Copy Markdown
Member

@cmyr cmyr commented Apr 15, 2026

This is a small detail on a very cold code path, but still is the cause of at least one crater diff.

Concretely, when a smart component is flipped (via transform) we reverse the path; however our reversal logic was naive, and didn't keep the same start point.

@cmyr cmyr force-pushed the glyphs-smartcomp-flip-winding branch 3 times, most recently from b681ced to 5abe684 Compare April 15, 2026 03:23
Comment thread glyphs-reader/src/font.rs
/// `reverse() + rotate_left(1)`, which keeps the start node at the last
/// position. We match that here.
///
/// Note: this logic is only correct for closed paths. For open paths the
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

so can't this logic only be applied for closed paths?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

see the note: do we want to fix this in glyphsLib? The codepath seems to only be exercised with closed paths at present, but it does seem like a bug.

I'll open an issue here and then can open a companion issue in glyphsLib.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

yeah i think it's worth fixing in both. and if you say it's currently only exercised for closed paths, you can just do it now in fontc without affecting the crater results

Copy link
Copy Markdown
Member Author

@cmyr cmyr Apr 15, 2026

Choose a reason for hiding this comment

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

Comment thread glyphs-reader/src/font.rs Outdated
This is a small detail on a very cold code path, but still is the cause
of at least one crater diff.

Concretely, when a smart component is flipped (via transform) we reverse
the path; however our reversal logic was naive, and didn't keep the same
start point.
@cmyr cmyr force-pushed the glyphs-smartcomp-flip-winding branch from 5abe684 to ab68707 Compare April 15, 2026 14:36
@cmyr cmyr added this pull request to the merge queue Apr 15, 2026
Merged via the queue into main with commit a7d06fd Apr 15, 2026
13 checks passed
@cmyr cmyr deleted the glyphs-smartcomp-flip-winding branch April 15, 2026 15:16
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