latest version:3.4.1 (3436)
macos:15.6.1 (24G90)
“Using the same script, the ttf glyph-exported SVG files were normal before. After upgrading today, the same code now produces abnormal SVG files that cannot be displayed correctly.”
is ttf ,otf is ok
“Where can I download older versions? How can I access the version history?”
thanks
Can you send me the .glyphs file and the script (or explain what you are doing to get the .svg) so that I can reproduce and fix the issues?
Sorry, it was my mistake. But I found that OTF can export SVG correctly, while TTF files cannot.
from AppKit import NSSize
import os
font = Glyphs.font
GlyphAsImage = NSClassFromString(“GlyphAsImage”)
glyphs = Glyphs.font.glyphs
outdir = “local_path_dir”
os.makedirs(outdir, exist_ok=True)
for glyph in glyphs:
if glyph.unicode == None:
continue
# print(chr(int(glyph.unicode, 16)))
layers = glyph.layers
# print(chr(int(glyph.unicode, 16)),len(layers))
layers = [layers[0]]
for layer in layers:
preset = {
"active": True,
"name": "SVG",
"size": layer.ascender,
"factor": 1,
"format": "SVG"
}
layerSize = NSSize(layer.width, layer.ascender)
svgData = GlyphAsImage.svgDataWithLayer_origSize_settings_(layer, layerSize, preset)
print(chr(int(glyph.unicode, 16)),len(layers))
char = chr(int(glyph.unicode, 16))
svgFileName = char + ".svg"
save_path_str = os.path.join(outdir, svgFileName)
print(save_path_str)
save_url = NSURL.fileURLWithPath_(save_path_str)
svgData.writeToURL_atomically_(save_url, True)
The code that write the quadratic SVG is not correct. I’ll have a look.
Fixed it.