From 4acbdc464a6d5edc4bdf4c54fbae24c1e21c55e3 Mon Sep 17 00:00:00 2001 From: Nikolaus Waxweiler Date: Tue, 5 Jul 2022 18:17:10 +0100 Subject: [PATCH] Test rounding of floaty carets --- .../featureWriters/gdefFeatureWriter_test.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/featureWriters/gdefFeatureWriter_test.py b/tests/featureWriters/gdefFeatureWriter_test.py index 0a1779a76..20000206a 100644 --- a/tests/featureWriters/gdefFeatureWriter_test.py +++ b/tests/featureWriters/gdefFeatureWriter_test.py @@ -210,6 +210,25 @@ def test_vertical_carets(self, testufo): """ ) + def test_floaty_carets(self, testufo): + # Some Glyphs sources happen to contain fractional caret positions. + # In the Adobe feature file syntax (and binary OpenType GDEF tables), + # caret positions must be integers. + liga = testufo.newGlyph("li_ga") + liga.appendAnchor({"name": "vcaret_1", "x": 0, "y": 200.1111}) + liga.appendAnchor({"name": "caret_1", "x": 499.9876, "y": 0}) + + newFea = self.writeGDEF(testufo) + assert str(newFea) == dedent( + """\ + table GDEF { + LigatureCaretByPos f_f_i 200 400; + LigatureCaretByPos f_i 200; + LigatureCaretByPos li_ga 200 500; + } GDEF; + """ + ) + def test_getOpenTypeCategories_invalid(self, testufo, caplog): caplog.set_level(logging.WARNING) testufo.lib["public.openTypeCategories"] = {