Steven
June 1, 2020, 3:47pm
#1
About the x skew factor of applyTransform function.
Does it equal to the angle I need? or what ? But I find the result is wrong if I input the angle value directly.

For example, if I want to let it skew 60°, what is the value of x/y skew factor?

My version is 2.6.5(1329)
Thanks.

Which text editor are you using for coding?

See the transform snippet in the Python for Glyphs repository:

The skewing uses an angle. But that only is what you expect for 10–20°. With bigger angles, it behaves strange. That is not a bug, just how the math for skewing works.

Steven
June 2, 2020, 12:20am
#4
But I think it runs wrong, my macro script as below:
'"
thisLayer = Glyphs.font.glyphs[‘X000’].layers[0]

thisLayer.applyTransform((
1.0, # x scale factor
1.0, # x skew factor
0.0, # y skew factor
1.0, # y scale factor
0, # x position
0 # y postion
))
"’

I found 2 questions:
1.The x skew factor value is 1.0, but it changed so big if it’s angle.I think the result is wrong.
2.The x skew and y skew factor is reversed.

Please.

Yes. The second figure is the y shear and the third figure the x shear. Did I write that wrong somewhere?

Steven
June 2, 2020, 9:46am
#6
Now the description is wrong in https://docu.glyphsapp.com/ .
And can you help to check the first question?

It is more complicated than that. If you want to read up on how the value matrix works:

In Euclidean geometry, an affine transformation or affinity (from the Latin, affinis, "connected with") is a geometric transformation that preserves lines and parallelism, but not necessarily Euclidean distances and angles.
More generally, an affine transformation is an automorphism of an affine space (Euclidean spaces are specific affine spaces), that is, a function which maps an affine space onto itself while preserving both the dimension of any affine subspaces (meaning that it sends points t...

And specifically about shearing (skewing):

In mathematics, a shear matrix or transvection is an elementary matrix that represents the addition of a multiple of one row or column to another. Such a matrix may be derived by taking the identity matrix and replacing one of the zero elements with a non-zero value.
The name shear reflects the fact that the matrix represents a shear transformation. Geometrically, such a transformation takes pairs of points in a vector space that are purely axially separated along the axis whose row in the matri...

Technically, it is the tangens of the angle:

```
import math
skewAngle = 10 # in degrees
xSkew = math.tan(math.radians(skewAngle))
matrix = (1, 0, xSkew, 1, 0, 0)
```

1 Like