本文整理匯總了Python中fontTools.ttLib.tables._f_v_a_r.NamedInstance.flags方法的典型用法代碼示例。如果您正苦於以下問題:Python NamedInstance.flags方法的具體用法?Python NamedInstance.flags怎麽用?Python NamedInstance.flags使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類fontTools.ttLib.tables._f_v_a_r.NamedInstance
的用法示例。
在下文中一共展示了NamedInstance.flags方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_toXML_withoutPostScriptName
# 需要導入模塊: from fontTools.ttLib.tables._f_v_a_r import NamedInstance [as 別名]
# 或者: from fontTools.ttLib.tables._f_v_a_r.NamedInstance import flags [as 別名]
def test_toXML_withoutPostScriptName(self):
font = MakeFont()
inst = NamedInstance()
inst.flags = 0xABC
inst.subfamilyNameID = AddName(font, "Light Condensed").nameID
inst.coordinates = {"wght": 0.7, "wdth": 0.5}
writer = XMLWriter(BytesIO())
inst.toXML(writer, font)
self.assertEqual([
'',
'<!-- Light Condensed -->',
'<NamedInstance flags="0xABC" subfamilyNameID="%s">' %
inst.subfamilyNameID,
'<coord axis="wght" value="0.7"/>',
'<coord axis="wdth" value="0.5"/>',
'</NamedInstance>'
], xml_lines(writer))
示例2: test_toXML
# 需要導入模塊: from fontTools.ttLib.tables._f_v_a_r import NamedInstance [as 別名]
# 或者: from fontTools.ttLib.tables._f_v_a_r.NamedInstance import flags [as 別名]
def test_toXML(self):
font = MakeFont()
inst = NamedInstance()
inst.nameID = AddName(font, "Light Condensed").nameID
inst.flags = 0x1234
inst.coordinates = {"wght": 0.7, "wdth": 0.5}
writer = XMLWriter(StringIO())
inst.toXML(writer, font)
self.assertEqual(
[
"",
"<!-- Light Condensed -->",
'<NamedInstance flags="00010010 00110100" nameID="%s">' % inst.nameID,
'<coord axis="wght" value="0.7"/>',
'<coord axis="wdth" value="0.5"/>',
"</NamedInstance>",
],
xml_lines(writer),
)
示例3: test_compile
# 需要導入模塊: from fontTools.ttLib.tables._f_v_a_r import NamedInstance [as 別名]
# 或者: from fontTools.ttLib.tables._f_v_a_r.NamedInstance import flags [as 別名]
def test_compile(self):
inst = NamedInstance()
inst.nameID = 345
inst.flags = 0x1234
inst.coordinates = {"wght": 0.7, "wdth": 0.5}
self.assertEqual(FVAR_INSTANCE_DATA, inst.compile(["wght", "wdth"]))