def test_modified_mkmks(self): font_a = mock_font() fea = """ markClass [acutecomb gravecomb] <anchor 150 -10> @top; feature mark { pos mark @top <anchor 85 354> mark @top; } mark; """ font_a.builder.addOpenTypeFeatures(fea) font_a.recalc_tables() font_b = mock_font() fea = """ markClass [acutecomb gravecomb] <anchor 0 -10> @top; feature mark { pos mark @top <anchor 85 354> mark @top; } mark; """ font_b.builder.addOpenTypeFeatures(fea) font_b.recalc_tables() diff = diff_marks(font_a, font_b, font_a.mkmks, font_b.mkmks, 'mkmks') modified = diff['modified']._data self.assertNotEqual(modified, []) self.assertEqual(len(modified), 4)
def test_modified_base_mark(self): font_a = mock_font() fea = """ markClass [acutecomb] <anchor 150 -10> @top; feature mark { pos base [A] <anchor 85 354> mark @top; } mark; """ font_a.builder.addOpenTypeFeatures(fea) font_a.recalc_tables() font_b = mock_font() fea = """ markClass [acutecomb] <anchor 150 -10> @top; feature mark { pos base [A] <anchor 65 354> mark @top; } mark; """ font_b.builder.addOpenTypeFeatures(fea) font_b.recalc_tables() diff = diff_marks(font_a, font_b, font_a.marks, font_b.marks, "marks") modified = diff['modified']._data self.assertNotEqual(modified, [])
def test_upm_scale_modified_marks(self): font_a = mock_font() font_a.builder.updateHead(unitsPerEm=1000) fea = """ markClass [acutecomb] <anchor 150 0> @top; feature mark { pos base [A] <anchor 100 300> mark @top; } mark; """ font_a.builder.addOpenTypeFeatures(fea) font_a.recalc_tables() font_b = mock_font() font_b.builder.updateHead(unitsPerEm=2000) fea = """ markClass [acutecomb] <anchor 300 0> @top; feature mark { pos base [A] <anchor 200 600> mark @top; } mark; """ font_b.builder.addOpenTypeFeatures(fea) font_b.recalc_tables() diff = diff_marks(font_a, font_b, font_a.marks, font_b.marks, "marks") modified = diff['modified']._data self.assertEqual(modified, [])
def test_missing_mkmks(self): font_a = mock_font() fea = """ markClass [acutecomb gravecomb] <anchor 150 -10> @top; feature mkmk { pos mark @top <anchor 85 354> mark @top; } mkmk; """ font_a.builder.addOpenTypeFeatures(fea) font_a.recalc_tables() font_b = mock_font() diff = diff_marks(font_a, font_b, font_a.mkmks, font_b.mkmks, 'mkmks') missing = diff['missing']._data self.assertNotEqual(missing, [])
def test_missing_base_mark(self): font_a = mock_font() fea = """ markClass [acutecomb] <anchor 150 -10> @top; feature mark { pos base [A V] <anchor 85 354> mark @top; } mark; """ font_a.builder.addOpenTypeFeatures(fea) font_a.recalc_tables() font_b = mock_font() diff = diff_marks(font_a, font_b, font_a.marks, font_b.marks, 'marks') missing = diff['missing']._data self.assertNotEqual(missing, []) # Diffenator will only return missing and new marks betweeen # matching glyph sets. If font_b is missing many glyphs which # have marks in font_a, these won't be reported. If the user # add the glyphs to font_b without the marks, then it will # get reported. self.assertEqual(len(missing), 2)