RoboFab Sidebearings Script ?

Primary tabs

7 posts / 0 new
Last post
Rachel Roberts's picture
Offline
Joined: 21 Feb 2007 - 12:23pm
RoboFab Sidebearings Script ?
0

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()

Karsten Luecke's picture
Offline
Joined: 6 Aug 2005 - 8:41am
0

Have you tried this?

print "before", f['A'].leftMargin
f['A'].leftMargin = f['A'].leftMargin -20
print "after", f['A'].leftMargin

William Berkson's picture
Offline
Joined: 26 Feb 2003 - 11:00am
0

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.

Rachel Roberts's picture
Offline
Joined: 21 Feb 2007 - 12:23pm
0

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()

Pablo Impallari's picture
Offline
Joined: 1 Feb 2010 - 1:12am
0

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.

Erik van Blokland's picture
Joined: 18 Dec 2002 - 9:53am
0

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)

link to marginPen.py on code.robofab.com

Pablo Impallari's picture
Offline
Joined: 1 Feb 2010 - 1:12am
0

Erik, thanks!
marginPen is awesome.

I'm working on a spacing macro, will release it shortly.