New GSSVGtoPath in 3.2 (3198)

Since the update with the “Fix SVG import” entry about 2 weeks ago, SVG import has been completely broken. A fairly standard script (that worked prior to the fix)

OutlineImporter = GSSVGtoPath.alloc().init()
layer = glyph.layers[font.selectedFontMaster.id]
OutlineImporter.readFile_toLayer_error_(fileURL, layer, None)

now reports

AttributeError: 'GSSVGtoPath' object has no attribute 'readFile_toLayer_error_'

Maybe the method name changed. You can search for the new method name with the Method Reporter script, available in the mekkablue scripts.

You can find the new method names in Glyphs 3.app/Contents/Frameworks/GlyphsCore.framework/Versions/A/Headers/GSOutlineImporter.h

this:

- (BOOL)readFile:(NSURL *)URL toLayer:(GSLayer *)layer bounds:(NSRect *)outBounds error:(NSError **)error;

translates to python:

OutlineImporter.readFile_toLayer_bounds_error_(fileURL, layer, None, None)
1 Like

Thanks Georg for the SVG import fix. The import to Color layer workflow is almost working!

One thing that is unexpected is that the maximum width of the Color layers seems to be fixed as UnitPerEm, regardless of how wide the SVG is, resulting in clipping when the shape is rectangular:

A pass in script that finds the bounds and adjusts the width would probably fix this, but I haven’t tried that yet.

What I can’t find an answer to: when using as SVG, I can tag a path as fill="currentColor" for the glyph to respect application foreground color. I have not found how one can specify that for native Color layers. Is it possible, from markup in SVG source or part of the import script params?

Could you send me one of the .svg files to testing this, again?

And how exactly are you importing the .svg?

Hi Georg,

Thanks for looking into this. I have sent the SVG / import script by email around Jul 11. The SVG import bounds, I noticed, is fixed around 3204 — thank you very much! :partying_face: :clap:

The only leftover issue for my usage of SVG as glyph-source is a way to specify colors in Color layers. I think that is a broader / different issue, so I’ll open a separate thread for it.