当前位置: 首页>>代码示例>>Python>>正文


Python TupleVariation.toXML方法代码示例

本文整理汇总了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))
开发者ID:anthrotype,项目名称:fonttools,代码行数:13,代码来源:TupleVariation_test.py

示例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))
开发者ID:anthrotype,项目名称:fonttools,代码行数:14,代码来源:TupleVariation_test.py

示例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))
开发者ID:anthrotype,项目名称:fonttools,代码行数:17,代码来源:TupleVariation_test.py

示例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))
开发者ID:anthrotype,项目名称:fonttools,代码行数:17,代码来源:TupleVariation_test.py


注:本文中的fontTools.ttLib.tables.TupleVariation.TupleVariation.toXML方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。