def test_fromXML(self):
		g = GlyphVariation({}, [None] * 4)
		g.fromXML("coord", {"axis":"wdth", "min":"0.3", "value":"0.4", "max":"0.5"}, [])
		g.fromXML("coord", {"axis":"wght", "value":"1.0"}, [])
		g.fromXML("coord", {"axis":"opsz", "value":"-0.5"}, [])
		g.fromXML("delta", {"pt":"1", "x":"33", "y":"44"}, [])
		g.fromXML("delta", {"pt":"2", "x":"-2", "y":"170"}, [])
		self.assertEqual({
			"wdth":( 0.3,  0.4, 0.5),
			"wght":( 0.0,  1.0, 1.0),
			"opsz":(-0.5, -0.5, 0.0)
		}, g.axes)
		self.assertEqual([None, (33, 44), (-2, 170), None], g.coordinates)
Exemple #2
0
	def test_fromXML(self):
		g = GlyphVariation({}, GlyphCoordinates.zeros(4))
		g.fromXML("coord", {"axis":"wdth", "min":"0.3", "value":"0.4", "max":"0.5"}, [])
		g.fromXML("coord", {"axis":"wght", "value":"1.0"}, [])
		g.fromXML("coord", {"axis":"opsz", "value":"-0.5"}, [])
		g.fromXML("delta", {"pt":"1", "x":"33", "y":"44"}, [])
		g.fromXML("delta", {"pt":"2", "x":"-2", "y":"170"}, [])
		self.assertEqual({
			"wdth":( 0.3,  0.4, 0.5),
			"wght":( 0.0,  1.0, 1.0),
			"opsz":(-0.5, -0.5, 0.0)
		}, g.axes)
		self.assertEqual("0,0 33,44 -2,170 0,0", " ".join(["%d,%d" % c for c in g.coordinates]))
	def test_fromXML(self):
		g = GlyphVariation({}, [None] * 4)
		for name, attrs, content in parseXML(
				'<coord axis="wdth" min="0.3" value="0.4" max="0.5"/>'
				'<coord axis="wght" value="1.0"/>'
				'<coord axis="opsz" value="-0.5"/>'
				'<delta pt="1" x="33" y="44"/>'
				'<delta pt="2" x="-2" y="170"/>'):
			g.fromXML(name, attrs, content)
		self.assertEqual({
			"wdth":( 0.3,  0.4, 0.5),
			"wght":( 0.0,  1.0, 1.0),
			"opsz":(-0.5, -0.5, 0.0)
		}, g.axes)
		self.assertEqual([None, (33, 44), (-2, 170), None], g.coordinates)
Exemple #4
0
 def test_fromXML(self):
     g = GlyphVariation({}, [None] * 4)
     for name, attrs, content in parseXML(
             '<coord axis="wdth" min="0.3" value="0.4" max="0.5"/>'
             '<coord axis="wght" value="1.0"/>'
             '<coord axis="opsz" value="-0.5"/>'
             '<delta pt="1" x="33" y="44"/>'
             '<delta pt="2" x="-2" y="170"/>'):
         g.fromXML(name, attrs, content)
     self.assertEqual(
         {
             "wdth": (0.3, 0.4, 0.5),
             "wght": (0.0, 1.0, 1.0),
             "opsz": (-0.5, -0.5, 0.0)
         }, g.axes)
     self.assertEqual([None, (33, 44), (-2, 170), None], g.coordinates)
Exemple #5
0
 def test_fromXML(self):
     g = GlyphVariation({}, [None] * 4)
     g.fromXML("coord", {
         "axis": "wdth",
         "min": "0.3",
         "value": "0.4",
         "max": "0.5"
     }, [])
     g.fromXML("coord", {"axis": "wght", "value": "1.0"}, [])
     g.fromXML("coord", {"axis": "opsz", "value": "-0.5"}, [])
     g.fromXML("delta", {"pt": "1", "x": "33", "y": "44"}, [])
     g.fromXML("delta", {"pt": "2", "x": "-2", "y": "170"}, [])
     self.assertEqual(
         {
             "wdth": (0.3, 0.4, 0.5),
             "wght": (0.0, 1.0, 1.0),
             "opsz": (-0.5, -0.5, 0.0)
         }, g.axes)
     self.assertEqual([None, (33, 44), (-2, 170), None], g.coordinates)