defcon icon indicating copy to clipboard operation
defcon copied to clipboard

Do not create empty guidelines array

Open frankrolf opened this issue 3 years ago • 4 comments

Before this change, any f.save() would create an empty guidelines array in the fontinfo.plist. Since guidelines are an optinal attribute, I do not think this is necessary.

frankrolf avatar Aug 10 '22 14:08 frankrolf

this feels very dangerous.. the attribute font.guidelines is a list or an Iterator.

I assume you dont want empty arrays in the ufo xml, this should be moved to fontTools and ufoLib.

typemytype avatar Aug 10 '22 14:08 typemytype

Yes, I can see that some tests are failing so possibly not the best fix here – do you have a suggestion where else it should go?

frankrolf avatar Aug 10 '22 14:08 frankrolf

ufoLib writes the font.info object, defcon mirrors font.guidelines in the font info object: see https://github.com/robotools/defcon/blob/master/Lib/defcon/objects/info.py#L220-L232

It could be fine to make the info.guidelines more ufoLib friendly and return None if the list is empty. The doc string already clarifies that this attribute is just to have a ufoLib compatibility attribute.

@typesupply

typemytype avatar Aug 10 '22 14:08 typemytype

This sounds fine to me.

typesupply avatar Aug 10 '22 14:08 typesupply