[varLib_instancer - updateNameRecords] Allow NameRecord that do not exist for an platform #2941
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem that this PR solve
When updating namerecord, allow an NameRecord that do not exist for an platform.
Example of an case where this PR is usefull
When trying to instantiateVariableFont with the font Bahnschrift, an exception is raised.
It append because the platform 1 doesn't have the nameID that the stat table use.
So, when it try to getName, it return None which raise an exception.
In order not to raise the exception, we catch it and set the variable to None. Like that, we can instantiate our variable font without problem.