本文整理汇总了Python中fontTools.ttLib.tables.TupleVariation.TupleVariation.compileCoord方法的典型用法代码示例。如果您正苦于以下问题:Python TupleVariation.compileCoord方法的具体用法?Python TupleVariation.compileCoord怎么用?Python TupleVariation.compileCoord使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fontTools.ttLib.tables.TupleVariation.TupleVariation
的用法示例。
在下文中一共展示了TupleVariation.compileCoord方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_decompileCoord_roundTrip
# 需要导入模块: from fontTools.ttLib.tables.TupleVariation import TupleVariation [as 别名]
# 或者: from fontTools.ttLib.tables.TupleVariation.TupleVariation import compileCoord [as 别名]
def test_decompileCoord_roundTrip(self):
# Make sure we are not affected by https://github.com/behdad/fonttools/issues/286
data = deHexStr("7F B9 80 35")
values, _ = TupleVariation.decompileCoord_(["wght", "wdth"], data, 0)
axisValues = {axis:(val, val, val) for axis, val in values.items()}
var = TupleVariation(axisValues, [None] * 4)
self.assertEqual("7F B9 80 35", hexencode(var.compileCoord(["wght", "wdth"])))
示例2: test_compile_sharedPeaks_nonIntermediate_sharedPoints
# 需要导入模块: from fontTools.ttLib.tables.TupleVariation import TupleVariation [as 别名]
# 或者: from fontTools.ttLib.tables.TupleVariation.TupleVariation import compileCoord [as 别名]
def test_compile_sharedPeaks_nonIntermediate_sharedPoints(self):
var = TupleVariation(
{"wght": (0.0, 0.5, 0.5), "wdth": (0.0, 0.8, 0.8)},
[(7,4), (8,5), (9,6)])
axisTags = ["wght", "wdth"]
sharedPeakIndices = { var.compileCoord(axisTags): 0x77 }
tup, deltas = var.compile(axisTags, sharedPeakIndices,
sharedPoints={0,1,2})
# len(deltas)=8; flags=None; tupleIndex=0x77
# embeddedPeaks=[]; intermediateCoord=[]
self.assertEqual("00 08 00 77", hexencode(tup))
self.assertEqual("02 07 08 09 " # deltaX: [7, 8, 9]
"02 04 05 06", # deltaY: [4, 5, 6]
hexencode(deltas))
示例3: test_compile_sharedPeaks_intermediate_sharedPoints
# 需要导入模块: from fontTools.ttLib.tables.TupleVariation import TupleVariation [as 别名]
# 或者: from fontTools.ttLib.tables.TupleVariation.TupleVariation import compileCoord [as 别名]
def test_compile_sharedPeaks_intermediate_sharedPoints(self):
var = TupleVariation(
{"wght": (0.3, 0.5, 0.7), "wdth": (0.1, 0.8, 0.9)},
[(7,4), (8,5), (9,6)])
axisTags = ["wght", "wdth"]
sharedPeakIndices = { var.compileCoord(axisTags): 0x77 }
tup, deltas = var.compile(axisTags, sharedPeakIndices,
sharedPoints={0,1,2})
# len(deltas)=8; flags=INTERMEDIATE_REGION; tupleIndex=0x77
# embeddedPeak=[]; intermediateCoord=[(0.3, 0.1), (0.7, 0.9)]
self.assertEqual("00 08 40 77 13 33 06 66 2C CD 39 9A", hexencode(tup))
self.assertEqual("02 07 08 09 " # deltaX: [7, 8, 9]
"02 04 05 06", # deltaY: [4, 5, 6]
hexencode(deltas))
示例4: test_compile_sharedPeaks_nonIntermediate_privatePoints
# 需要导入模块: from fontTools.ttLib.tables.TupleVariation import TupleVariation [as 别名]
# 或者: from fontTools.ttLib.tables.TupleVariation.TupleVariation import compileCoord [as 别名]
def test_compile_sharedPeaks_nonIntermediate_privatePoints(self):
var = TupleVariation(
{"wght": (0.0, 0.5, 0.5), "wdth": (0.0, 0.8, 0.8)},
[(7,4), (8,5), (9,6)])
axisTags = ["wght", "wdth"]
sharedPeakIndices = { var.compileCoord(axisTags): 0x77 }
tup, deltas, _ = var.compile(axisTags, sharedPeakIndices,
sharedPoints=None)
# len(deltas)=9; flags=PRIVATE_POINT_NUMBERS; tupleIndex=0x77
# embeddedPeak=[]; intermediateCoord=[]
self.assertEqual("00 09 20 77", hexencode(tup))
self.assertEqual("00 " # all points in glyph
"02 07 08 09 " # deltaX: [7, 8, 9]
"02 04 05 06", # deltaY: [4, 5, 6]
hexencode(deltas))
示例5: test_compileCoord
# 需要导入模块: from fontTools.ttLib.tables.TupleVariation import TupleVariation [as 别名]
# 或者: from fontTools.ttLib.tables.TupleVariation.TupleVariation import compileCoord [as 别名]
def test_compileCoord(self):
var = TupleVariation({"wght": (-1.0, -1.0, -1.0), "wdth": (0.4, 0.5, 0.6)}, [None] * 4)
self.assertEqual("C0 00 20 00", hexencode(var.compileCoord(["wght", "wdth"])))
self.assertEqual("20 00 C0 00", hexencode(var.compileCoord(["wdth", "wght"])))
self.assertEqual("C0 00", hexencode(var.compileCoord(["wght"])))