Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Normalize the order of glyf contours #1108

Merged
merged 1 commit into from
Nov 13, 2024
Merged

Normalize the order of glyf contours #1108

merged 1 commit into from
Nov 13, 2024

Conversation

rsheeter
Copy link
Contributor

Fixes #1107

Arizonia, and hopefully more, now ttx_diff equivalent.

Copy link
Member

@cmyr cmyr left a comment

Choose a reason for hiding this comment

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

cool this looks painless, and i'm very curious to see how many fonts are affected.

@@ -755,7 +773,7 @@ def main(argv):
root = Path(".").resolve()
if root.name != "fontc":
sys.exit("Expected to be at the root of fontc")

Copy link
Member

Choose a reason for hiding this comment

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

noise?

contours = glyph.xpath("./contour")
if len(contours) < 2:
continue
normalized = sorted(contours, key=lambda c: etree.tostring(c))
Copy link
Member

Choose a reason for hiding this comment

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

do we even need to tostring? not sure how expensive it is, but all we need is some total order, can we get that from c itself?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It wasn't entirely clear to me what that would do whereas tostring is simple to reason about

@rsheeter rsheeter added this pull request to the merge queue Nov 13, 2024
Merged via the queue into main with commit cfe2525 Nov 13, 2024
10 checks passed
@rsheeter rsheeter deleted the contours branch November 13, 2024 21:12
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.

Contour order may not match fontmake
2 participants