Have you tried this?
print "before", f['A'].leftMargin
f['A'].leftMargin = f['A'].leftMargin -20
print "after", f['A'].leftMargin
Hi all,
Is it possible to use RoboFab control the sidebearing of glyphs.
I was thinking something like this might work.
This code just prints the sidebearing - 20, what I really wanted to do is decrease the left sidebearing by 20.
from robofab.world import CurrentFont
f = CurrentFont()
A = f['A'].leftMargin
A-=20
print A
f.update()
Have you tried this?
print "before", f['A'].leftMargin
f['A'].leftMargin = f['A'].leftMargin -20
print "after", f['A'].leftMargin
That's easy to do in Font Lab also. Select the glyphs you want to change, and then go to: actions/metrics/set side bearings.
k.l.
Thanks that worked, still getting to grips with the RoboFab syntax
I think I was trying to do this with my first attempt.
from robofab.world import CurrentFont
f = CurrentFont()
f['A'].leftMargin -=20
f.update()
How can I do the same, but using the 'measurement line'?
I mean: To measures the distance from, let say, the middle of the x-height instead if the first left point.
Pablo, have a look at the marginPen module in RoboFab/pens. It will calculate the margins of a glyph at a requested height (or width)
Erik, thanks!
marginPen is awesome.
I'm working on a spacing macro, will release it shortly.
Captured from commoncrawl.org on 21 Apr 2015. original URL