[cmap] When compiling format 0, fill in non-existing entries
Fixup for 88026de5100e4b3cedf0424bcc033f76782eb99e Fixes https://github.com/fonttools/fonttools/issues/800
This commit is contained in:
parent
155ec67ae6
commit
84c584cfc9
@ -248,11 +248,10 @@ class cmap_format_0(CmapSubtable):
|
|||||||
if self.data:
|
if self.data:
|
||||||
return struct.pack(">HHH", 0, 262, self.language) + self.data
|
return struct.pack(">HHH", 0, 262, self.language) + self.data
|
||||||
|
|
||||||
charCodeList = sorted(self.cmap.items())
|
cmap = self.cmap
|
||||||
charCodes = [entry[0] for entry in charCodeList]
|
assert set(cmap.keys()).issubset(range(256))
|
||||||
valueList = [entry[1] for entry in charCodeList]
|
getGlyphID = ttFont.getGlyphID
|
||||||
assert charCodes == list(range(256))
|
valueList = [getGlyphID(cmap[i]) if i in cmap else 0 for i in range(256)]
|
||||||
valueList = map(ttFont.getGlyphID, valueList)
|
|
||||||
|
|
||||||
gids = array.array("B", valueList)
|
gids = array.array("B", valueList)
|
||||||
data = struct.pack(">HHH", 0, 262, self.language) + gids.tostring()
|
data = struct.pack(">HHH", 0, 262, self.language) + gids.tostring()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user