From 58cbf7b814e62772493dce9c069cc3c6959e56fe Mon Sep 17 00:00:00 2001 From: Cosimo Lupo Date: Tue, 7 Jan 2020 12:57:11 +0000 Subject: [PATCH 1/2] otTables_test: get XML dumps for expected MarkBasePos split subtables This tests will fail because of this bug: https://github.com/googlefonts/noto-source/issues/145 The mark records' Class values of the second subtable should be updated to match the new class count (the two split subtable contain half of the original mark classes). Otherwise the base records would implicitly reference the wrong or non-existent mark classes... The fix is in the following commit. --- Tests/ttLib/tables/otTables_test.py | 93 +++++++++++++++++++++++++---- 1 file changed, 80 insertions(+), 13 deletions(-) diff --git a/Tests/ttLib/tables/otTables_test.py b/Tests/ttLib/tables/otTables_test.py index 4afe2dbff..bd4daeb9d 100644 --- a/Tests/ttLib/tables/otTables_test.py +++ b/Tests/ttLib/tables/otTables_test.py @@ -605,20 +605,87 @@ def test_splitMarkBasePos(): ok = otTables.splitMarkBasePos(oldSubTable, newSubTable, overflowRecord=None) assert ok - assert oldSubTable.Format == newSubTable.Format - assert oldSubTable.MarkCoverage.glyphs == [ - "acutecomb", "gravecomb" + + assert getXML(oldSubTable.toXML) == [ + '', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + '', + ] + + assert getXML(newSubTable.toXML) == [ + '', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + '', ] - assert newSubTable.MarkCoverage.glyphs == ["cedillacomb"] - assert newSubTable.MarkCoverage.Format == 1 - assert oldSubTable.BaseCoverage.glyphs == newSubTable.BaseCoverage.glyphs - assert newSubTable.BaseCoverage.Format == 1 - assert oldSubTable.ClassCount == newSubTable.ClassCount == 1 - assert oldSubTable.MarkArray.MarkCount == 2 - assert newSubTable.MarkArray.MarkCount == 1 - assert oldSubTable.BaseArray.BaseCount == newSubTable.BaseArray.BaseCount - assert newSubTable.BaseArray.BaseRecord[0].BaseAnchor[0] is None - assert newSubTable.BaseArray.BaseRecord[1].BaseAnchor[0] == buildAnchor(300, 0) if __name__ == "__main__": From 504450e053591c99632180ec8ee2f11de510e43f Mon Sep 17 00:00:00 2001 From: Cosimo Lupo Date: Tue, 7 Jan 2020 13:24:40 +0000 Subject: [PATCH 2/2] otTables: update MarkRecord.Class in splitMarkBasePos Fixes https://github.com/googlefonts/noto-source/issues/145 --- Lib/fontTools/ttLib/tables/otTables.py | 1 + 1 file changed, 1 insertion(+) diff --git a/Lib/fontTools/ttLib/tables/otTables.py b/Lib/fontTools/ttLib/tables/otTables.py index fa00ca054..302c9b2fe 100644 --- a/Lib/fontTools/ttLib/tables/otTables.py +++ b/Lib/fontTools/ttLib/tables/otTables.py @@ -1415,6 +1415,7 @@ def splitMarkBasePos(oldSubTable, newSubTable, overflowRecord): oldMarkCoverage.append(glyphName) oldMarkRecords.append(markRecord) else: + markRecord.Class -= oldClassCount newMarkCoverage.append(glyphName) newMarkRecords.append(markRecord)