Open BoldMonday opened 6 months ago
according the docs it should either be a kern value or None
the fallback you can provide can also only be a int/float or None, nothing else...
I guess its best to test on None: print(c.kerning.get(("a", "b")) or "no value found")
Returns the value for the kerning pair. pair is a tuple of two Strings, and the returned values will either be Integer/Float or None if no pair was found.
Thanks for the explanation and the help.
I guess its best to test on None:
print(c.kerning.get(("a", "b")) or "no value found")
This will not work when the pair in question has a kerning value of 0
unfortunately.
I solved it with a more elaborate if
condition instead.
font.kerning.get()
allows for a default return value in case the pair is not present.However, this afternoon I discovered that fontParts puts an unnecessary restriction on what types it allows for the default value. Where in former days of RoboFab the code below would happily work:
Now I was suddenly confronted with this cryptic traceback:
To me this seems an overly strict application of normalisation. Just like in standard Python dictionaries, default return values should be passed along as they are.