-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Glyphs file format #332
Comments
Having worked with format v1, here are my recommendations:
|
Many thanks for the comments. You are right about the exceptions. I try to get rid of them. |
I have played around with json a bit. It produces just a bit bigger files (150MB as .glyphs file) when written as minified. Writing nodes as objects, produces 80% bigger files. ;( For big CJK files like this, the raw file size has a big impact on the saving speed. And another 100MB will take some time. Zipping helps with the file size, for sure but it is quite slow. Only zipping the .json file takes 5 second. I need the file writing to be really quick, as it happens quite often for autosaving. And waiting for 2 seconds every 10 or 30 second is "annoying". |
Hum, maybe try faster/more compact standard formats like:
Also there are faster compression algorithms than gzip:
Also about the wait time, it might be possible to "mask" it by running the serialization/compression in a different thread than the UI? (I don't know how Glyphs work internally so maybe you already do that) |
Protobuff looks very promising but has the same problem than .zip. It doesn’t play well with git. I will investigate this and will make it as compatible as possible. |
Please also consider or give the option to write out the file into a UFO-like file-directory. The biggest annoyance in my design work is that I have to use external tools to split the changes up. With UFOs, I can stage single files (= glyphs). Doing it this way may also reduce the writing pressure, as you don't have to re-dump those 150 MB again and again -- just the glyphs that changed ;) This would make the format super git-friendly. Edit: Maybe this would even kill two stones with one bird: file directory for normal design work, compressed single file for e-mailing it to someone? |
Actually, I have to word this more strongly: going the file-directory route is essential when more than one person is working on a font. You don't want to make font designers deal with merge conflicts just because something unrelated to their changes flipped around. |
I heard that there are plans to have a one file approach with .ufo. The multiple file route has advantages but also problems. Both have to do with tools that use the files. Git is a bit easier but Dropbox sucks. |
It might make sense to give people the option to do both -- e.g. give them a ".glyphsdir" and ".glyphs" save option so they take whatever suits their workflow best. Both formats should just be different ways to save the exact same information. |
Or, what I wanted to add fix the tools ;) |
I suggest fixing Dropbox then 😁 |
Capn proto is a nice evolution of protobufs, may be interesting
|
I would love to use any of the Proto things. But then git is out of the door. |
I guess you can use text representations if you really want to? https://stackoverflow.com/questions/18873924/what-does-the-protobuf-text-format-look-like But then you might as well experiment with JSON some more I guess. What if you represent nodes as simple lists with the line drawing operations represented as numbers? What did your node objects look like? |
I played around a bit. It seems like that plist is still the best choice. It is very similar to JSON just uses some different characters. It can be ‘minified’ and doesn’t need quotes. My current approach is to use shorter keys and collaps the element objects to one line. I thought about using list for the node, too. That would mean I could just replace the quotes on the node string with parentheses ;) |
Hm. Can you paste a snippet that shows how standard JSON increases file size by 80%? Really curious to see what the difference is. |
really? you mean xml plist, or your own customized NeXTStep-like ascii plist? |
It was not about JSON but about writing "proper" node objects instead of the "string" format that is currently used. Something like this: I checked again with some smaller and bigger files. After minifying it the same way the difference between plist and JSON is not that much, actually. So the JSON don't look that bad after all.
That produces huge files in comparison. |
You could try assigning integers to types. That would save a few bytes and maybe up parsing performance? |
One more thing: adding a fixed version number to the file might be a good idea, seeing as build numbers overlap between stable and dev releases (#352 (comment)). So, every time you make even the tiniest change to the file format, you increase the number. That would make it much easier for everyone and you to correctly parse things now and in the future. |
What about |
Well, if there's a difference between 3.1-1203 and 3.1-1204, you might as well call it 3.2 ;) This would require that you really only change the file format if it is necessary for a feature or it gets unwieldy quickly. |
I do not change the version number for each build or cutting edge release. |
You don't have to if you do not change the format with each build :) if
over the span of at least a minor version you could keep just eg 3.1, that
would be great already.
|
I suppose this can be closed, as the format won't change soon? |
I’m heavily working on the new version. I hope I have an early beta by the end of the year. |
Alright, then I'll reopen this? Please keep us in the loop about any format change :) |
I just made a JSON schema for the Glyphs 3 file format. I can help with implementing the new format. It would help a lot if someone could give me some hints how it would best fit in the code base. |
Interesting. Do you use the same schema internally in G3? I'm still a bit sad that we will still have to have a plist parser :( |
I don’t use it internally as I just made it. I’ll use it in my test as it already found some problems. And also to keep the file spec up to date. The parser is there and works well. When building the schema I wrote a bunch of JSON and it has it quirks (leave a comma after the last element and it will not load, sometimes without a proper error message). And I removed deviations from the plist format (unicode is stored as plain integers now). |
I’m working on a future version of Glyphs. That will bring some changes to the file format. I will help implementing the changes in glyphsLib in time.
.appVersion
, key, there will be a.formatVersion = 2
key. glyphsLib could already look for that key and stop processing if.formatVersion > 1
.Do you have any suggestions/requests about the file format?
The text was updated successfully, but these errors were encountered: