I’m sorry, I’ve been studying python applications these days, so I have many questions to ask, please forgive me.
I want to get the parameters of the Transformation matrix of the component, I want to use for calculations between parameters. I didn’t find a way to get these parameters.
layer = Glyphs.font.selectedLayers[0] # current layer
component = layer.components[3] # first component
# select component
layer.components[3].selected = True
# print selection state
print layer.components[3].selected,
print component.transform,
**scaleX = component.transform.scale.x,** # AttributeError: 'tuple' object has no attribute 'scale'
**skewX = component.transform.skew.x,**
**skewY = component.transform.skew.y,**
**scaleY = component.transform.scale.y,**
**positionX = component.transform.position.x,** # This is wrong
**positionY = component.transform.position.y,** # What can I do?
component.transform = ((
scaleX / 1.096, # x scale factor
skewX, # x skew factor
skewY, # y skew factor
scaleY / 1.725, # y scale factor
positionX - scalex * 6, # x position
positionY - scaley * 9 # y position
))
I have repeatedly read these two articles. But I didn’t find a way to express these six parameters.
I want to extract the original parameters for the calculation of the new parameters.
How can I assign the same back?
Could you give me a demonstration?
scaleX = component.transform.scale.x, # AttributeError: ‘tuple’ object has no attribute ‘scale’ skewX = component.transform.skew.x, skewY = component.transform.skew.y, scaleY = component.transform.scale.y, positionX = component.transform.position.x, # This is wrong positionY = component.transform.position.y, # What can I do?
component.transform = ((
scaleX / 1.096, # x scale factor
skewX, # x skew factor
skewY, # y skew factor
scaleY / 1.725, # y scale factor
positionX - scalex * 6, # x position
positionY - scaley * 9 # y position
))