Created
April 24, 2015 11:42
-
-
Save marcdama/293fc951af918951682a to your computer and use it in GitHub Desktop.
FL: for selected glyphs: Center glyph vertically, according to specified box
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from robofab.world import * | |
| f = CurrentFont() | |
| top = 880 | |
| bottom = -120 | |
| for i in f.selection: | |
| glyf_h = f[i].box[3]- f[i].box[1] | |
| t_s = top - f[i].box[3] #distance from top of bbox | |
| b_s = f[i].box[1] - bottom #distance from bottom of bbox | |
| base = (t_s - top) + glyf_h + bottom | |
| f[i].move((0,base)) #move glyph to baselines | |
| f[i].move((0,(t_s + b_s)/2)) #center glyph to box | |
| f.update() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment