Use "is None" instead of "== None"
The latter hits the __eq__ method and can fail because we now do not allow comparing objects of different types. For example, was failing subsetting Andika-R.ttf.
This commit is contained in:
parent
78c02b6af3
commit
9e6ef94b55
@ -482,7 +482,7 @@ class FDSelect:
|
|||||||
assert False, "unsupported FDSelect format: %s" % format
|
assert False, "unsupported FDSelect format: %s" % format
|
||||||
else:
|
else:
|
||||||
# reading from XML. Make empty gidArray,, and leave format as passed in.
|
# reading from XML. Make empty gidArray,, and leave format as passed in.
|
||||||
# format == None will result in the smallest representation being used.
|
# format is None will result in the smallest representation being used.
|
||||||
self.format = format
|
self.format = format
|
||||||
self.gidArray = []
|
self.gidArray = []
|
||||||
|
|
||||||
@ -514,9 +514,9 @@ class CharStrings(object):
|
|||||||
self.charStringsAreIndexed = 0
|
self.charStringsAreIndexed = 0
|
||||||
self.globalSubrs = globalSubrs
|
self.globalSubrs = globalSubrs
|
||||||
self.private = private
|
self.private = private
|
||||||
if fdSelect != None:
|
if fdSelect is not None:
|
||||||
self.fdSelect = fdSelect
|
self.fdSelect = fdSelect
|
||||||
if fdArray!= None:
|
if fdArray is not None:
|
||||||
self.fdArray = fdArray
|
self.fdArray = fdArray
|
||||||
|
|
||||||
def keys(self):
|
def keys(self):
|
||||||
|
@ -100,7 +100,7 @@ def remap(self, class_map):
|
|||||||
|
|
||||||
@_add_method(otTables.SingleSubst)
|
@_add_method(otTables.SingleSubst)
|
||||||
def closure_glyphs(self, s, cur_glyphs=None):
|
def closure_glyphs(self, s, cur_glyphs=None):
|
||||||
if cur_glyphs == None: cur_glyphs = s.glyphs
|
if cur_glyphs is None: cur_glyphs = s.glyphs
|
||||||
if self.Format in [1, 2]:
|
if self.Format in [1, 2]:
|
||||||
s.glyphs.update(v for g,v in self.mapping.items() if g in cur_glyphs)
|
s.glyphs.update(v for g,v in self.mapping.items() if g in cur_glyphs)
|
||||||
else:
|
else:
|
||||||
@ -117,7 +117,7 @@ def subset_glyphs(self, s):
|
|||||||
|
|
||||||
@_add_method(otTables.MultipleSubst)
|
@_add_method(otTables.MultipleSubst)
|
||||||
def closure_glyphs(self, s, cur_glyphs=None):
|
def closure_glyphs(self, s, cur_glyphs=None):
|
||||||
if cur_glyphs == None: cur_glyphs = s.glyphs
|
if cur_glyphs is None: cur_glyphs = s.glyphs
|
||||||
if self.Format == 1:
|
if self.Format == 1:
|
||||||
indices = self.Coverage.intersect(cur_glyphs)
|
indices = self.Coverage.intersect(cur_glyphs)
|
||||||
_set_update(s.glyphs, *(self.Sequence[i].Substitute for i in indices))
|
_set_update(s.glyphs, *(self.Sequence[i].Substitute for i in indices))
|
||||||
@ -141,7 +141,7 @@ def subset_glyphs(self, s):
|
|||||||
|
|
||||||
@_add_method(otTables.AlternateSubst)
|
@_add_method(otTables.AlternateSubst)
|
||||||
def closure_glyphs(self, s, cur_glyphs=None):
|
def closure_glyphs(self, s, cur_glyphs=None):
|
||||||
if cur_glyphs == None: cur_glyphs = s.glyphs
|
if cur_glyphs is None: cur_glyphs = s.glyphs
|
||||||
if self.Format == 1:
|
if self.Format == 1:
|
||||||
_set_update(s.glyphs, *(vlist for g,vlist in self.alternates.items()
|
_set_update(s.glyphs, *(vlist for g,vlist in self.alternates.items()
|
||||||
if g in cur_glyphs))
|
if g in cur_glyphs))
|
||||||
@ -161,7 +161,7 @@ def subset_glyphs(self, s):
|
|||||||
|
|
||||||
@_add_method(otTables.LigatureSubst)
|
@_add_method(otTables.LigatureSubst)
|
||||||
def closure_glyphs(self, s, cur_glyphs=None):
|
def closure_glyphs(self, s, cur_glyphs=None):
|
||||||
if cur_glyphs == None: cur_glyphs = s.glyphs
|
if cur_glyphs is None: cur_glyphs = s.glyphs
|
||||||
if self.Format == 1:
|
if self.Format == 1:
|
||||||
_set_update(s.glyphs, *([seq.LigGlyph for seq in seqs
|
_set_update(s.glyphs, *([seq.LigGlyph for seq in seqs
|
||||||
if all(c in s.glyphs for c in seq.Component)]
|
if all(c in s.glyphs for c in seq.Component)]
|
||||||
@ -186,7 +186,7 @@ def subset_glyphs(self, s):
|
|||||||
|
|
||||||
@_add_method(otTables.ReverseChainSingleSubst)
|
@_add_method(otTables.ReverseChainSingleSubst)
|
||||||
def closure_glyphs(self, s, cur_glyphs=None):
|
def closure_glyphs(self, s, cur_glyphs=None):
|
||||||
if cur_glyphs == None: cur_glyphs = s.glyphs
|
if cur_glyphs is None: cur_glyphs = s.glyphs
|
||||||
if self.Format == 1:
|
if self.Format == 1:
|
||||||
indices = self.Coverage.intersect(cur_glyphs)
|
indices = self.Coverage.intersect(cur_glyphs)
|
||||||
if(not indices or
|
if(not indices or
|
||||||
@ -573,7 +573,7 @@ def __classify_context(self):
|
|||||||
@_add_method(otTables.ContextSubst,
|
@_add_method(otTables.ContextSubst,
|
||||||
otTables.ChainContextSubst)
|
otTables.ChainContextSubst)
|
||||||
def closure_glyphs(self, s, cur_glyphs=None):
|
def closure_glyphs(self, s, cur_glyphs=None):
|
||||||
if cur_glyphs == None: cur_glyphs = s.glyphs
|
if cur_glyphs is None: cur_glyphs = s.glyphs
|
||||||
c = self.__classify_context()
|
c = self.__classify_context()
|
||||||
|
|
||||||
indices = c.Coverage(self).intersect(s.glyphs)
|
indices = c.Coverage(self).intersect(s.glyphs)
|
||||||
@ -692,7 +692,7 @@ def subset_glyphs(self, s):
|
|||||||
# Delete, but not renumber, unreachable rulesets.
|
# Delete, but not renumber, unreachable rulesets.
|
||||||
indices = getattr(self, c.ClassDef).intersect(self.Coverage.glyphs)
|
indices = getattr(self, c.ClassDef).intersect(self.Coverage.glyphs)
|
||||||
rss = [rss if i in indices else None for i,rss in enumerate(rss)]
|
rss = [rss if i in indices else None for i,rss in enumerate(rss)]
|
||||||
while rss and rss[-1] == None:
|
while rss and rss[-1] is None:
|
||||||
del rss[-1]
|
del rss[-1]
|
||||||
|
|
||||||
for rs in rss:
|
for rs in rss:
|
||||||
@ -1797,7 +1797,7 @@ class Options(object):
|
|||||||
v = a[i+1:]
|
v = a[i+1:]
|
||||||
k = k.replace('-', '_')
|
k = k.replace('-', '_')
|
||||||
if not hasattr(self, k):
|
if not hasattr(self, k):
|
||||||
if ignore_unknown == True or k in ignore_unknown:
|
if ignore_unknown is True or k in ignore_unknown:
|
||||||
ret.append(orig_a)
|
ret.append(orig_a)
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
|
@ -571,7 +571,7 @@ class TTFont(object):
|
|||||||
glyphID = int(glyphName[5:])
|
glyphID = int(glyphName[5:])
|
||||||
except (NameError, ValueError):
|
except (NameError, ValueError):
|
||||||
glyphID = None
|
glyphID = None
|
||||||
if glyphID == None:
|
if glyphID is None:
|
||||||
glyphID = self.last_vid -1
|
glyphID = self.last_vid -1
|
||||||
self.last_vid = glyphID
|
self.last_vid = glyphID
|
||||||
self.reverseVIDDict[glyphName] = glyphID
|
self.reverseVIDDict[glyphName] = glyphID
|
||||||
|
@ -189,7 +189,7 @@ class SFNTWriter(object):
|
|||||||
self.totalSfntSize += (entry.origLength + 3) & ~3
|
self.totalSfntSize += (entry.origLength + 3) & ~3
|
||||||
|
|
||||||
data = self.flavorData if self.flavorData else WOFFFlavorData()
|
data = self.flavorData if self.flavorData else WOFFFlavorData()
|
||||||
if data.majorVersion != None and data.minorVersion != None:
|
if data.majorVersion is not None and data.minorVersion is not None:
|
||||||
self.majorVersion = data.majorVersion
|
self.majorVersion = data.majorVersion
|
||||||
self.minorVersion = data.minorVersion
|
self.minorVersion = data.minorVersion
|
||||||
else:
|
else:
|
||||||
|
@ -172,7 +172,7 @@ class table_E_B_D_T_(DefaultTable.DefaultTable):
|
|||||||
# format allows the strike index value to be out of order.
|
# format allows the strike index value to be out of order.
|
||||||
if strikeIndex >= len(self.strikeData):
|
if strikeIndex >= len(self.strikeData):
|
||||||
self.strikeData += [None] * (strikeIndex + 1 - len(self.strikeData))
|
self.strikeData += [None] * (strikeIndex + 1 - len(self.strikeData))
|
||||||
assert self.strikeData[strikeIndex] == None, "Duplicate strike EBDT indices."
|
assert self.strikeData[strikeIndex] is None, "Duplicate strike EBDT indices."
|
||||||
self.strikeData[strikeIndex] = bitmapGlyphDict
|
self.strikeData[strikeIndex] = bitmapGlyphDict
|
||||||
|
|
||||||
class EbdtComponent(object):
|
class EbdtComponent(object):
|
||||||
@ -492,7 +492,7 @@ class BitAlignedBitmapMixin(object):
|
|||||||
return (bitOffset, bitOffset+rowBits)
|
return (bitOffset, bitOffset+rowBits)
|
||||||
|
|
||||||
def getRow(self, row, bitDepth=1, metrics=None, reverseBytes=False):
|
def getRow(self, row, bitDepth=1, metrics=None, reverseBytes=False):
|
||||||
if metrics == None:
|
if metrics is None:
|
||||||
metrics = self.metrics
|
metrics = self.metrics
|
||||||
assert 0 <= row and row < metrics.height, "Illegal row access in bitmap"
|
assert 0 <= row and row < metrics.height, "Illegal row access in bitmap"
|
||||||
|
|
||||||
@ -541,7 +541,7 @@ class BitAlignedBitmapMixin(object):
|
|||||||
return data
|
return data
|
||||||
|
|
||||||
def setRows(self, dataRows, bitDepth=1, metrics=None, reverseBytes=False):
|
def setRows(self, dataRows, bitDepth=1, metrics=None, reverseBytes=False):
|
||||||
if metrics == None:
|
if metrics is None:
|
||||||
metrics = self.metrics
|
metrics = self.metrics
|
||||||
if not reverseBytes:
|
if not reverseBytes:
|
||||||
dataRows = list(map(_reverseBytes, dataRows))
|
dataRows = list(map(_reverseBytes, dataRows))
|
||||||
@ -580,7 +580,7 @@ class ByteAlignedBitmapMixin(object):
|
|||||||
return (byteOffset, byteOffset+rowBytes)
|
return (byteOffset, byteOffset+rowBytes)
|
||||||
|
|
||||||
def getRow(self, row, bitDepth=1, metrics=None, reverseBytes=False):
|
def getRow(self, row, bitDepth=1, metrics=None, reverseBytes=False):
|
||||||
if metrics == None:
|
if metrics is None:
|
||||||
metrics = self.metrics
|
metrics = self.metrics
|
||||||
assert 0 <= row and row < metrics.height, "Illegal row access in bitmap"
|
assert 0 <= row and row < metrics.height, "Illegal row access in bitmap"
|
||||||
byteRange = self._getByteRange(row, bitDepth, metrics)
|
byteRange = self._getByteRange(row, bitDepth, metrics)
|
||||||
@ -590,7 +590,7 @@ class ByteAlignedBitmapMixin(object):
|
|||||||
return data
|
return data
|
||||||
|
|
||||||
def setRows(self, dataRows, bitDepth=1, metrics=None, reverseBytes=False):
|
def setRows(self, dataRows, bitDepth=1, metrics=None, reverseBytes=False):
|
||||||
if metrics == None:
|
if metrics is None:
|
||||||
metrics = self.metrics
|
metrics = self.metrics
|
||||||
if reverseBytes:
|
if reverseBytes:
|
||||||
dataRows = map(_reverseBytes, dataRows)
|
dataRows = map(_reverseBytes, dataRows)
|
||||||
|
@ -219,7 +219,7 @@ class table_E_B_L_C_(DefaultTable.DefaultTable):
|
|||||||
# allows for the strike index value to be out of order.
|
# allows for the strike index value to be out of order.
|
||||||
if strikeIndex >= len(self.strikes):
|
if strikeIndex >= len(self.strikes):
|
||||||
self.strikes += [None] * (strikeIndex + 1 - len(self.strikes))
|
self.strikes += [None] * (strikeIndex + 1 - len(self.strikes))
|
||||||
assert self.strikes[strikeIndex] == None, "Duplicate strike EBLC indices."
|
assert self.strikes[strikeIndex] is None, "Duplicate strike EBLC indices."
|
||||||
self.strikes[strikeIndex] = curStrike
|
self.strikes[strikeIndex] = curStrike
|
||||||
|
|
||||||
class Strike(object):
|
class Strike(object):
|
||||||
|
@ -61,7 +61,7 @@ class GMAPRecord(object):
|
|||||||
|
|
||||||
|
|
||||||
def compile(self, ttFont):
|
def compile(self, ttFont):
|
||||||
if self.UV == None:
|
if self.UV is None:
|
||||||
self.UV = 0
|
self.UV = 0
|
||||||
nameLen = len(self.name)
|
nameLen = len(self.name)
|
||||||
if nameLen < 32:
|
if nameLen < 32:
|
||||||
|
@ -202,7 +202,7 @@ class table_S_V_G_(DefaultTable.DefaultTable):
|
|||||||
svgDocData = bytesjoin(entryList)
|
svgDocData = bytesjoin(entryList)
|
||||||
|
|
||||||
# get colorpalette info.
|
# get colorpalette info.
|
||||||
if self.colorPalettes == None:
|
if self.colorPalettes is None:
|
||||||
offsetToColorPalettes = 0
|
offsetToColorPalettes = 0
|
||||||
palettesData = ""
|
palettesData = ""
|
||||||
else:
|
else:
|
||||||
@ -258,7 +258,7 @@ class table_S_V_G_(DefaultTable.DefaultTable):
|
|||||||
writer.endtag("svgDoc")
|
writer.endtag("svgDoc")
|
||||||
writer.newline()
|
writer.newline()
|
||||||
|
|
||||||
if (self.colorPalettes != None) and (self.colorPalettes.numColorParams != None):
|
if (self.colorPalettes is not None) and (self.colorPalettes.numColorParams is not None):
|
||||||
writer.begintag("colorPalettes")
|
writer.begintag("colorPalettes")
|
||||||
writer.newline()
|
writer.newline()
|
||||||
for uiNameID in self.colorPalettes.colorParamUINameIDs:
|
for uiNameID in self.colorPalettes.colorParamUINameIDs:
|
||||||
|
@ -108,7 +108,7 @@ class CmapSubtable(object):
|
|||||||
# allow lazy decompilation of subtables.
|
# allow lazy decompilation of subtables.
|
||||||
if attr[:2] == '__': # don't handle requests for member functions like '__lt__'
|
if attr[:2] == '__': # don't handle requests for member functions like '__lt__'
|
||||||
raise AttributeError(attr)
|
raise AttributeError(attr)
|
||||||
if self.data == None:
|
if self.data is None:
|
||||||
raise AttributeError(attr)
|
raise AttributeError(attr)
|
||||||
self.decompile(None, None) # use saved data.
|
self.decompile(None, None) # use saved data.
|
||||||
self.data = None # Once this table has been decompiled, make sure we don't
|
self.data = None # Once this table has been decompiled, make sure we don't
|
||||||
@ -172,10 +172,10 @@ class cmap_format_0(CmapSubtable):
|
|||||||
def decompile(self, data, ttFont):
|
def decompile(self, data, ttFont):
|
||||||
# we usually get here indirectly from the subtable __getattr__ function, in which case both args must be None.
|
# we usually get here indirectly from the subtable __getattr__ function, in which case both args must be None.
|
||||||
# If not, someone is calling the subtable decompile() directly, and must provide both args.
|
# If not, someone is calling the subtable decompile() directly, and must provide both args.
|
||||||
if data != None and ttFont != None:
|
if data is not None and ttFont is not None:
|
||||||
self.decompileHeader(data[offset:offset+int(length)], ttFont)
|
self.decompileHeader(data[offset:offset+int(length)], ttFont)
|
||||||
else:
|
else:
|
||||||
assert (data == None and ttFont == None), "Need both data and ttFont arguments"
|
assert (data is None and ttFont is None), "Need both data and ttFont arguments"
|
||||||
data = self.data # decompileHeader assigns the data after the header to self.data
|
data = self.data # decompileHeader assigns the data after the header to self.data
|
||||||
assert 262 == self.length, "Format 0 cmap subtable not 262 bytes"
|
assert 262 == self.length, "Format 0 cmap subtable not 262 bytes"
|
||||||
glyphIdArray = array.array("B")
|
glyphIdArray = array.array("B")
|
||||||
@ -259,10 +259,10 @@ class cmap_format_2(CmapSubtable):
|
|||||||
def decompile(self, data, ttFont):
|
def decompile(self, data, ttFont):
|
||||||
# we usually get here indirectly from the subtable __getattr__ function, in which case both args must be None.
|
# we usually get here indirectly from the subtable __getattr__ function, in which case both args must be None.
|
||||||
# If not, someone is calling the subtable decompile() directly, and must provide both args.
|
# If not, someone is calling the subtable decompile() directly, and must provide both args.
|
||||||
if data != None and ttFont != None:
|
if data is not None and ttFont is not None:
|
||||||
self.decompileHeader(data[offset:offset+int(length)], ttFont)
|
self.decompileHeader(data[offset:offset+int(length)], ttFont)
|
||||||
else:
|
else:
|
||||||
assert (data == None and ttFont == None), "Need both data and ttFont arguments"
|
assert (data is None and ttFont is None), "Need both data and ttFont arguments"
|
||||||
|
|
||||||
data = self.data # decompileHeader assigns the data after the header to self.data
|
data = self.data # decompileHeader assigns the data after the header to self.data
|
||||||
subHeaderKeys = []
|
subHeaderKeys = []
|
||||||
@ -628,10 +628,10 @@ class cmap_format_4(CmapSubtable):
|
|||||||
def decompile(self, data, ttFont):
|
def decompile(self, data, ttFont):
|
||||||
# we usually get here indirectly from the subtable __getattr__ function, in which case both args must be None.
|
# we usually get here indirectly from the subtable __getattr__ function, in which case both args must be None.
|
||||||
# If not, someone is calling the subtable decompile() directly, and must provide both args.
|
# If not, someone is calling the subtable decompile() directly, and must provide both args.
|
||||||
if data != None and ttFont != None:
|
if data is not None and ttFont is not None:
|
||||||
self.decompileHeader(self.data[offset:offset+int(length)], ttFont)
|
self.decompileHeader(self.data[offset:offset+int(length)], ttFont)
|
||||||
else:
|
else:
|
||||||
assert (data == None and ttFont == None), "Need both data and ttFont arguments"
|
assert (data is None and ttFont is None), "Need both data and ttFont arguments"
|
||||||
|
|
||||||
data = self.data # decompileHeader assigns the data after the header to self.data
|
data = self.data # decompileHeader assigns the data after the header to self.data
|
||||||
(segCountX2, searchRange, entrySelector, rangeShift) = \
|
(segCountX2, searchRange, entrySelector, rangeShift) = \
|
||||||
@ -832,10 +832,10 @@ class cmap_format_6(CmapSubtable):
|
|||||||
def decompile(self, data, ttFont):
|
def decompile(self, data, ttFont):
|
||||||
# we usually get here indirectly from the subtable __getattr__ function, in which case both args must be None.
|
# we usually get here indirectly from the subtable __getattr__ function, in which case both args must be None.
|
||||||
# If not, someone is calling the subtable decompile() directly, and must provide both args.
|
# If not, someone is calling the subtable decompile() directly, and must provide both args.
|
||||||
if data != None and ttFont != None:
|
if data is not None and ttFont is not None:
|
||||||
self.decompileHeader(data[offset:offset+int(length)], ttFont)
|
self.decompileHeader(data[offset:offset+int(length)], ttFont)
|
||||||
else:
|
else:
|
||||||
assert (data == None and ttFont == None), "Need both data and ttFont arguments"
|
assert (data is None and ttFont is None), "Need both data and ttFont arguments"
|
||||||
|
|
||||||
data = self.data # decompileHeader assigns the data after the header to self.data
|
data = self.data # decompileHeader assigns the data after the header to self.data
|
||||||
firstCode, entryCount = struct.unpack(">HH", data[:4])
|
firstCode, entryCount = struct.unpack(">HH", data[:4])
|
||||||
@ -918,10 +918,10 @@ class cmap_format_12_or_13(CmapSubtable):
|
|||||||
def decompile(self, data, ttFont):
|
def decompile(self, data, ttFont):
|
||||||
# we usually get here indirectly from the subtable __getattr__ function, in which case both args must be None.
|
# we usually get here indirectly from the subtable __getattr__ function, in which case both args must be None.
|
||||||
# If not, someone is calling the subtable decompile() directly, and must provide both args.
|
# If not, someone is calling the subtable decompile() directly, and must provide both args.
|
||||||
if data != None and ttFont != None:
|
if data is not None and ttFont is not None:
|
||||||
self.decompileHeader(data[offset:offset+int(length)], ttFont)
|
self.decompileHeader(data[offset:offset+int(length)], ttFont)
|
||||||
else:
|
else:
|
||||||
assert (data == None and ttFont == None), "Need both data and ttFont arguments"
|
assert (data is None and ttFont is None), "Need both data and ttFont arguments"
|
||||||
|
|
||||||
data = self.data # decompileHeader assigns the data after the header to self.data
|
data = self.data # decompileHeader assigns the data after the header to self.data
|
||||||
charCodes = []
|
charCodes = []
|
||||||
@ -1084,10 +1084,10 @@ class cmap_format_14(CmapSubtable):
|
|||||||
self.language = 0xFF # has no language.
|
self.language = 0xFF # has no language.
|
||||||
|
|
||||||
def decompile(self, data, ttFont):
|
def decompile(self, data, ttFont):
|
||||||
if data != None and ttFont != None and ttFont.lazy:
|
if data is not None and ttFont is not None and ttFont.lazy:
|
||||||
self.decompileHeader(data, ttFont)
|
self.decompileHeader(data, ttFont)
|
||||||
else:
|
else:
|
||||||
assert (data == None and ttFont == None), "Need both data and ttFont arguments"
|
assert (data is None and ttFont is None), "Need both data and ttFont arguments"
|
||||||
data = self.data
|
data = self.data
|
||||||
|
|
||||||
self.cmap = {} # so that clients that expect this to exist in a cmap table won't fail.
|
self.cmap = {} # so that clients that expect this to exist in a cmap table won't fail.
|
||||||
@ -1145,9 +1145,9 @@ class cmap_format_14(CmapSubtable):
|
|||||||
uvsList = sorted(uvsDict.keys())
|
uvsList = sorted(uvsDict.keys())
|
||||||
for uvs in uvsList:
|
for uvs in uvsList:
|
||||||
uvList = uvsDict[uvs]
|
uvList = uvsDict[uvs]
|
||||||
uvList.sort(key=lambda item: (item[1] != None, item[0], item[1]))
|
uvList.sort(key=lambda item: (item[1] is not None, item[0], item[1]))
|
||||||
for uv, gname in uvList:
|
for uv, gname in uvList:
|
||||||
if gname == None:
|
if gname is None:
|
||||||
gname = "None"
|
gname = "None"
|
||||||
# I use the arg rather than th keyword syntax in order to preserve the attribute order.
|
# I use the arg rather than th keyword syntax in order to preserve the attribute order.
|
||||||
writer.simpletag("map", [ ("uvs",hex(uvs)), ("uv",hex(uv)), ("name", gname)] )
|
writer.simpletag("map", [ ("uvs",hex(uvs)), ("uv",hex(uv)), ("name", gname)] )
|
||||||
@ -1196,7 +1196,7 @@ class cmap_format_14(CmapSubtable):
|
|||||||
for uvs in uvsList:
|
for uvs in uvsList:
|
||||||
entryList = uvsDict[uvs]
|
entryList = uvsDict[uvs]
|
||||||
|
|
||||||
defList = [entry for entry in entryList if entry[1] == None]
|
defList = [entry for entry in entryList if entry[1] is None]
|
||||||
if defList:
|
if defList:
|
||||||
defList = [entry[0] for entry in defList]
|
defList = [entry[0] for entry in defList]
|
||||||
defOVSOffset = offset
|
defOVSOffset = offset
|
||||||
@ -1223,7 +1223,7 @@ class cmap_format_14(CmapSubtable):
|
|||||||
else:
|
else:
|
||||||
defOVSOffset = 0
|
defOVSOffset = 0
|
||||||
|
|
||||||
ndefList = [entry for entry in entryList if entry[1] != None]
|
ndefList = [entry for entry in entryList if entry[1] is not None]
|
||||||
if ndefList:
|
if ndefList:
|
||||||
nonDefUVSOffset = offset
|
nonDefUVSOffset = offset
|
||||||
ndefList.sort()
|
ndefList.sort()
|
||||||
@ -1273,10 +1273,10 @@ class cmap_format_unknown(CmapSubtable):
|
|||||||
def decompile(self, data, ttFont):
|
def decompile(self, data, ttFont):
|
||||||
# we usually get here indirectly from the subtable __getattr__ function, in which case both args must be None.
|
# we usually get here indirectly from the subtable __getattr__ function, in which case both args must be None.
|
||||||
# If not, someone is calling the subtable decompile() directly, and must provide both args.
|
# If not, someone is calling the subtable decompile() directly, and must provide both args.
|
||||||
if data != None and ttFont != None:
|
if data is not None and ttFont is not None:
|
||||||
self.decompileHeader(data[offset:offset+int(length)], ttFont)
|
self.decompileHeader(data[offset:offset+int(length)], ttFont)
|
||||||
else:
|
else:
|
||||||
assert (data == None and ttFont == None), "Need both data and ttFont arguments"
|
assert (data is None and ttFont is None), "Need both data and ttFont arguments"
|
||||||
|
|
||||||
def compile(self, ttFont):
|
def compile(self, ttFont):
|
||||||
if self.data:
|
if self.data:
|
||||||
|
@ -373,7 +373,7 @@ class OTTableWriter(object):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
if appendExtensions:
|
if appendExtensions:
|
||||||
assert extTables != None, "Program or XML editing error. Extension subtables cannot contain extensions subtables"
|
assert extTables is not None, "Program or XML editing error. Extension subtables cannot contain extensions subtables"
|
||||||
newDone = {}
|
newDone = {}
|
||||||
item._gatherTables(extTables, None, newDone)
|
item._gatherTables(extTables, None, newDone)
|
||||||
|
|
||||||
|
@ -494,14 +494,14 @@ def fixLookupOverFlows(ttf, overflowRecord):
|
|||||||
SubTable[0] and contents
|
SubTable[0] and contents
|
||||||
...
|
...
|
||||||
SubTable[n] and contents
|
SubTable[n] and contents
|
||||||
If the offset to a lookup overflowed (SubTableIndex == None)
|
If the offset to a lookup overflowed (SubTableIndex is None)
|
||||||
we must promote the *previous* lookup to an Extension type.
|
we must promote the *previous* lookup to an Extension type.
|
||||||
If the offset from a lookup to subtable overflowed, then we must promote it
|
If the offset from a lookup to subtable overflowed, then we must promote it
|
||||||
to an Extension Lookup type.
|
to an Extension Lookup type.
|
||||||
"""
|
"""
|
||||||
ok = 0
|
ok = 0
|
||||||
lookupIndex = overflowRecord.LookupListIndex
|
lookupIndex = overflowRecord.LookupListIndex
|
||||||
if (overflowRecord.SubTableIndex == None):
|
if (overflowRecord.SubTableIndex is None):
|
||||||
lookupIndex = lookupIndex - 1
|
lookupIndex = lookupIndex - 1
|
||||||
if lookupIndex < 0:
|
if lookupIndex < 0:
|
||||||
return ok
|
return ok
|
||||||
|
@ -227,7 +227,7 @@ def ttCompile(input, output, options):
|
|||||||
lastItem = overflowRecord
|
lastItem = overflowRecord
|
||||||
while True:
|
while True:
|
||||||
ok = 0
|
ok = 0
|
||||||
if overflowRecord.itemName == None:
|
if overflowRecord.itemName is None:
|
||||||
ok = fixLookupOverFlows(ttf, overflowRecord)
|
ok = fixLookupOverFlows(ttf, overflowRecord)
|
||||||
else:
|
else:
|
||||||
ok = fixSubTableOverFlows(ttf, overflowRecord)
|
ok = fixSubTableOverFlows(ttf, overflowRecord)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user