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

remove glyphsLib.affine, use fontTools.misc.transform instead #854

Merged
merged 2 commits into from
Jan 30, 2023

Conversation

anthrotype
Copy link
Member

Fixes #257

The glyphsLib.affine module has different copyright/license and is not actually needed because we already depend on fontTools which has an equivalent module for affine transforms. This removes that and replaces it with fontTools Transform.

The existing tests still pass. Let me know if you want me to add additional tests.

Fixes #257

The glyphsLib.affine module has different copyright/license and is not actually needed because we already depend on fontTools which has an equivalent module for affine transforms. This removes that and replaces it with fontTools Transform.
this is to fix regression tests spuriously flagging things like:

     <contour>
-      <point x=50 y=784 type=line/>
-      <point x=950 y=784 type=line/>
-      <point x=950 y=826 type=line/>
-      <point x=50 y=826 type=line/>
+      <point x=50.0 y=784.0 type=line/>
+      <point x=950.0 y=784.0 type=line/>
+      <point x=950.0 y=826.0 type=line/>
+      <point x=50.0 y=826.0 type=line/>
     </contour>

https://github.com/googlefonts/glyphsLib/actions/runs/4025928471/jobs/6919775408
@anthrotype
Copy link
Member Author

ugh.. I really don't understand why the regression tests keep failing with spurious diffs where integers are turned to floats e.g. 575 => 575.0:

-      <point x="575" y="524" type="line"/>
+      <point x="575.0" y="524.0" type="line"/>

Any help appreciated. I give up for today...

@anthrotype
Copy link
Member Author

oh shoot, I misundestood the unified diff output. Confusingly enough, the minus-prefixed lines in the regression tests diffs are the newly generated files, whereas the plus-prefixed lines are the regression tests' reference files. I was expecting the opposite, i.e. reference or expected files on the left (---) and actual generated files on the right (+++).
So with this patch, nodes that previously would be turned to all floats after a transform was applied, are now kept as integers if the transform simply translates them by some integer amount without scaling them, which is ok. So the regression tests diffs look good.

@anthrotype
Copy link
Member Author

thanks guys

@anthrotype anthrotype merged commit f0ad221 into main Jan 30, 2023
@anthrotype anthrotype deleted the remove-affine-package branch January 30, 2023 13:48
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.

glyphsLib.affine module vs fontTools.misc.transform?
3 participants