AppendAnchor

19 views
Skip to first unread message

bern...@this-makes-me-happy.com

unread,
Sep 3, 2013, 11:40:49 AM9/3/13
to rob...@googlegroups.com
Hello all,

I'm trying to use the AppendAnchor command but I'm not sure I'm using it correctly. Bellow is my script running on Glyphs (I did all the import lines to see if my issue was a lack of modules, but in theory Glyphs should only require the first import):


--------------------------------------------------------------------------------
from objectsGS import *
from robofab.world import CurrentFont
from robofab.world import CurrentGlyph
from robofab.world import RFWorld
#f = CurrentFont()
#for g in f.selection:
# print g.anchors
# #appendAnchor("TOP", (525, g.width/2)
f = CurrentFont()
c = CurrentFont().selection
#print Glyphs.fonts
for g in c:

#print f[g]

#print len(f[g].anchors)

if len(f[g].anchors) == 0:

print f[g].name

print f[g].width

pt = (525, f[g].width/2)

f[g].appendAnchor("TOP", (100, 525))
--------------------------------------

I get the following output:

zero
656.0
Traceback (most recent call last):
  File "<string>", line 27, in <module>
  File "/Library/Python/2.6/site-packages/robofab/objectsGS.py", line 785, in appendAnchor
    new = NewAnchor(name=name, pt=position )
NameError: global name 'NewAnchor' is not defined



I guess I'm not giving the position in the right format, but the RoboFab specification only states "appendAnchor(name, position)", so I'm not sure how to indicate it. Ultimately I'd want to center the anchor horizontally so rather than 100 I would use f[g].width/2 (as in the previous line). Can someone help me figure out how to use the appendAnchor command?

Thanks,
Bernardo

Miguel Sousa

unread,
Sep 3, 2013, 2:07:21 PM9/3/13
to rob...@googlegroups.com
It seems like the issue is with objectsGS.py. Do you have the latest version installed?

M.

Georg Seifert

unread,
Sep 3, 2013, 2:30:47 PM9/3/13
to rob...@googlegroups.com
This is a error in the objectsGS.py. I fixed it. Please update the script.

Thanks for finding this.

Georg

--
--
You received this message because you are subscribed to the Google Groups "RoboFab" group.
To post to this group, send email to rob...@googlegroups.com
To unsubscribe from this group, send email to robofab-u...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/robofab?hl=en
 
Messages from newly joined members are subject to moderation.
Download RoboFab and documentation at http://robofab.com
---
You received this message because you are subscribed to the Google Groups "RoboFab" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robofab+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Georg Seifert

unread,
Sep 3, 2013, 2:50:11 PM9/3/13
to rob...@googlegroups.com
By the way. if you have the latest version of robofab, you do not need the first line. 

Best
Georg 

On 03.09.2013, at 17:40, bern...@this-makes-me-happy.com wrote:

Reply all
Reply to author
Forward
0 new messages