Robofab's glyph.move

Hi, I’m trying this:

from robofab.world import CurrentFont
f = CurrentFont()
g = f['acute']
g.move((100, 100))

And get this traceback: AttributeError: 'GSAnchor' object has no attribute 'move'. Is it possible to move a glyph and its anchor(s) using Robofab?
thanks!

I haven’t done anything in Robofab in years. Maybe it has to do with the glyph/layer distinction?

No idea. It moves the outline and/or composite but not tha associated anchor.
(trying to make short code and cross-app)

Could be a bug in the implementation. Is there a reason why you have to use Robofab or can you use the regular API as well?

Just trying to make code as shorter and compatible as possible. I’ll try the API then, thanks for replying.

BTW, do you have plans to support fontParts?

You are the first to mention it to me.

Edit: Couldn’t in the previous post was autocorrect, should read Could. Fixed now, sorry for confusion.

I fixed the roboFab wrapper. It will move anchors now.

I was at the meeting in New York last year when FontParts was introduced. It is quite similar to robofab. I have to admit that I didn’t look into it since then. You are happy to help, all needed parts are in GitHub :wink:

2 Likes

Thanks for fixing this Georg.
For updating it, I substituted ‘objectsGS.py’ in App Support/Glyphs/Scripts folder, it works, great! Will it be updated in next cutting-edge version? (I’m thinking in average users not dealing with this stuff).
Yes, fontParts is an update/replacement to the good old Robofab API (dealing with ufo3, etc).
:+1:

Robofab is not supported by the app itself. It has to be installed and updated manually.

Of course. But what needs to be updated is only ObjectsGS.py, right? (at least it works for me)

Hi,

I was testing some .ufo files in Glyphs and this discussion came to my mind. I was wondering how is fontParts’ support going . Is there any way that I could import it in Glyphs while working with .ufo files?

Thanks,
Ricard.

I tried to work on FontParts a few times. The mismatch of the master/layer structure held me up. If you are interested, I can give you a hand in helping out with the implementation.

But the extensions that use FontParts that I ported over as a glyphs plugin where fine with the roboFab wrapper.

And what kind of things do you like to do with the ufos? Have you tried the Glyphs scripting API? :wink:

1 Like

Hi Georg, thanks for your answer.

If you are interested, I can give you a hand in helping out with the implementation.

That would be great. Sometimes I’ve worked with .ufo files and I was thinking about taking advantage of FontParts.

And what kind of things do you like to do with the ufos? Have you tried the Glyphs scripting API?

Of course, yes! It is very helpful and I’ve already written some scripts and a plugin using GLyphs’ API. The only thing I was wondering if, inside Glyphs and with a .ufo file I could still use Glyphs’ API.

Thanks again.

inside Glyphs, there is only one data structure/API. It doesn’t matter if you opened a .glyphs or a .ufo. That is the main challenge when implementing FontParts.
To have support for FontParts is only useful to be able to use scripts in different apps. But if you only need them in Glyphs, use the native API.

1 Like

I see, so there isn’t a way to import it just like I can do with robofab.world, then?

You mean to import FontParts? No, FontParts is only a protocol that has to be implemented from scratch in each environment.