Merge pull request #2404 from simoncozens/fix-contextual-overflow
[otlLib] Fix chained contextual builder overflow
This commit is contained in:
commit
3a7c91602c
@ -388,7 +388,20 @@ class ChainContextualBuilder(LookupBuilder):
|
|||||||
if not ruleset.hasAnyGlyphClasses:
|
if not ruleset.hasAnyGlyphClasses:
|
||||||
candidates[1] = [self.buildFormat1Subtable(ruleset, chaining)]
|
candidates[1] = [self.buildFormat1Subtable(ruleset, chaining)]
|
||||||
|
|
||||||
|
for i in [1, 2, 3]:
|
||||||
|
try:
|
||||||
|
self.getCompiledSize_(candidates[i])
|
||||||
|
except Exception as e:
|
||||||
|
log.warning(
|
||||||
|
"Contextual format %i at %s overflowed (%s)"
|
||||||
|
% (i, str(self.location), e)
|
||||||
|
)
|
||||||
|
candidates[i] = None
|
||||||
|
|
||||||
candidates = [x for x in candidates if x is not None]
|
candidates = [x for x in candidates if x is not None]
|
||||||
|
if not candidates:
|
||||||
|
raise OpenTypeLibError("All candidates overflowed", self.location)
|
||||||
|
|
||||||
winner = min(candidates, key=self.getCompiledSize_)
|
winner = min(candidates, key=self.getCompiledSize_)
|
||||||
subtables.extend(winner)
|
subtables.extend(winner)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user