I had this function to only skew anchors and paths, but I’d like to use it now just for simply x, y transformation (I use this when I am applying a font wide spacing change, and then instead of manually adjusting the component+path glyphs, I’d like to reverse shift the path and anchors):
def slantLayers(self, selectedLayers, skewAngle):
xHeight = selectedLayers[0].associatedFontMaster().xHeight
transform = NSAffineTransform.new()
slant = math.tan(skewAngle * math.pi / 180.0)
transform.shearXBy_atCenter_(slant, -xHeight / 2.0)
Font.disableUpdateInterface()
for layer in selectedLayers:
for path in layer.paths:
for node in path.nodes:
node.position = transform.transformPoint_(node.position)
for anchor in layer.anchors:
anchor.position = transform.transformPoint_(anchor.position)
Font.enableUpdateInterface()
What’s the transform function that would let me simply transform x, y?