Feature request: Indent .glyphspackage files

Hello! We just recently implemented a collaborative workflow with Git and .glyphspackages, it definitely allows things we had not imagined before :slight_smile:

Since masters are all part of the same .glyph file, wouldn’t it be best for code readability if lines were indented (maybe just a double space)? We had a few conflicting merges and the current format makes it hard to see where a layer ends, for example.

Indentation makes the file soo much bigger. I’ll see if I can improve that somehow.

There are ways to tell Git to format a file before computing and showing the the differences. However, as far as I can tell (using the textconv method), that breaks line- and chunk-based staging; you then can only stage the entire file or none of it.

Now that you mentioned it, I want to reinvestigate whether I just missed something last time I looked into this.

Yes they will become larger! Perhaps setIndet could be a custom parameter that only glyphspackage uses when saving the glyphs. The size concerns you for Git or for computing power needs when saving?

I was investigating different ways to achieve that but the more complex it is, the harder it will be to replicate the setup on all our collaborators’ machines. However, it’s really just a Quality of Life feature, but happy to hear you’re considering it :slight_smile:

Do you still have the files that causes a merge conflict? I would be very interested in those, if you can share them (private message here on the Forum or to support).

Some data about file sizes in bytes from quick indenting tests:

file indent all skip 1 skip 2
small Latin (41 063) 66 778 (+63%) 62 768 (+53%) 58 777 (+43%)
CJK (168 669 246) 278 695 218 (+65%) 264 067 309 (+57%) 249 439 421 (+48%)
  • file: Glyphs files as they are currently stored
  • indent all: structures indented with a tab character per level
  • skip n: same as indent all, but skipping the first n levels

So, with indentation, files get roughly 50% larger. Which is mostly negligible for small files, but does contribute significant file size for larger files.

Also, using a formatter tool to indent files for diffing in Git is quick for small files (<2 ms) while the large CJK file from above takes around 2 seconds.