[S_V_G_] fix dumping toXML SVG tables containing colorPalettes

As reported by glukfonts in
https://github.com/fonttools/fonttools/issues/1124
This commit is contained in:
Cosimo Lupo 2018-01-03 15:40:35 +00:00
parent 5e23b0545b
commit c42749466a

View File

@ -285,7 +285,7 @@ class table_S_V_G_(DefaultTable.DefaultTable):
writer.newline() writer.newline()
for uiNameID in self.colorPalettes.colorParamUINameIDs: for uiNameID in self.colorPalettes.colorParamUINameIDs:
writer.begintag("colorParamUINameID") writer.begintag("colorParamUINameID")
writer.writeraw(str(uiNameID)) writer._writeraw(str(uiNameID))
writer.endtag("colorParamUINameID") writer.endtag("colorParamUINameID")
writer.newline() writer.newline()
for colorPalette in self.colorPalettes.colorPaletteList: for colorPalette in self.colorPalettes.colorPaletteList:
@ -343,8 +343,7 @@ class ColorPalettes(object):
def fromXML(self, name, attrs, content, ttFont): def fromXML(self, name, attrs, content, ttFont):
for element in content: for element in content:
element = element.strip() if not isinstance(element, tuple):
if not element:
continue continue
name, attrib, content = element name, attrib, content = element
if name == "colorParamUINameID": if name == "colorParamUINameID":
@ -353,7 +352,7 @@ class ColorPalettes(object):
elif name == "colorPalette": elif name == "colorPalette":
colorPalette = ColorPalette() colorPalette = ColorPalette()
self.colorPaletteList.append(colorPalette) self.colorPaletteList.append(colorPalette)
colorPalette.fromXML((name, attrib, content), ttFont) colorPalette.fromXML(name, attrib, content, ttFont)
self.numColorParams = len(self.colorParamUINameIDs) self.numColorParams = len(self.colorParamUINameIDs)
self.numColorPalettes = len(self.colorPaletteList) self.numColorPalettes = len(self.colorPaletteList)