googlefonts / ufo2ft

A bridge from UFOs to FontTools objects (and therefore, OTFs and TTFs).
MIT License
152 stars 43 forks source link

Don't crash when there are only base-mark kerns #569

Closed simoncozens closed 2 years ago

simoncozens commented 2 years ago

ufo2ft's kernFeatureWriter splits base-to-base and mark-to-base kerns like this:

https://github.com/googlefonts/ufo2ft/blob/db8302b4df2a9a1bd599d467d76a63c09d5b0e85/Lib/ufo2ft/featureWriters/kernFeatureWriter.py#L449-L452

There's a horrible corner case (which I've just hit!) if the only kerns in the font are between bases and marks: basePairs is empty and the assertion here fails:

https://github.com/googlefonts/ufo2ft/blob/db8302b4df2a9a1bd599d467d76a63c09d5b0e85/Lib/ufo2ft/featureWriters/kernFeatureWriter.py#L371-L374

This fixes that.