Grid properties inconsistency between Python API and .glyphs file

As stated in the Python scripting API documentation, I can access the “Grid Spacing” as GSFont.grid and the “Subdivision” as GSFont.gridSubDivisions. Also, GSFont.gridLength returns the value GSFont.grid / GSFont.gridSubDivisions. There is no problem:

In the .glyphs file, however, GSFont.grid is stored as gridLength instead of grid:

$ grep grid test.glyphs
gridLength = 123;
gridSubDivision = 4;

I was confused about this when scripting with glyphsLib :frowning: Is it intentional?

I believe this is a historical naming inconsistency caused by an early renaming. The Subdivision was added later, that’s why there was suddenly a need to differentiate between grid step and grid length, which were the same thing before.

I will adjust the accessors in glyphsLib.

Sounds good!

Now released in glyphsLib 2.2.1. Thank you!

1 Like