That is strange. For some properties it is enough to define them on the superclass (GSShape). E.g. .locked is set for GSShape and GSComponent but works for GSPath, too. I’ll fix it.
But with position, it is the other way around. And position doesn’t make much sense for paths.
What’s the quickest way to check if a glyph contains components?
I tried something like this:
for glyph in Font.glyphs:
# print (glyph)
if glyph.layers[0].shapes[0].shapeType == GSShapeTypeComponent:
print (glyph.name, "contains component(s)")
It seems to work until it reaches an empty glyph such as «space»:
Traceback (most recent call last):
File "<macro panel>", line 21
File "GlyphsApp/GlyphsApp/__init__.py", line 2844, in __getitem__
File "GlyphsApp/GlyphsApp/__init__.py", line 487, in _validate_idx
IndexError: list index 0 out of range 0
GSLayer has hasAnchors(), hasPaths() doesn’t exist. You can always check if layer.anchors:, which essentially just returns True or False depending whether the len() of whatever you’re checking is greater than 0.
In general, you don’t need all of those functions since checking the values directly also works.
The has… functions mainly exist for features like Smart Filters which require a dedicated function to exist. When writing a Python script, this is not an issue.