[transform] Change the DecomposedTransform skewX sign to match Transform
Unfortunate but for consistency's sake. This deviates from VarComposite convention. https://github.com/fonttools/fonttools/pull/2958#issuecomment-1416155600
This commit is contained in:
parent
c0d100f7e8
commit
8e981a1b28
@ -418,7 +418,7 @@ class DecomposedTransform:
|
||||
rotation: float = 0 # in degrees, counter-clockwise
|
||||
scaleX: float = 1
|
||||
scaleY: float = 1
|
||||
skewX: float = 0 # in degrees, counter-clockwise
|
||||
skewX: float = 0 # in degrees, clockwise
|
||||
skewY: float = 0 # in degrees, counter-clockwise
|
||||
tCenterX: float = 0
|
||||
tCenterY: float = 0
|
||||
@ -455,7 +455,7 @@ class DecomposedTransform:
|
||||
math.degrees(rotation),
|
||||
scaleX,
|
||||
scaleY,
|
||||
-math.degrees(skewX),
|
||||
math.degrees(skewX),
|
||||
math.degrees(skewY),
|
||||
0,
|
||||
0,
|
||||
@ -475,7 +475,7 @@ class DecomposedTransform:
|
||||
)
|
||||
t = t.rotate(math.radians(self.rotation))
|
||||
t = t.scale(self.scaleX, self.scaleY)
|
||||
t = t.skew(-math.radians(self.skewX), math.radians(self.skewY))
|
||||
t = t.skew(math.radians(self.skewX), math.radians(self.skewY))
|
||||
t = t.translate(-self.tCenterX, -self.tCenterY)
|
||||
return t
|
||||
|
||||
|
@ -1734,7 +1734,7 @@ VAR_COMPONENT_TRANSFORM_MAPPING = {
|
||||
VarComponentFlags.HAVE_SCALE_Y, 10, 1, 1
|
||||
),
|
||||
"skewX": VarComponentTransformMappingValues(
|
||||
VarComponentFlags.HAVE_SKEW_X, 12, 180, 0
|
||||
VarComponentFlags.HAVE_SKEW_X, 12, -180, 0
|
||||
),
|
||||
"skewY": VarComponentTransformMappingValues(
|
||||
VarComponentFlags.HAVE_SKEW_Y, 12, 180, 0
|
||||
@ -1988,7 +1988,7 @@ class GlyphVarComponent(object):
|
||||
controls.append("skew")
|
||||
coords.append(
|
||||
(
|
||||
fl2fi(self.transform.skewX / 180, 12),
|
||||
fl2fi(self.transform.skewX / -180, 12),
|
||||
fl2fi(self.transform.skewY / 180, 12),
|
||||
)
|
||||
)
|
||||
@ -2027,7 +2027,7 @@ class GlyphVarComponent(object):
|
||||
i += 1
|
||||
if self.flags & (VarComponentFlags.HAVE_SKEW_X | VarComponentFlags.HAVE_SKEW_Y):
|
||||
self.transform.skewX, self.transform.skewY = (
|
||||
fi2fl(coords[i][0], 12) * 180,
|
||||
fi2fl(coords[i][0], 12) * -180,
|
||||
fi2fl(coords[i][1], 12) * 180,
|
||||
)
|
||||
i += 1
|
||||
|
Loading…
x
Reference in New Issue
Block a user