You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
f = CurrentFont()
print(f.kerning.get(('A', 'Y'), 'no value found'))
Now I was suddenly confronted with this cryptic traceback:
File "/Applications/RoboFont-4.2.app/Contents/Resources/lib/python3.7/fontParts/base/kerning.py", line 350, in get
File "/Applications/RoboFont-4.2.app/Contents/Resources/lib/python3.7/fontParts/base/base.py", line 361, in get
File "/Applications/RoboFont-4.2.app/Contents/Resources/lib/python3.7/fontParts/base/normalizers.py", line 152, in normalizeKerningValue
TypeError: Kerning value must be a int or a float, not str.
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.
The text was updated successfully, but these errors were encountered:
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.
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.
The text was updated successfully, but these errors were encountered: