Would it be possible to add a modifier key or option box to the Align Objects icons in Transformations so instead of aligning two or more objects, it would align only one selected object within the assigned width?
Not sure I understand. Can you give an example?
Sure. Suppose I want to center a glyph element (or even a complete glyph) horizontally on the glyph width I have already set.
Select something. Hold down a modifier key (Ctl/Cmd, Alt/Opt) and click on the Center Align (normally two objects) icon at the bottom of the Transformation panel.
This action would center the selection in the width.
Now I get it. Thx for clarifying
I think it’s an interesting idea to pack it into the UI. Do you need that often?
For horizontally centering complete glyphs, you can use a simple script:
for l in Glyphs.currentDocument.selectedLayers():
newLSB = ( l.LSB + l.RSB )//2
oldWidth = l.width
l.LSB = newLSB
l.width = oldWidth
print “Centered:”, l.parent.name
(Replace with actual tabs.)
Accents, math symbols, pi characters, that sort of thing. Depending upon the size of the font it could be quite a few uses. That’s the primary reason I thought it would be useful because over time, the time saved would add up.
I know I can select the entire component/glyph and simply enter the value of x to 50% of the width but that takes some mental math. I usually have no problem doing that, but there are some users who would find it more difficult.
Also, if the app does it, one is less likely to make a calculation mistake. So if it wouldn’t take an excessive amount of programming time, it is worth considering.
It could be resolved like in Illustrator. A select field with options:
a) align to selection
b) align to stage
or just checkbox “align to stage”
What would be the bounds of that stage?
LSB and RSB ok, but what would be top and bottom? Baseline and cap height? Or ascender and descender? And why?
I think I could write scripts for that and you could apply them with keyboard shortcuts if you need it often.
Alright, here we go:
- Download the Align scripts (or all scripts if you like).
- In Glyphs, choose Script > Open Scripts Folder: put the scripts there.
- Hold down Opt and choose Script > Reload Scripts
- Select a path or a few nodes in a glyph layer and run one of the Align scripts.
You can set a keyboard shortcut in System Preferences > Keyboard > Shortcuts > Application Shortcuts > Glyphs.
Rainer, thanks so much for the scripts. I’ll try them out today.
Version 1.3.19 (471) OS X 10.8.2
Hmm. I can’t get them to work for me. I tried the Horizontal Center and the RSB scripts, nothing happened.
Error: Nothing selected in frontmost layer?
name ‘Font’ is not defined
EDIT: Just fixed it. Re-download it from Github please.
Works now; thanks.
I added ‘Bump’ scripts: set a keyboard shortcut for them (like ctrl-cmd-arrows) and you can bump the selection to the next respective vertical or horizontal metric line.
You can find them in the Paths subdirectory: