applyTransform not working?

Hi,
Shouldn’t this work?

gf = Glyphs.font
glyph = gf.glyphs['question']
layer = glyph.layers[0]
shiftMatrix = [1, 0, 0, 1, 0, 60]
layer.applyTransform(shiftMatrix)

I get this traceback:

Traceback (most recent call last):
  File "<macro panel>", line 7
  File "GlyphsApp/GlyphsApp/__init__.py", line 8805, in __GSLayer_applyTransform__
ValueError: NSInvalidArgumentException - -[OC_BuiltinPythonArray transformPoint:]: unrecognized selector sent to instance 0x60000a6a2cc0

I expected this to work (shift y coordinate by 60 units), I can’t figure out what’s wrong in the code.

Thanks for your help.

shiftMatrix need to be a tuple, not a list

gf = Glyphs.font
glyph = gf.glyphs['question']
layer = glyph.layers[0]
shiftMatrix = (1, 0, 0, 1, 0, 60)
layer.applyTransform(shiftMatrix)

Uh, thanks!
Saw this in the docs:

layer.applyTransform([
    0.5, # x scale factor
    0.0, # x skew factor
    0.0, # y skew factor
    0.5, # y scale factor
    0.0, # x position
    0.0  # y position
])

So I got confused.

In fact it seems it doesn’t work neither:

gf = Glyphs.font
glyph = gf.glyphs['question']
layer = glyph.layers[0]
shiftMatrix = (1, 0, 0, 1, 0, 60)
layer.applyTransform(shiftMatrix)

It works, but you may not be looking at the right layer.
Are you sure you are looking at the first layer of the question glyph?

It should work with a list and a tuple. What version of Glyphs do you have? Do you get an error message?
And try if with this code to be sure that you are looking at the right layer:

shiftMatrix = [1, 0, 0, 1, 0, 60]
Layer.applyTransform(shiftMatrix)

Using latest Cutting Edge version: 3.2-3180

Whole test code:

gf = Glyphs.font
glyph = gf.glyphs['question']
layer = glyph.layers[0]
print(layer)
shiftMatrix = [1, 0, 0, 1, 0, 60]
layer.applyTransform(shiftMatrix)

Traceback (also in the first message):

<GSLayer "Regular" (question)>
Traceback (most recent call last):
  File "<macro panel>", line 6
  File "GlyphsApp/GlyphsApp/__init__.py", line 8805, in __GSLayer_applyTransform__
ValueError: NSInvalidArgumentException - -[OC_BuiltinPythonArray transformPoint:]: unrecognized selector sent to instance 0x60000425cb00

thanks

Can confirm, I’m getting the same error on 3.2 (3180). It works with no error on 3.1.2 (3151).

Yes, I saw that I fixed it right after I had uploaded 3180. Just uploaded 3181 that has what proper fix.