Reformatting `.glyphs` file makes it unreadable

This certainly isn’t an issue most people will have, but I felt fit to report it anyway…

Reformatting a .glyphs file in a text-editor makes Glyphs complain the next time it opens it:

The document “source.glyphs” could not be opened.
You can try to fix the file in a text editor.

Now, I see you’re using the old-style Property List format for saving Glyphs projects (a wise decision, since the newer .plist format is XML-based, and easily occupies 10× more disk-space…).

The .glyphs file in question is here, but it’s valid property-list syntax. If you’re parsing it manually, it might help to use a formal API for processing it: I’m certain Apple provide one somewhere.

I’m parsing it with my own code as that is 10 times faster. Thanks for the file. I’ll have a look.

I noticed it doesn’t like closing braces after semicolons. When I replace ";}" with ";\n}", the file opens without an error (although it yields a blank workspace with no glyphs or… anything, really).

I had a quick look at the file.
The file format is based on the plist format but doesn’t allow everything that is possible in plist. It basically expects the structure that you get when you use cocoa to serialise the data (with or without intentions and some minor additions). So one rule is that each key has to be on its own line. This is documented here:
It is recommended to stick to the formatting of how Glyphs is doing it as otherwise you get crazy diffs every time you change it in Glyphs.

I understand. This particular file was only checked into version control for posterity’s sake, and formatted as an afterthought. I wasn’t planning on coming back to it (although I did when I went to double-check something, hence me noticing the error).

I wasn’t aware of the GlyphsFileFormat document, apologies. I recognised the syntax immediately and blindly assumed it was the same old-school plist format without whitespace to optimise filesize. In that case, you can go ahead and mark this as a wontfix. :+1:

It’s a shame Apple ditched the ASCII/OpenStep syntax for XML bloat. The original format is so much more readable (and writable).