本文整理汇总了Python中fontTools.ttLib.tables.TupleVariation.TupleVariation.toXML方法的典型用法代码示例。如果您正苦于以下问题:Python TupleVariation.toXML方法的具体用法?Python TupleVariation.toXML怎么用?Python TupleVariation.toXML使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fontTools.ttLib.tables.TupleVariation.TupleVariation
的用法示例。
在下文中一共展示了TupleVariation.toXML方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_toXML_allDeltasNone
# 需要导入模块: from fontTools.ttLib.tables.TupleVariation import TupleVariation [as 别名]
# 或者: from fontTools.ttLib.tables.TupleVariation.TupleVariation import toXML [as 别名]
def test_toXML_allDeltasNone(self):
writer = XMLWriter(BytesIO())
axes = {"wght":(0.0, 1.0, 1.0)}
g = TupleVariation(axes, [None] * 5)
g.toXML(writer, ["wght", "wdth"])
self.assertEqual([
'<tuple>',
'<coord axis="wght" value="1.0"/>',
'<!-- no deltas -->',
'</tuple>'
], TupleVariationTest.xml_lines(writer))
示例2: test_toXML_badDeltaFormat
# 需要导入模块: from fontTools.ttLib.tables.TupleVariation import TupleVariation [as 别名]
# 或者: from fontTools.ttLib.tables.TupleVariation.TupleVariation import toXML [as 别名]
def test_toXML_badDeltaFormat(self):
writer = XMLWriter(BytesIO())
g = TupleVariation(AXES, ["String"])
with CapturingLogHandler(log, "ERROR") as captor:
g.toXML(writer, ["wdth"])
self.assertIn("bad delta format", [r.msg for r in captor.records])
self.assertEqual([
'<tuple>',
'<coord axis="wdth" max="0.5" min="0.3" value="0.4"/>',
'<!-- bad delta #0 -->',
'</tuple>',
], TupleVariationTest.xml_lines(writer))
示例3: test_toXML_points
# 需要导入模块: from fontTools.ttLib.tables.TupleVariation import TupleVariation [as 别名]
# 或者: from fontTools.ttLib.tables.TupleVariation.TupleVariation import toXML [as 别名]
def test_toXML_points(self):
writer = XMLWriter(BytesIO())
g = TupleVariation(AXES, [(9,8), None, (7,6), (0,0), (-1,-2), None])
g.toXML(writer, ["wdth", "wght", "opsz"])
self.assertEqual([
'<tuple>',
'<coord axis="wdth" max="0.5" min="0.3" value="0.4"/>',
'<coord axis="wght" value="1.0"/>',
'<coord axis="opsz" value="-0.7"/>',
'<delta pt="0" x="9" y="8"/>',
'<delta pt="2" x="7" y="6"/>',
'<delta pt="3" x="0" y="0"/>',
'<delta pt="4" x="-1" y="-2"/>',
'</tuple>'
], TupleVariationTest.xml_lines(writer))
示例4: test_toXML_constants
# 需要导入模块: from fontTools.ttLib.tables.TupleVariation import TupleVariation [as 别名]
# 或者: from fontTools.ttLib.tables.TupleVariation.TupleVariation import toXML [as 别名]
def test_toXML_constants(self):
writer = XMLWriter(BytesIO())
g = TupleVariation(AXES, [42, None, 23, 0, -17, None])
g.toXML(writer, ["wdth", "wght", "opsz"])
self.assertEqual([
'<tuple>',
'<coord axis="wdth" max="0.5" min="0.3" value="0.4"/>',
'<coord axis="wght" value="1.0"/>',
'<coord axis="opsz" value="-0.7"/>',
'<delta cvt="0" value="42"/>',
'<delta cvt="2" value="23"/>',
'<delta cvt="3" value="0"/>',
'<delta cvt="4" value="-17"/>',
'</tuple>'
], TupleVariationTest.xml_lines(writer))