Can anybody help me with a RoboFab script?

rui abreu's picture

I'm tying to make a small script with robafab far a multiple master Font.
Basically my script will move a component inside a diacritic glyph.

For intance moving the "acute" accent inside "oacute".
This is the script:
____________

from robofab.world import CurrentFont
f = CurrentFont()

g = f["oacute"]
g.components[1].move((-100,-100))
____________

The problem is:
Since my font is a multiple master with two weight masters, when I run this script, it moves the accent in the both masters.

Is there any way to move the accent only in one of the masters?

Thanks in advanced.

pvanderlaan's picture

As far as I know, RoboFab is not able to deal with individual instances in a multiple master file. You might be able to achieve your goal by using FontLab’s native Python implementation instead.

Otherwise, why not use anchors for placing accents? If done correctly it will save you the hassle of dealing with individual accented glyphs.

-Paul van der Laan
www.type-invaders.com

rui abreu's picture

Yes I think it is not possible to deal with individual instances with Robofab.

I've never used ancors, but I check it out and it seems great. Thanks for the sugestion, this was something I didn't know.

Anton_TF's picture

Hello,

Couple of years too late, but maybe can help someone.
It is possible to move component inside MM font. I made those based on typical fontlab scripts. Karsten Lucke have some nice MM helpers.

Here comes code, dont forget indetation in the "for loop" and if/else.

PS. Does someone have a good method how to "append" a component inside MM fglyph?
I've tried many methods, but so far no luck.
Anton
#--------------------------------------------------

#FLM: Move MM compnt 1
# made by AK 2010
# to move component in single master

from FL import *
from robofab.world import CurrentGlyph
rfg = CurrentGlyph()

g = fl.glyph
m = fl.master

# here specify amount and what to move
xmov = -50
# first identify FL component index! Name wont work.
compnt = 14

print "master:", m

for n in g.components:
if n.index == compnt:
print "there is specific compnt to move"
n.deltas[m].x += xmov
else:
print "use compo tester to get to know:"

fl.UpdateGlyph()
print "manipul in action"

'''
##
'''

Syndicate content Syndicate content