Any plugin to center the glyph both vertically and horizontally

I know mekkablue’s plugin can center the whole glyph (all strokes as a group), but it actually can only center it horizontally within the square (or canvas)
This is what i need (pic attached)
Thanks.

1157a02db6631d28fcb2e0888d00bf3b98a90460

2 Likes

Modified the existing script and added vertical centring. Let me know if it works.
Center Glyphs X and Y.py.zip (1.1 KB)

1 Like

Gorgeous. thank you very much.

For stroke based glyph, your script is really handy, and it’s highly suggested to incoporate this into the APP control panel somewhere, one click will center all selected. Wonderful script. thanks you again. Tosche.

Maybe someone could make some kind of a script launcher; in the meantime, you can assign a keyboard shortcut :slight_smile:

Maybe someone already did :wink:

1 Like

What I do, rather than add another plugin to the panel or use up all the shortcut keys, is very simple yet effective.

In the Scripts folder, add a new folder, name it so it sorts at the top of the list, and add links to your most frequently used or favorite scripts in that folder. I also use this folder for scripts I may have modified so they don’t get overwritten by an update of the original script.

1 Like

You can also have Python scripts directly in the root of the Scripts folder – no drilling into submenus needed. Although I personally mostly use keyboard shortcuts.

1 Like

you rocks. This plugin is really sweet.

sadly, this script is no longer supported by the lastest version

Which script? The FastScripts plugin?

yes. the fastScripts plugin

FastScripts does work for me. Which software versions are you using?

  • Glyphs (GlyphsAbout Glyphs)
  • Python (GlyphsPreferencesAddons)
  • macOS (Apple Menu → About This Mac)

Thank you for your kind reply. It works now.
Days before, I upgraded the version to 3.0.5 (3110) and a popup message saying this scrip does not work and needs to be deleted. I have to click “OK” to uninstall it.
Just now, i installed it again. It works again. I don’t know what caused the problem.
Python: 3.9.7
Mac: 10.13.6

hello, recently, i got this for the new version When i try to center glyphs
[Glyphs 3.2 (3180) ] [Glyphs 3.2 (3179) ]
Any help,pls?

EOD charSetDict Ready
EOD idsDict{} Readed
EOD charSetDict Ready
EOD idsDict{} Readed

:warning: ‘Center Glyphs’ Script Error:

Traceback (most recent call last):
File “Center Glyphs X.py”, line 51
thisLayer.applyTransform( shiftMatrix )
File “GlyphsApp/GlyphsApp/init.py”, line 8800, in GSLayer_applyTransform
NameError: name ‘NSAffineTransformStruct’ is not defined

Traceback (most recent call last):
File “Center Glyphs X.py”, line 59
raise e
File “Center Glyphs X.py”, line 51
thisLayer.applyTransform( shiftMatrix )
File “GlyphsApp/GlyphsApp/init.py”, line 8800, in GSLayer_applyTransform
NameError: name ‘NSAffineTransformStruct’ is not defined

hello, recently, i got this for the new version When i try to center glyphs
[Glyphs 3.2 (3180) ] [Glyphs 3.2 (3179) ]
Any help,pls?

EOD charSetDict Ready
EOD idsDict{} Readed
EOD charSetDict Ready
EOD idsDict{} Readed

:warning: ‘Center Glyphs’ Script Error:

Traceback (most recent call last):
File “Center Glyphs X.py”, line 51
thisLayer.applyTransform( shiftMatrix )
File “GlyphsApp/GlyphsApp/init.py”, line 8800, in GSLayer_applyTransform
NameError: name ‘NSAffineTransformStruct’ is not defined

Traceback (most recent call last):
File “Center Glyphs X.py”, line 59
raise e
File “Center Glyphs X.py”, line 51
thisLayer.applyTransform( shiftMatrix )
File “GlyphsApp/GlyphsApp/init.py”, line 8800, in GSLayer_applyTransform
NameError: name ‘NSAffineTransformStruct’ is not defined

That error should be fixed in 3180.

This error still there in 3180, tested .

Can you test again in the latest release, 3181?

No error now, thanks