mekkablue / Glyphs-Scripts

Python scripts for the Glyphs font editor
http://glyphsapp.com/
Apache License 2.0
387 stars 103 forks source link

Anchor Mover doesn’t work for small-caps #334

Closed clauseggers closed 5 months ago

clauseggers commented 6 months ago

For some unknown reason the Anchor Mover doesn’t work for small-caps. I have small-caps set in the font info vertical metrics.

clauseggers commented 6 months ago

Today I got some error loggin at least

Processing 1 glyph...

🔠 i.smcp
ERROR: Failed to move anchor in i.smcp.
unsupported operand type(s) for /: 'NoneType' and 'int'
Traceback (most recent call last):
  File "Anchor Mover.py", line 214, in MoveCallback
    yMove = eval(evalCodeV) + vertical_change
            ^^^^^^^^^^^^^^^
  File "<macro panel>", line 1
TypeError: unsupported operand type(s) for /: 'NoneType' and 'int'

ERROR: Failed to move anchor in i.smcp.
unsupported operand type(s) for /: 'NoneType' and 'int'
Traceback (most recent call last):
  File "Anchor Mover.py", line 214, in MoveCallback
    yMove = eval(evalCodeV) + vertical_change
            ^^^^^^^^^^^^^^^
  File "<macro panel>", line 1
TypeError: unsupported operand type(s) for /: 'NoneType' and 'int'

ERROR: Failed to move anchor in i.smcp.
unsupported operand type(s) for /: 'NoneType' and 'int'
Traceback (most recent call last):
  File "Anchor Mover.py", line 214, in MoveCallback
    yMove = eval(evalCodeV) + vertical_change
            ^^^^^^^^^^^^^^^
  File "<macro panel>", line 1
TypeError: unsupported operand type(s) for /: 'NoneType' and 'int'

ERROR: Failed to move anchor in i.smcp.
unsupported operand type(s) for /: 'NoneType' and 'int'
Traceback (most recent call last):
  File "Anchor Mover.py", line 214, in MoveCallback
    yMove = eval(evalCodeV) + vertical_change
            ^^^^^^^^^^^^^^^
  File "<macro panel>", line 1
TypeError: unsupported operand type(s) for /: 'NoneType' and 'int'

ERROR: Failed to move anchor in i.smcp.
unsupported operand type(s) for /: 'NoneType' and 'int'
Traceback (most recent call last):
  File "Anchor Mover.py", line 214, in MoveCallback
    yMove = eval(evalCodeV) + vertical_change
            ^^^^^^^^^^^^^^^
  File "<macro panel>", line 1
TypeError: unsupported operand type(s) for /: 'NoneType' and 'int'

ERROR: Failed to move anchor in i.smcp.
unsupported operand type(s) for /: 'NoneType' and 'int'
Traceback (most recent call last):
  File "Anchor Mover.py", line 214, in MoveCallback
    yMove = eval(evalCodeV) + vertical_change
            ^^^^^^^^^^^^^^^
  File "<macro panel>", line 1
TypeError: unsupported operand type(s) for /: 'NoneType' and 'int'

Done.
clauseggers commented 6 months ago

Your code for deriving small-caps metrics is kaput. I have the value set in each master, and using other metrics in the script works fine.

Screenshot 2024-04-19 at 12 26 34
clauseggers commented 6 months ago

Caught it on video. I’ve attached the video and the state of the Glyphs file.

https://github.com/mekkablue/Glyphs-Scripts/assets/868987/41d7b760-0926-412a-8553-a913a5afc64d

Playfair-2_2-Roman 9.glyphs.zip

clauseggers commented 6 months ago

I think I just spotted the reason. The glyph in question is not named *.smcp and this ‘breaks’ your script. It works fine in glyphs named *.smcp. I’ll rename my components.

clauseggers commented 6 months ago

It gets stranger. The Italic component glyph does have the small-caps metrics displayed in the edit window, whereas the Roman for some unknown reason does not.

Screenshot 2024-04-26 at 10 59 21 Screenshot 2024-04-26 at 10 59 52
schriftgestalt commented 6 months ago

Can you click on the "Smallcaps" and screenshot the resulting dialog?

clauseggers commented 6 months ago

Oh, that is new to me. They are different, but what should the correct settings be?

Screenshot 2024-04-26 at 11 22 54 Screenshot 2024-04-26 at 11 22 37
mekkablue commented 5 months ago

I removed the small cap option from the code for now, it is not compatible with G3+. Will need to rewrite with a metrics scan of the file.