Plugin not showing up

Hello, yesterday I was really excited to publish my first plugin, Show HT Letterspacer Areas. It works great for me, and I added it to the Plugin Manager, where it is installable. So I installed it from there, as did some other people, but it is not showing up for anybody else. I had quite a long talk with Rainer, who also couldn’t find anything wrong with my (quite simple) code and setup. Can anybody help me find out what I’m missing in my code? Is it showing up for anybody else? Thanks!

For me, it works when replacing the alias in the Plugins folder with the plugin bundle from the Repositories folder. Not sure why. Also, the dependencies RoboFab, Vanilla and FontTools need to be installed for the plugin to run. These can be specified in the packages index plist file as dependencies of the plugin so that they get installed automatically alongside the plugin. Also, the HT Letterspacer scripts need to be installed. (Not sure if that can be specified as a dependency.) And the selected Python in the app preferences needs to be the one from the Plugin Manager (Glyphs) and not any other Python version (as far as I can tell). Again, not sure why.

There was a typo in the packages definition. The file extension is case sensitive. I fixed that.

And I had a look at the plugin code and also the letters pacer script. I could remove the dependency to robofab. The plugin was calling a method (engine.set_space()) that doesn’t seem to exist. I changed it to engine.spaceMain() and that works.

Can you add me to the plugin repo that I can push the changes?

And the plugin needs to cache the areas, otherwise it is WAY to slow.

1 Like

Hello, the calling the space_main() method will actually apply the calculated spacing to the glyph. This is not what I want. The class HTLetterSpacerLib() has a method set_space() which returns the calculated polygons, which is what I need for my plugin.

I added you to the repo.

I checked the code on the HT Letterspacer repo. Indeed set_space does not exist, it is called setSpace. I must have renamed it (to conform with PEP) when I added the functionality for all masters.

Then you need to move that method into the plugin.

I pushed my changes for now because that makes the plugin work at least.

Feel free to push your changes, with the method name corrected to setSpace.

I will update the method names in my fork to be congruent with the original.


I pushed it. Can you have a look and check if it makes sense?

Yes, thanks. I changed the method in my fork to setSpace and renamed it accordingly in my plugin. If you have the time, could you explain how I can cache the areas? I don’t really know what that means.

Now you call setSpace() for each glyph for each redraw. You should store the “polygons” for each layer (probably in layer.tempData) to be able to reuse it. Also store GSGlyph.lastChange and query it to know when the glyph has changed so you can setSpace() again and update the polygons.

I even almost understood all of that :slight_smile: Thanks! I will try to implement this.

1 Like

Hello, I am trying to update the drawing only when necessary, and I’m getting quite far, but I also want to update it when the custom parameters in the current master get changed. I wrote a function that builds a dict from the current master’s CPs and then I compare those values against the current values. So far, so simple, but of course I can’t build this dict before a document is opened. So I’m trying to use DOCUMENTOPENED to trigger this function. But where do I write Glyphs.removeCallback(my_func, DOCUMENTOPENED)?

If there is a different solution, I’d also appreciate it, of course. Thanks!

Why the opening state is concerned. Just do it the first time the draw callback is called?

Yes, that’s what I then thought of doing, too :sweat_smile: Thanks!