I have written a script to try to get around the problem explained here:
The script works when it is run manually before exporting the file. But, in order to make the workflow more efficient, I would like to be able to set it as an export filter/plugin and be able to forget about it. But, when I put the same code in the plugin, the double accents shift to the right:
(Note that the /brevecomb should be centred on the apex of the A)
Thanks @mekkablue, running as a PreFilter seems to have solved the problem.
Here is the code, perhaps others will also find it useful.
from GlyphsApp.plugins import *
class RemoveNestedComponents(FilterWithoutDialog):
def settings(self):
self.menuName = 'Remove Nested Components'
def filter(self, layer, inEditView, customParameters):
loop = True
while loop:
loop = False
#layer.alignComponents() has no effect
for c in layer.components:
cg = c.component # GSGlyph of component
# now we check whether this component contains one or more components
if len (cg.layers[layer.layerId].components) > 0:
print("decomposing component %s"%c)
c.automaticAlignment = False
c.decompose()
loop = True
break
Hi there, I have a similar Problem with a Glyphs3 plugin port.
I used to use the alignComponents method on a layer before, in order to live update the recyclers when an Anchor is moved.
This method doesn’t exist in Glyphs 3 anymore. Hence I made a category on GSLayer to keep my legacy code as is. unfortunately, none of the attempts to force alignment on the layer doesn’t do anything. Here’s my category method with all the things I tried:
- (void)alignComponents {
for (id shape in self.shapes) {
if ([shape isKindOfClass:GSComponent.class]) {
GSComponent *c = shape;
// [c setAlignment:YES];
[c setAlignment:GSAlignmentAligned]; // or `GSAlignmentForce` ?
// [c makeForceAlignment];
[c setIsAligned:GSAlignmentAligned]; // or `GSAlignmentForce` ?
[c.componentLayer setIsAligning:YES];
//[c.componentLayer setNeedUpdateShapes];
}
}
}
Note: the layer I called the alignComponents on is a copy of course.
This actually fixed it, but seems to be more of a hack than a proper solution:
The compiler doesn’t complain anymore about the missing method, and the behaviour is back as expected. However, the compiler should not complain, the alignComponents method is documented in the Glyphs3 docu core
The layer alignment is moved to its own file: GSLayer+AlignComponents.h. You need to import that. and if you are sure that you like to align, use the doAlignComponents method.
Unfortunate the search does not show anything (I tried that of course )
The headers are also not showing anymore to me. I usually drag in the Glyphs 3 framework from the GlyphsApp package contents when upgrading a Plugin to G3. I have “Copy if needed” checked, because sometimes it moved the framework instead of copying and then my GlyphsApp was broken :D). However, this is how the Framework looks in Xcode then. it works fine, but I have no access to the header files directly anymore.
Now I tried exactly like that (once more) and what happened was:
I had 2 of those framework iconed GlyphsCore.framework packs listed.
When I deleted the newly created one again, I also saw it being deleted from the GlyphsApp Package Content Folder right away (which means that this app is corrupt now, what happened to me before, but unnoticed by me).
So for some reason it doesn’t work here. I still got the framework and can build the plugins, I just cannot access the headers (as I could some time ago and seen on your screenshot).