Merge pull request #2585 from justvanrossum/cmap-minor-cleanup

[cmap] don't handle expected case in exception handler
This commit is contained in:
Just van Rossum 2022-04-19 11:44:27 +02:00 committed by GitHub
commit a293606fc8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -177,13 +177,11 @@ class table__c_m_a_p(DefaultTable.DefaultTable):
seen = {} # Some tables are the same object reference. Don't compile them twice.
done = {} # Some tables are different objects, but compile to the same data chunk
for table in self.tables:
try:
offset = seen[id(table.cmap)]
except KeyError:
offset = seen.get(id(table.cmap))
if offset is None:
chunk = table.compile(ttFont)
if chunk in done:
offset = done[chunk]
else:
offset = done.get(chunk)
if offset is None:
offset = seen[id(table.cmap)] = done[chunk] = totalOffset + len(tableData)
tableData = tableData + chunk
data = data + struct.pack(">HHl", table.platformID, table.platEncID, offset)