Lines Matching refs:varfont
50 def _get_coordinates(varfont, glyphname): argument
53 return list(varfont["glyf"].getCoordinatesAndControls(glyphname, varfont)[0])
113 def test_pin_and_drop_axis(self, varfont, glyph_name, location, expected, optimize): argument
114 instancer.instantiateGvar(varfont, location, optimize=optimize)
116 assert _get_coordinates(varfont, glyph_name) == expected[glyph_name]
121 for tuples in varfont["gvar"].variations.values()
125 def test_full_instance(self, varfont, optimize): argument
127 varfont, {"wght": 0.0, "wdth": -0.5}, optimize=optimize
130 assert _get_coordinates(varfont, "hyphen") == [
141 assert "gvar" not in varfont
143 def test_composite_glyph_not_in_gvar(self, varfont): argument
149 hmtx = varfont["hmtx"]
150 vmtx = varfont["vmtx"]
152 hyphenCoords = _get_coordinates(varfont, "hyphen")
166 minusCoords = _get_coordinates(varfont, "minus")
173 instancer.instantiateGvar(varfont, location)
176 assert _get_coordinates(varfont, "hyphen") == [
188 assert _get_coordinates(varfont, "minus") == minusCoords
207 def test_pin_and_drop_axis(self, varfont, location, expected): argument
208 instancer.instantiateCvar(varfont, location)
210 assert list(varfont["cvt "].values) == expected
215 axis in t.axes for t in varfont["cvar"].variations for axis in pinned_axes
218 def test_full_instance(self, varfont): argument
219 instancer.instantiateCvar(varfont, {"wght": -0.5, "wdth": -0.5})
221 assert list(varfont["cvt "].values) == [500, -400, 165, 225]
223 assert "cvar" not in varfont
262 def test_pin_and_drop_axis(self, varfont, location, expected): argument
263 mvar = varfont["MVAR"].table
274 instancer.instantiateMVAR(varfont, location)
278 assert getattr(varfont[table_tag], item_name) == expected_value
313 def test_full_instance(self, varfont, location, expected): argument
314 instancer.instantiateMVAR(varfont, location)
318 assert getattr(varfont[table_tag], item_name) == expected_value
320 assert "MVAR" not in varfont
345 def test_partial_instance(self, varfont, location, expectedRegions, expectedDeltas): argument
346 instancer.instantiateHVAR(varfont, location)
348 assert "HVAR" in varfont
349 hvar = varfont["HVAR"].table
353 fvarAxes = [a for a in varfont["fvar"].axes if a.axisTag not in location]
377 def test_full_instance(self, varfont): argument
378 instancer.instantiateHVAR(varfont, {"wght": 0, "wdth": 0})
380 assert "HVAR" not in varfont
382 def test_partial_instance_keep_empty_table(self, varfont): argument
387 fvar = varfont["fvar"]
392 instancer.instantiateHVAR(varfont, {"wght": 0, "wdth": 0})
394 assert "HVAR" in varfont
396 varStore = varfont["HVAR"].table.VarStore
942 def test_pin_and_drop_axis(self, varfont, location): argument
943 instancer.instantiateAvar(varfont, location)
945 assert set(varfont["avar"].segments).isdisjoint(location)
947 def test_full_instance(self, varfont): argument
948 instancer.instantiateAvar(varfont, {"wght": 0.0, "wdth": 0.0})
950 assert "avar" not in varfont
975 def varfont(self): member in InstantiateAvarTest
981 varfont = ttLib.TTFont()
982 varfont["name"] = ttLib.newTable("name")
983 varLib._add_fvar(varfont, _makeDSAxesDict(fvarAxes), instances=())
984 avar = varfont["avar"] = ttLib.newTable("avar")
986 return varfont
1114 def test_limit_axes(self, varfont, axisLimits, expectedSegments): argument
1115 instancer.instantiateAvar(varfont, axisLimits)
1117 newSegments = varfont["avar"].segments
1135 def test_drop_invalid_segment_map(self, varfont, invalidSegmentMap, caplog): argument
1136 varfont["avar"].segments["wght"] = invalidSegmentMap
1139 instancer.instantiateAvar(varfont, {"wght": (100, 400)})
1142 assert "wght" not in varfont["avar"].segments
1185 def test_pin_and_drop_axis(self, varfont, location, instancesLeft): argument
1186 instancer.instantiateFvar(varfont, location)
1188 fvar = varfont["fvar"]
1194 name = varfont["name"]
1199 def test_full_instance(self, varfont): argument
1200 instancer.instantiateFvar(varfont, {"wght": 0.0, "wdth": 0.0})
1202 assert "fvar" not in varfont
1213 def test_pin_and_drop_axis(self, varfont, location, expected): argument
1214 instancer.instantiateSTAT(varfont, location)
1216 stat = varfont["STAT"].table
1221 name = varfont["name"]
1229 def test_skip_table_no_axis_value_array(self, varfont): argument
1230 varfont["STAT"].table.AxisValueArray = None
1232 instancer.instantiateSTAT(varfont, {"wght": 100})
1234 assert len(varfont["STAT"].table.DesignAxisRecord.Axis) == 3
1235 assert varfont["STAT"].table.AxisValueArray is None
1237 def test_skip_table_axis_value_array_empty(self, varfont): argument
1238 varfont["STAT"].table.AxisValueArray.AxisValue = []
1240 instancer.instantiateSTAT(varfont, {"wght": 100})
1242 assert len(varfont["STAT"].table.DesignAxisRecord.Axis) == 3
1243 assert not varfont["STAT"].table.AxisValueArray.AxisValue
1245 def test_skip_table_no_design_axes(self, varfont): argument
1251 varfont["STAT"].table = stat
1253 instancer.instantiateSTAT(varfont, {"wght": 100})
1255 assert not varfont["STAT"].table.DesignAxisRecord
1482 varfont = ttLib.TTFont()
1483 varfont.setGlyphOrder(sorted(glyphs))
1485 fvar = varfont["fvar"] = ttLib.newTable("fvar")
1492 featureVars.addFeatureVariations(varfont, conditionalSubstitutions)
1494 return varfont
1647 varfont = ttLib.TTFont(tmp)
1651 assert varfont["GSUB"].table.FeatureVariations is None
1652 instancer.instantiateFeatureVariations(varfont, {"wght": 400, "wdth": 100})
1653 assert varfont["GSUB"].table.FeatureVariations is None
1869 def test_normalizeAxisLimits_tuple(varfont): argument
1870 normalized = instancer.normalizeAxisLimits(varfont, {"wght": (100, 400)})
1874 def test_normalizeAxisLimits_unsupported_range(varfont): argument
1876 instancer.normalizeAxisLimits(varfont, {"wght": (401, 700)})
1879 def test_normalizeAxisLimits_no_avar(varfont): argument
1880 del varfont["avar"]
1882 normalized = instancer.normalizeAxisLimits(varfont, {"wght": (400, 500)})
1887 def test_normalizeAxisLimits_missing_from_fvar(varfont): argument
1889 instancer.normalizeAxisLimits(varfont, {"ZZZZ": 1000})
1892 def test_sanityCheckVariableTables(varfont): argument
1897 del varfont["glyf"]
1900 instancer.sanityCheckVariableTables(varfont)
1903 def test_main(varfont, tmpdir): argument
1905 varfont.save(fontfile)
1920 def test_main_exit_invalid_location(varfont, tmpdir, capsys): argument
1922 varfont.save(fontfile)
1931 def test_main_exit_multiple_limits(varfont, tmpdir, capsys): argument
1933 varfont.save(fontfile)