From c42749466a04d1da469f8364c8b41fd3e10ac094 Mon Sep 17 00:00:00 2001 From: Cosimo Lupo Date: Wed, 3 Jan 2018 15:40:35 +0000 Subject: [PATCH] [S_V_G_] fix dumping toXML SVG tables containing colorPalettes As reported by glukfonts in https://github.com/fonttools/fonttools/issues/1124 --- Lib/fontTools/ttLib/tables/S_V_G_.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Lib/fontTools/ttLib/tables/S_V_G_.py b/Lib/fontTools/ttLib/tables/S_V_G_.py index 3827c9ef3..b0611531d 100644 --- a/Lib/fontTools/ttLib/tables/S_V_G_.py +++ b/Lib/fontTools/ttLib/tables/S_V_G_.py @@ -285,7 +285,7 @@ class table_S_V_G_(DefaultTable.DefaultTable): writer.newline() for uiNameID in self.colorPalettes.colorParamUINameIDs: writer.begintag("colorParamUINameID") - writer.writeraw(str(uiNameID)) + writer._writeraw(str(uiNameID)) writer.endtag("colorParamUINameID") writer.newline() for colorPalette in self.colorPalettes.colorPaletteList: @@ -343,8 +343,7 @@ class ColorPalettes(object): def fromXML(self, name, attrs, content, ttFont): for element in content: - element = element.strip() - if not element: + if not isinstance(element, tuple): continue name, attrib, content = element if name == "colorParamUINameID": @@ -353,7 +352,7 @@ class ColorPalettes(object): elif name == "colorPalette": colorPalette = ColorPalette() self.colorPaletteList.append(colorPalette) - colorPalette.fromXML((name, attrib, content), ttFont) + colorPalette.fromXML(name, attrib, content, ttFont) self.numColorParams = len(self.colorParamUINameIDs) self.numColorPalettes = len(self.colorPaletteList)