[cmap] when compiling format6 subtable, don't assume gid0 is always called '.notdef'

This commit is contained in:
Cosimo Lupo 2017-12-15 13:56:48 +00:00
parent 1aafae816d
commit 1e42224af7

View File

@ -887,8 +887,10 @@ class cmap_format_6(CmapSubtable):
if codes: # yes, there are empty cmap tables. if codes: # yes, there are empty cmap tables.
codes = list(range(codes[0], codes[-1] + 1)) codes = list(range(codes[0], codes[-1] + 1))
firstCode = codes[0] firstCode = codes[0]
valueList = [cmap.get(code, ".notdef") for code in codes] valueList = [
valueList = map(ttFont.getGlyphID, valueList) ttFont.getGlyphID(cmap[code]) if code in cmap else 0
for code in codes
]
gids = array.array("H", valueList) gids = array.array("H", valueList)
if sys.byteorder != "big": if sys.byteorder != "big":
gids.byteswap() gids.byteswap()