From e0d96a1a591a37bc539e1cde5fce8c39a201623f Mon Sep 17 00:00:00 2001 From: Simon Cozens Date: Wed, 27 Jul 2022 13:20:17 +0100 Subject: [PATCH] Some tests for variable feature writing Add test for different feature writers Fix up test expectations This should now test the variable features --- tests/data/TestVarfea-Bold.ufo/fontinfo.plist | 36 + .../glyphs/alef-ar.fina.glif | 31 + .../TestVarfea-Bold.ufo/glyphs/contents.plist | 16 + .../glyphs/dotabove-ar.glif | 31 + .../glyphs/layerinfo.plist | 19 + .../peh-ar.init.B_R_A_C_K_E_T_.varA_lt01.glif | 77 +++ .../glyphs/peh-ar.init.glif | 84 +++ .../TestVarfea-Bold.ufo/glyphs/space.glif | 13 + tests/data/TestVarfea-Bold.ufo/kerning.plist | 11 + .../TestVarfea-Bold.ufo/layercontents.plist | 10 + tests/data/TestVarfea-Bold.ufo/lib.plist | 80 +++ tests/data/TestVarfea-Bold.ufo/metainfo.plist | 10 + .../TestVarfea-Regular.ufo/fontinfo.plist | 48 ++ .../glyphs/alef-ar.fina.glif | 31 + .../glyphs/contents.plist | 16 + .../glyphs/dotabove-ar.glif | 31 + .../glyphs/layerinfo.plist | 19 + .../peh-ar.init.B_R_A_C_K_E_T_.varA_lt01.glif | 77 +++ .../glyphs/peh-ar.init.glif | 84 +++ .../TestVarfea-Regular.ufo/glyphs/space.glif | 13 + .../data/TestVarfea-Regular.ufo/kerning.plist | 11 + .../layercontents.plist | 10 + tests/data/TestVarfea-Regular.ufo/lib.plist | 74 ++ .../TestVarfea-Regular.ufo/metainfo.plist | 10 + tests/data/TestVarfea.designspace | 30 + tests/data/TestVarfea.glyphs | 646 ++++++++++++++++++ tests/data/TestVariableFont-CFF2-cffsubr.ttx | 2 +- tests/data/TestVariableFont-CFF2-post3.ttx | 2 +- ...stVariableFont-CFF2-useProductionNames.ttx | 2 +- tests/data/TestVariableFont-CFF2.ttx | 2 +- tests/data/TestVariableFont-TTF-post3.ttx | 2 +- ...estVariableFont-TTF-useProductionNames.ttx | 2 +- tests/data/TestVariableFont-TTF.ttx | 2 +- .../variableFeatureWriter_test.py | 54 ++ tests/integration_test.py | 21 +- 35 files changed, 1597 insertions(+), 10 deletions(-) create mode 100644 tests/data/TestVarfea-Bold.ufo/fontinfo.plist create mode 100644 tests/data/TestVarfea-Bold.ufo/glyphs/alef-ar.fina.glif create mode 100644 tests/data/TestVarfea-Bold.ufo/glyphs/contents.plist create mode 100644 tests/data/TestVarfea-Bold.ufo/glyphs/dotabove-ar.glif create mode 100644 tests/data/TestVarfea-Bold.ufo/glyphs/layerinfo.plist create mode 100644 tests/data/TestVarfea-Bold.ufo/glyphs/peh-ar.init.B_R_A_C_K_E_T_.varA_lt01.glif create mode 100644 tests/data/TestVarfea-Bold.ufo/glyphs/peh-ar.init.glif create mode 100644 tests/data/TestVarfea-Bold.ufo/glyphs/space.glif create mode 100644 tests/data/TestVarfea-Bold.ufo/kerning.plist create mode 100644 tests/data/TestVarfea-Bold.ufo/layercontents.plist create mode 100644 tests/data/TestVarfea-Bold.ufo/lib.plist create mode 100644 tests/data/TestVarfea-Bold.ufo/metainfo.plist create mode 100644 tests/data/TestVarfea-Regular.ufo/fontinfo.plist create mode 100644 tests/data/TestVarfea-Regular.ufo/glyphs/alef-ar.fina.glif create mode 100644 tests/data/TestVarfea-Regular.ufo/glyphs/contents.plist create mode 100644 tests/data/TestVarfea-Regular.ufo/glyphs/dotabove-ar.glif create mode 100644 tests/data/TestVarfea-Regular.ufo/glyphs/layerinfo.plist create mode 100644 tests/data/TestVarfea-Regular.ufo/glyphs/peh-ar.init.B_R_A_C_K_E_T_.varA_lt01.glif create mode 100644 tests/data/TestVarfea-Regular.ufo/glyphs/peh-ar.init.glif create mode 100644 tests/data/TestVarfea-Regular.ufo/glyphs/space.glif create mode 100644 tests/data/TestVarfea-Regular.ufo/kerning.plist create mode 100644 tests/data/TestVarfea-Regular.ufo/layercontents.plist create mode 100644 tests/data/TestVarfea-Regular.ufo/lib.plist create mode 100644 tests/data/TestVarfea-Regular.ufo/metainfo.plist create mode 100644 tests/data/TestVarfea.designspace create mode 100644 tests/data/TestVarfea.glyphs create mode 100644 tests/featureWriters/variableFeatureWriter_test.py diff --git a/tests/data/TestVarfea-Bold.ufo/fontinfo.plist b/tests/data/TestVarfea-Bold.ufo/fontinfo.plist new file mode 100644 index 000000000..d6b5d7964 --- /dev/null +++ b/tests/data/TestVarfea-Bold.ufo/fontinfo.plist @@ -0,0 +1,36 @@ + + + + + ascender + 600 + capHeight + 700 + descender + -400 + familyName + TestVarfea + italicAngle + 0 + openTypeHeadCreated + 2022/07/26 14:49:29 + openTypeOS2Type + + 3 + + postscriptUnderlinePosition + -100 + postscriptUnderlineThickness + 50 + styleName + Bold + unitsPerEm + 1000 + versionMajor + 1 + versionMinor + 0 + xHeight + 500 + + diff --git a/tests/data/TestVarfea-Bold.ufo/glyphs/alef-ar.fina.glif b/tests/data/TestVarfea-Bold.ufo/glyphs/alef-ar.fina.glif new file mode 100644 index 000000000..873945f8e --- /dev/null +++ b/tests/data/TestVarfea-Bold.ufo/glyphs/alef-ar.fina.glif @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + com.schriftgestaltung.Glyphs.lastChange + 2023/11/20 16:51:14 + + + diff --git a/tests/data/TestVarfea-Bold.ufo/glyphs/contents.plist b/tests/data/TestVarfea-Bold.ufo/glyphs/contents.plist new file mode 100644 index 000000000..4572eabab --- /dev/null +++ b/tests/data/TestVarfea-Bold.ufo/glyphs/contents.plist @@ -0,0 +1,16 @@ + + + + + alef-ar.fina + alef-ar.fina.glif + dotabove-ar + dotabove-ar.glif + peh-ar.init + peh-ar.init.glif + peh-ar.init.BRACKET.varAlt01 + peh-ar.init.B_R_A_C_K_E_T_.varA_lt01.glif + space + space.glif + + diff --git a/tests/data/TestVarfea-Bold.ufo/glyphs/dotabove-ar.glif b/tests/data/TestVarfea-Bold.ufo/glyphs/dotabove-ar.glif new file mode 100644 index 000000000..05dde66a1 --- /dev/null +++ b/tests/data/TestVarfea-Bold.ufo/glyphs/dotabove-ar.glif @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + com.schriftgestaltung.Glyphs.lastChange + 2023/11/20 16:50:50 + com.schriftgestaltung.Glyphs.originalWidth + 300 + + + diff --git a/tests/data/TestVarfea-Bold.ufo/glyphs/layerinfo.plist b/tests/data/TestVarfea-Bold.ufo/glyphs/layerinfo.plist new file mode 100644 index 000000000..82fbc0d82 --- /dev/null +++ b/tests/data/TestVarfea-Bold.ufo/glyphs/layerinfo.plist @@ -0,0 +1,19 @@ + + + + + lib + + com.schriftgestaltung.layerId + B1C208F5-A14F-4863-B7E7-1D4BAD4C88B2 + com.schriftgestaltung.layerOrderInGlyph.alef-ar.fina + 1 + com.schriftgestaltung.layerOrderInGlyph.dotabove-ar + 1 + com.schriftgestaltung.layerOrderInGlyph.peh-ar.init + 1 + com.schriftgestaltung.layerOrderInGlyph.space + 1 + + + diff --git a/tests/data/TestVarfea-Bold.ufo/glyphs/peh-ar.init.B_R_A_C_K_E_T_.varA_lt01.glif b/tests/data/TestVarfea-Bold.ufo/glyphs/peh-ar.init.B_R_A_C_K_E_T_.varA_lt01.glif new file mode 100644 index 000000000..82cc961e3 --- /dev/null +++ b/tests/data/TestVarfea-Bold.ufo/glyphs/peh-ar.init.B_R_A_C_K_E_T_.varA_lt01.glif @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + com.schriftgestaltung.Glyphs._originalLayerName + 26 Jul 22, 15:59 + com.schriftgestaltung.Glyphs.lastChange + 2022/07/27 08:01:34 + + + diff --git a/tests/data/TestVarfea-Bold.ufo/glyphs/peh-ar.init.glif b/tests/data/TestVarfea-Bold.ufo/glyphs/peh-ar.init.glif new file mode 100644 index 000000000..a8e87507e --- /dev/null +++ b/tests/data/TestVarfea-Bold.ufo/glyphs/peh-ar.init.glif @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + com.schriftgestaltung.Glyphs.lastChange + 2022/07/27 08:01:34 + + + diff --git a/tests/data/TestVarfea-Bold.ufo/glyphs/space.glif b/tests/data/TestVarfea-Bold.ufo/glyphs/space.glif new file mode 100644 index 000000000..fa922f49a --- /dev/null +++ b/tests/data/TestVarfea-Bold.ufo/glyphs/space.glif @@ -0,0 +1,13 @@ + + + + + + + + + com.schriftgestaltung.Glyphs.lastChange + 2022/07/26 15:00:45 + + + diff --git a/tests/data/TestVarfea-Bold.ufo/kerning.plist b/tests/data/TestVarfea-Bold.ufo/kerning.plist new file mode 100644 index 000000000..6bf0bd2ab --- /dev/null +++ b/tests/data/TestVarfea-Bold.ufo/kerning.plist @@ -0,0 +1,11 @@ + + + + + alef-ar.fina + + alef-ar.fina + 35 + + + diff --git a/tests/data/TestVarfea-Bold.ufo/layercontents.plist b/tests/data/TestVarfea-Bold.ufo/layercontents.plist new file mode 100644 index 000000000..b9c1a4f27 --- /dev/null +++ b/tests/data/TestVarfea-Bold.ufo/layercontents.plist @@ -0,0 +1,10 @@ + + + + + + public.default + glyphs + + + diff --git a/tests/data/TestVarfea-Bold.ufo/lib.plist b/tests/data/TestVarfea-Bold.ufo/lib.plist new file mode 100644 index 000000000..d4c4a8cc2 --- /dev/null +++ b/tests/data/TestVarfea-Bold.ufo/lib.plist @@ -0,0 +1,80 @@ + + + + + GSCornerRadius + 15 + GSOffsetHorizontal + -30 + GSOffsetVertical + -25 + com.github.googlei18n.ufo2ft.filters + + + name + eraseOpenCorners + namespace + glyphsLib.filters + pre + + + + com.schriftgestaltung.appVersion + 3217 + com.schriftgestaltung.customParameter.GSFont.DisplayStrings + + اا + /dotabove-ar + + com.schriftgestaltung.customParameter.GSFont.disablesAutomaticAlignment + + com.schriftgestaltung.customParameter.GSFont.useNiceNames + 1 + com.schriftgestaltung.customParameter.GSFontMaster.customValue + 0 + com.schriftgestaltung.customParameter.GSFontMaster.customValue1 + 0 + com.schriftgestaltung.customParameter.GSFontMaster.customValue2 + 0 + com.schriftgestaltung.customParameter.GSFontMaster.customValue3 + 0 + com.schriftgestaltung.customParameter.GSFontMaster.iconName + Bold + com.schriftgestaltung.customParameter.GSFontMaster.weightValue + 1000 + com.schriftgestaltung.customParameter.GSFontMaster.widthValue + 100 + com.schriftgestaltung.fontMasterID + B1C208F5-A14F-4863-B7E7-1D4BAD4C88B2 + com.schriftgestaltung.fontMasterOrder + 1 + com.schriftgestaltung.keyboardIncrement + 1 + com.schriftgestaltung.weight + Regular + com.schriftgestaltung.weightValue + 1000 + com.schriftgestaltung.width + Regular + com.schriftgestaltung.widthValue + 100 + public.glyphOrder + + alef-ar.fina + peh-ar.init + space + dotabove-ar + + public.postscriptNames + + alef-ar.fina + uniFE8E + dotabove-ar + dotabovear + peh-ar.init + uniFB58 + peh-ar.init.BRACKET.varAlt01 + uniFB58.BRACKET.varAlt01 + + + diff --git a/tests/data/TestVarfea-Bold.ufo/metainfo.plist b/tests/data/TestVarfea-Bold.ufo/metainfo.plist new file mode 100644 index 000000000..7b8b34ac6 --- /dev/null +++ b/tests/data/TestVarfea-Bold.ufo/metainfo.plist @@ -0,0 +1,10 @@ + + + + + creator + com.github.fonttools.ufoLib + formatVersion + 3 + + diff --git a/tests/data/TestVarfea-Regular.ufo/fontinfo.plist b/tests/data/TestVarfea-Regular.ufo/fontinfo.plist new file mode 100644 index 000000000..9f3eadf5e --- /dev/null +++ b/tests/data/TestVarfea-Regular.ufo/fontinfo.plist @@ -0,0 +1,48 @@ + + + + + ascender + 600 + capHeight + 0 + descender + -400 + familyName + TestVarfea + italicAngle + 0 + openTypeHeadCreated + 2022/07/26 14:49:29 + openTypeOS2Type + + 3 + + postscriptBlueValues + + -16 + 0 + 600 + 616 + + postscriptOtherBlues + + -416 + -400 + + postscriptUnderlinePosition + -100 + postscriptUnderlineThickness + 50 + styleName + Regular + unitsPerEm + 1000 + versionMajor + 1 + versionMinor + 0 + xHeight + 0 + + diff --git a/tests/data/TestVarfea-Regular.ufo/glyphs/alef-ar.fina.glif b/tests/data/TestVarfea-Regular.ufo/glyphs/alef-ar.fina.glif new file mode 100644 index 000000000..dfd599570 --- /dev/null +++ b/tests/data/TestVarfea-Regular.ufo/glyphs/alef-ar.fina.glif @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + com.schriftgestaltung.Glyphs.lastChange + 2023/11/20 16:51:14 + + + diff --git a/tests/data/TestVarfea-Regular.ufo/glyphs/contents.plist b/tests/data/TestVarfea-Regular.ufo/glyphs/contents.plist new file mode 100644 index 000000000..4572eabab --- /dev/null +++ b/tests/data/TestVarfea-Regular.ufo/glyphs/contents.plist @@ -0,0 +1,16 @@ + + + + + alef-ar.fina + alef-ar.fina.glif + dotabove-ar + dotabove-ar.glif + peh-ar.init + peh-ar.init.glif + peh-ar.init.BRACKET.varAlt01 + peh-ar.init.B_R_A_C_K_E_T_.varA_lt01.glif + space + space.glif + + diff --git a/tests/data/TestVarfea-Regular.ufo/glyphs/dotabove-ar.glif b/tests/data/TestVarfea-Regular.ufo/glyphs/dotabove-ar.glif new file mode 100644 index 000000000..d9ec3589f --- /dev/null +++ b/tests/data/TestVarfea-Regular.ufo/glyphs/dotabove-ar.glif @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + com.schriftgestaltung.Glyphs.lastChange + 2023/11/20 16:50:50 + com.schriftgestaltung.Glyphs.originalWidth + 300 + + + diff --git a/tests/data/TestVarfea-Regular.ufo/glyphs/layerinfo.plist b/tests/data/TestVarfea-Regular.ufo/glyphs/layerinfo.plist new file mode 100644 index 000000000..e4d188f0a --- /dev/null +++ b/tests/data/TestVarfea-Regular.ufo/glyphs/layerinfo.plist @@ -0,0 +1,19 @@ + + + + + lib + + com.schriftgestaltung.layerId + m01 + com.schriftgestaltung.layerOrderInGlyph.alef-ar.fina + 0 + com.schriftgestaltung.layerOrderInGlyph.dotabove-ar + 0 + com.schriftgestaltung.layerOrderInGlyph.peh-ar.init + 0 + com.schriftgestaltung.layerOrderInGlyph.space + 0 + + + diff --git a/tests/data/TestVarfea-Regular.ufo/glyphs/peh-ar.init.B_R_A_C_K_E_T_.varA_lt01.glif b/tests/data/TestVarfea-Regular.ufo/glyphs/peh-ar.init.B_R_A_C_K_E_T_.varA_lt01.glif new file mode 100644 index 000000000..26c13c38c --- /dev/null +++ b/tests/data/TestVarfea-Regular.ufo/glyphs/peh-ar.init.B_R_A_C_K_E_T_.varA_lt01.glif @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + com.schriftgestaltung.Glyphs._originalLayerName + 26 Jul 22, 15:58 + com.schriftgestaltung.Glyphs.lastChange + 2022/07/27 08:01:34 + + + diff --git a/tests/data/TestVarfea-Regular.ufo/glyphs/peh-ar.init.glif b/tests/data/TestVarfea-Regular.ufo/glyphs/peh-ar.init.glif new file mode 100644 index 000000000..03c6ba3ad --- /dev/null +++ b/tests/data/TestVarfea-Regular.ufo/glyphs/peh-ar.init.glif @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + com.schriftgestaltung.Glyphs.lastChange + 2022/07/27 08:01:34 + + + diff --git a/tests/data/TestVarfea-Regular.ufo/glyphs/space.glif b/tests/data/TestVarfea-Regular.ufo/glyphs/space.glif new file mode 100644 index 000000000..ad61b901c --- /dev/null +++ b/tests/data/TestVarfea-Regular.ufo/glyphs/space.glif @@ -0,0 +1,13 @@ + + + + + + + + + com.schriftgestaltung.Glyphs.lastChange + 2022/07/26 15:00:45 + + + diff --git a/tests/data/TestVarfea-Regular.ufo/kerning.plist b/tests/data/TestVarfea-Regular.ufo/kerning.plist new file mode 100644 index 000000000..696a1f403 --- /dev/null +++ b/tests/data/TestVarfea-Regular.ufo/kerning.plist @@ -0,0 +1,11 @@ + + + + + alef-ar.fina + + alef-ar.fina + 15 + + + diff --git a/tests/data/TestVarfea-Regular.ufo/layercontents.plist b/tests/data/TestVarfea-Regular.ufo/layercontents.plist new file mode 100644 index 000000000..b9c1a4f27 --- /dev/null +++ b/tests/data/TestVarfea-Regular.ufo/layercontents.plist @@ -0,0 +1,10 @@ + + + + + + public.default + glyphs + + + diff --git a/tests/data/TestVarfea-Regular.ufo/lib.plist b/tests/data/TestVarfea-Regular.ufo/lib.plist new file mode 100644 index 000000000..0b5415f31 --- /dev/null +++ b/tests/data/TestVarfea-Regular.ufo/lib.plist @@ -0,0 +1,74 @@ + + + + + com.github.googlei18n.ufo2ft.filters + + + name + eraseOpenCorners + namespace + glyphsLib.filters + pre + + + + com.schriftgestaltung.appVersion + 3217 + com.schriftgestaltung.customParameter.GSFont.DisplayStrings + + اا + /dotabove-ar + + com.schriftgestaltung.customParameter.GSFont.disablesAutomaticAlignment + + com.schriftgestaltung.customParameter.GSFont.useNiceNames + 1 + com.schriftgestaltung.customParameter.GSFontMaster.customValue + 0 + com.schriftgestaltung.customParameter.GSFontMaster.customValue1 + 0 + com.schriftgestaltung.customParameter.GSFontMaster.customValue2 + 0 + com.schriftgestaltung.customParameter.GSFontMaster.customValue3 + 0 + com.schriftgestaltung.customParameter.GSFontMaster.iconName + + com.schriftgestaltung.customParameter.GSFontMaster.weightValue + 100 + com.schriftgestaltung.customParameter.GSFontMaster.widthValue + 100 + com.schriftgestaltung.fontMasterID + m01 + com.schriftgestaltung.fontMasterOrder + 0 + com.schriftgestaltung.keyboardIncrement + 1 + com.schriftgestaltung.weight + Regular + com.schriftgestaltung.weightValue + 100 + com.schriftgestaltung.width + Regular + com.schriftgestaltung.widthValue + 100 + public.glyphOrder + + alef-ar.fina + peh-ar.init + space + dotabove-ar + + public.postscriptNames + + alef-ar.fina + uniFE8E + dotabove-ar + dotabovear + peh-ar.init + uniFB58 + peh-ar.init.BRACKET.varAlt01 + uniFB58.BRACKET.varAlt01 + + + diff --git a/tests/data/TestVarfea-Regular.ufo/metainfo.plist b/tests/data/TestVarfea-Regular.ufo/metainfo.plist new file mode 100644 index 000000000..7b8b34ac6 --- /dev/null +++ b/tests/data/TestVarfea-Regular.ufo/metainfo.plist @@ -0,0 +1,10 @@ + + + + + creator + com.github.fonttools.ufoLib + formatVersion + 3 + + diff --git a/tests/data/TestVarfea.designspace b/tests/data/TestVarfea.designspace new file mode 100644 index 000000000..aa7a1a614 --- /dev/null +++ b/tests/data/TestVarfea.designspace @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/data/TestVarfea.glyphs b/tests/data/TestVarfea.glyphs new file mode 100644 index 000000000..5c0e945d2 --- /dev/null +++ b/tests/data/TestVarfea.glyphs @@ -0,0 +1,646 @@ +{ +.appVersion = "3217"; +.formatVersion = 3; +DisplayStrings = ( +"اا", +"/dotabove-ar" +); +axes = ( +{ +name = Weight; +tag = wght; +} +); +date = "2022-07-26 14:49:29 +0000"; +familyName = TestVarfea; +fontMaster = ( +{ +axesValues = ( +100 +); +id = m01; +metricValues = ( +{ +over = 16; +pos = 600; +}, +{ +over = -16; +}, +{ +over = -16; +pos = -400; +}, +{ +}, +{ +} +); +name = Regular; +}, +{ +axesValues = ( +1000 +); +iconName = Bold; +id = "B1C208F5-A14F-4863-B7E7-1D4BAD4C88B2"; +metricValues = ( +{ +pos = 600; +}, +{ +}, +{ +pos = -400; +}, +{ +pos = 700; +}, +{ +pos = 500; +} +); +name = Bold; +userData = { +GSCornerRadius = 15; +GSOffsetHorizontal = -30; +GSOffsetVertical = -25; +}; +} +); +glyphs = ( +{ +glyphname = "alef-ar.fina"; +lastChange = "2023-11-20 16:51:14 +0000"; +layers = ( +{ +anchors = ( +{ +name = entry; +pos = (299,97); +}, +{ +name = top; +pos = (211,730); +} +); +layerId = m01; +shapes = ( +{ +closed = 1; +nodes = ( +(270,173,o), +(283,133,o), +(321,118,cs), +(375,97,o), +(403,105,o), +(466,133,c), +(491,13,l), +(427,-19,o), +(381,-25,o), +(336,-25,cs), +(139,-25,o), +(160,121,o), +(160,569,c), +(270,601,l) +); +} +); +width = 600; +}, +{ +anchors = ( +{ +name = entry; +pos = (330,115); +}, +{ +name = top; +pos = (214,797); +} +); +layerId = "B1C208F5-A14F-4863-B7E7-1D4BAD4C88B2"; +shapes = ( +{ +closed = 1; +nodes = ( +(297,173,o), +(310,133,o), +(348,118,cs), +(402,97,o), +(433,86,o), +(487,123,c), +(565,-41,l), +(501,-73,o), +(400,-76,o), +(355,-76,cs), +(108,-76,o), +(137,121,o), +(137,569,c), +(297,601,l) +); +} +); +width = 600; +} +); +unicode = 1575; +}, +{ +glyphname = "peh-ar.init"; +lastChange = "2022-07-27 08:01:34 +0000"; +layers = ( +{ +anchors = ( +{ +name = exit; +pos = (161,54); +} +); +layerId = m01; +shapes = ( +{ +closed = 1; +nodes = ( +(466,268,l), +(450,61,o), +(400,-33,o), +(291,-56,cs), +(165,-84,o), +(107,-64,o), +(67,22,c), +(67,130,l), +(124,89,o), +(185,67,o), +(241,67,cs), +(332,67,o), +(370,122,o), +(378,268,c) +); +}, +{ +closed = 1; +nodes = ( +(164,-235,ls), +(158,-241,o), +(158,-250,o), +(164,-257,cs), +(250,-347,ls), +(256,-354,o), +(265,-354,o), +(272,-347,cs), +(362,-261,ls), +(368,-255,o), +(368,-246,o), +(362,-239,cs), +(276,-149,ls), +(270,-142,o), +(261,-142,o), +(254,-149,cs) +); +}, +{ +closed = 1; +nodes = ( +(384,-235,ls), +(378,-241,o), +(378,-250,o), +(384,-257,cs), +(470,-347,ls), +(476,-354,o), +(485,-354,o), +(492,-347,cs), +(582,-261,ls), +(588,-255,o), +(588,-246,o), +(582,-239,cs), +(496,-149,ls), +(490,-142,o), +(481,-142,o), +(474,-149,cs) +); +}, +{ +closed = 1; +nodes = ( +(264,-435,ls), +(258,-441,o), +(258,-450,o), +(264,-457,cs), +(350,-547,ls), +(356,-554,o), +(365,-554,o), +(372,-547,cs), +(462,-461,ls), +(468,-455,o), +(468,-446,o), +(462,-439,cs), +(376,-349,ls), +(370,-342,o), +(361,-342,o), +(354,-349,cs) +); +} +); +width = 600; +}, +{ +anchors = ( +{ +name = exit; +pos = (73,89); +} +); +layerId = "B1C208F5-A14F-4863-B7E7-1D4BAD4C88B2"; +shapes = ( +{ +closed = 1; +nodes = ( +(525,322,l), +(509,19,o), +(513,14,o), +(342,-63,cs), +(232,-113,o), +(142,-102,o), +(61,-87,c), +(61,104,l), +(104,84,o), +(139,75,o), +(167,75,cs), +(252,75,o), +(277,161,o), +(291,322,c) +); +}, +{ +closed = 1; +nodes = ( +(115,-208,ls), +(107,-215,o), +(107,-228,o), +(115,-236,cs), +(221,-347,ls), +(229,-355,o), +(241,-354,o), +(248,-347,cs), +(359,-241,ls), +(367,-233,o), +(367,-222,o), +(359,-213,cs), +(253,-102,ls), +(246,-94,o), +(233,-95,o), +(226,-102,cs) +); +}, +{ +closed = 1; +nodes = ( +(387,-208,ls), +(379,-216,o), +(379,-227,o), +(387,-236,cs), +(493,-347,ls), +(500,-355,o), +(513,-354,o), +(520,-347,cs), +(631,-241,ls), +(639,-234,o), +(639,-221,o), +(631,-213,cs), +(525,-102,ls), +(517,-94,o), +(505,-95,o), +(498,-102,cs) +); +}, +{ +closed = 1; +nodes = ( +(238,-455,ls), +(230,-462,o), +(230,-475,o), +(238,-483,cs), +(345,-594,ls), +(352,-602,o), +(364,-601,o), +(372,-594,cs), +(483,-488,ls), +(491,-481,o), +(491,-468,o), +(483,-460,cs), +(377,-349,ls), +(369,-341,o), +(357,-342,o), +(350,-349,cs) +); +} +); +width = 600; +}, +{ +anchors = ( +{ +name = exit; +pos = (89,53); +} +); +associatedMasterId = m01; +attr = { +axisRules = ( +{ +min = 600; +} +); +}; +layerId = "8B3F4CCE-5E0D-437E-916C-4646A5030CF3"; +name = "26 Jul 22, 15:58"; +shapes = ( +{ +closed = 1; +nodes = ( +(490,215,l), +(469,-10,o), +(412,-54,o), +(266,-54,cs), +(161,-54,o), +(90,-27,o), +(67,22,c), +(67,130,l), +(137,80,o), +(173,67,o), +(241,67,cs), +(291,67,o), +(315,118,o), +(325,290,c) +); +}, +{ +closed = 1; +nodes = ( +(194,-235,ls), +(188,-241,o), +(188,-250,o), +(194,-257,cs), +(280,-347,ls), +(286,-354,o), +(296,-353,o), +(302,-347,cs), +(369,-283,l), +(430,-347,ls), +(436,-354,o), +(446,-353,o), +(452,-347,cs), +(542,-261,ls), +(548,-255,o), +(548,-246,o), +(542,-239,cs), +(456,-149,ls), +(450,-142,o), +(440,-143,o), +(434,-149,cs), +(367,-213,l), +(306,-149,ls), +(300,-142,o), +(290,-143,o), +(284,-149,cs) +); +}, +{ +closed = 1; +nodes = ( +(264,-435,ls), +(258,-441,o), +(258,-450,o), +(264,-457,cs), +(350,-547,ls), +(356,-554,o), +(366,-553,o), +(372,-547,cs), +(462,-461,ls), +(468,-455,o), +(468,-446,o), +(462,-439,cs), +(376,-349,ls), +(370,-342,o), +(360,-343,o), +(354,-349,cs) +); +} +); +width = 600; +}, +{ +anchors = ( +{ +name = exit; +pos = (73,85); +} +); +associatedMasterId = "B1C208F5-A14F-4863-B7E7-1D4BAD4C88B2"; +attr = { +axisRules = ( +{ +min = 600; +} +); +}; +layerId = "3CC1DB06-AB7B-409C-841A-4209D835026A"; +name = "26 Jul 22, 15:59"; +shapes = ( +{ +closed = 1; +nodes = ( +(525,322,l), +(509,19,o), +(513,14,o), +(342,-63,cs), +(232,-113,o), +(142,-102,o), +(61,-87,c), +(61,104,l), +(104,84,o), +(139,75,o), +(167,75,cs), +(252,75,o), +(277,161,o), +(291,322,c) +); +}, +{ +closed = 1; +nodes = ( +(153,-223,ls), +(146,-230,o), +(145,-242,o), +(153,-250,cs), +(259,-361,ls), +(267,-370,o), +(279,-369,o), +(287,-361,cs), +(369,-282,l), +(445,-361,ls), +(453,-369,o), +(464,-369,o), +(472,-361,cs), +(583,-255,ls), +(590,-248,o), +(590,-236,o), +(583,-228,cs), +(477,-117,ls), +(469,-108,o), +(457,-109,o), +(449,-117,cs), +(367,-196,l), +(291,-117,ls), +(283,-109,o), +(272,-109,o), +(264,-117,cs) +); +}, +{ +closed = 1; +nodes = ( +(208,-495,ls), +(199,-504,o), +(198,-519,o), +(208,-529,cs), +(339,-666,ls), +(348,-676,o), +(364,-675,o), +(373,-666,cs), +(510,-535,ls), +(520,-526,o), +(520,-511,o), +(510,-501,cs), +(379,-364,ls), +(369,-354,o), +(354,-355,o), +(345,-364,cs) +); +} +); +width = 600; +} +); +unicode = 1662; +}, +{ +glyphname = space; +lastChange = "2022-07-26 15:00:45 +0000"; +layers = ( +{ +layerId = m01; +width = 200; +}, +{ +layerId = "B1C208F5-A14F-4863-B7E7-1D4BAD4C88B2"; +width = 600; +} +); +unicode = 32; +}, +{ +glyphname = "dotabove-ar"; +lastChange = "2023-11-20 16:50:50 +0000"; +layers = ( +{ +anchors = ( +{ +name = _top; +pos = (100,320); +} +); +layerId = m01; +shapes = ( +{ +closed = 1; +nodes = ( +(104,232,l), +(160,271,o), +(187,303,o), +(187,326,cs), +(187,349,o), +(170,372,o), +(109,411,c), +(100,411,l), +(83,400,o), +(30,341,o), +(13,315,c), +(13,306,l), +(40,285,o), +(68,260,o), +(96,232,c) +); +} +); +width = 300; +}, +{ +anchors = ( +{ +name = _top; +pos = (125,416); +} +); +layerId = "B1C208F5-A14F-4863-B7E7-1D4BAD4C88B2"; +shapes = ( +{ +closed = 1; +nodes = ( +(129,292,l), +(180,328,o), +(231,372,o), +(231,409,cs), +(231,445,o), +(196,472,o), +(135,511,c), +(124,511,l), +(105,499,o), +(38,425,o), +(18,393,c), +(18,382,l), +(50,359,o), +(60,350,o), +(120,292,c) +); +} +); +width = 300; +} +); +} +); +kerningLTR = { +m01 = { +"alef-ar.fina" = { +"alef-ar.fina" = 15; +}; +}; +"B1C208F5-A14F-4863-B7E7-1D4BAD4C88B2" = { +"alef-ar.fina" = { +"alef-ar.fina" = 35; +}; +}; +}; +metrics = ( +{ +type = ascender; +}, +{ +type = baseline; +}, +{ +type = descender; +}, +{ +type = "cap height"; +}, +{ +type = "x-height"; +} +); +unitsPerEm = 1000; +versionMajor = 1; +versionMinor = 0; +} diff --git a/tests/data/TestVariableFont-CFF2-cffsubr.ttx b/tests/data/TestVariableFont-CFF2-cffsubr.ttx index 4c419daff..dac243d8c 100644 --- a/tests/data/TestVariableFont-CFF2-cffsubr.ttx +++ b/tests/data/TestVariableFont-CFF2-cffsubr.ttx @@ -328,7 +328,7 @@ - + diff --git a/tests/data/TestVariableFont-CFF2-post3.ttx b/tests/data/TestVariableFont-CFF2-post3.ttx index cd04b1786..2bcf217c3 100644 --- a/tests/data/TestVariableFont-CFF2-post3.ttx +++ b/tests/data/TestVariableFont-CFF2-post3.ttx @@ -305,7 +305,7 @@ - + diff --git a/tests/data/TestVariableFont-CFF2-useProductionNames.ttx b/tests/data/TestVariableFont-CFF2-useProductionNames.ttx index 4f408373b..32797c15b 100644 --- a/tests/data/TestVariableFont-CFF2-useProductionNames.ttx +++ b/tests/data/TestVariableFont-CFF2-useProductionNames.ttx @@ -322,7 +322,7 @@ - + diff --git a/tests/data/TestVariableFont-CFF2.ttx b/tests/data/TestVariableFont-CFF2.ttx index 9c821cabf..1c23cf79c 100644 --- a/tests/data/TestVariableFont-CFF2.ttx +++ b/tests/data/TestVariableFont-CFF2.ttx @@ -319,7 +319,7 @@ - + diff --git a/tests/data/TestVariableFont-TTF-post3.ttx b/tests/data/TestVariableFont-TTF-post3.ttx index 1ba0a4760..2204c9de0 100644 --- a/tests/data/TestVariableFont-TTF-post3.ttx +++ b/tests/data/TestVariableFont-TTF-post3.ttx @@ -308,7 +308,7 @@ - + diff --git a/tests/data/TestVariableFont-TTF-useProductionNames.ttx b/tests/data/TestVariableFont-TTF-useProductionNames.ttx index 10ecb8e3a..0f56bab9f 100644 --- a/tests/data/TestVariableFont-TTF-useProductionNames.ttx +++ b/tests/data/TestVariableFont-TTF-useProductionNames.ttx @@ -325,7 +325,7 @@ - + diff --git a/tests/data/TestVariableFont-TTF.ttx b/tests/data/TestVariableFont-TTF.ttx index dd20b8de5..17b36d8ac 100644 --- a/tests/data/TestVariableFont-TTF.ttx +++ b/tests/data/TestVariableFont-TTF.ttx @@ -322,7 +322,7 @@ - + diff --git a/tests/featureWriters/variableFeatureWriter_test.py b/tests/featureWriters/variableFeatureWriter_test.py new file mode 100644 index 000000000..92092c65e --- /dev/null +++ b/tests/featureWriters/variableFeatureWriter_test.py @@ -0,0 +1,54 @@ +import io +from textwrap import dedent + +from fontTools import designspaceLib + +from ufo2ft import compileVariableTTF + + +def test_variable_features(FontClass): + tmp = io.StringIO() + designspace = designspaceLib.DesignSpaceDocument.fromfile( + "tests/data/TestVarfea.designspace" + ) + designspace.loadSourceFonts(FontClass) + _ = compileVariableTTF(designspace, debugFeatureFile=tmp) + + assert dedent("\n" + tmp.getvalue()) == dedent( + """ + markClass dotabove-ar @MC_top; + + lookup kern_Arab { + lookupflag IgnoreMarks; + pos alef-ar.fina alef-ar.fina <(wght=100:15 wght=1000:35) 0 (wght=100:15 wght=1000:35) 0>; + } kern_Arab; + + feature kern { + script DFLT; + language dflt; + lookup kern_Arab; + + script arab; + language dflt; + lookup kern_Arab; + } kern; + + feature mark { + lookup mark2base { + pos base alef-ar.fina + mark @MC_top; + } mark2base; + + } mark; + + feature curs { + lookup curs { + lookupflag RightToLeft IgnoreMarks; + pos cursive alef-ar.fina ; + pos cursive peh-ar.init ; + pos cursive peh-ar.init.BRACKET.varAlt01 ; + } curs; + + } curs; +""" # noqa: B950 + ) diff --git a/tests/integration_test.py b/tests/integration_test.py index 05c2ba0dd..0eb2a038f 100644 --- a/tests/integration_test.py +++ b/tests/integration_test.py @@ -4,6 +4,7 @@ import re import sys from pathlib import Path +from textwrap import dedent import pytest from fontTools.pens.boundsPen import BoundsPen @@ -241,9 +242,23 @@ def test_debugFeatureFile(self, designspace): tmp = io.StringIO() _ = compileVariableTTF(designspace, debugFeatureFile=tmp) - - assert "### LayerFont-Regular ###" in tmp.getvalue() - assert "### LayerFont-Bold ###" in tmp.getvalue() + assert "\n" + tmp.getvalue() == dedent( + """ + markClass dotabovecomb @MC_top; + + feature liga { + sub a e s s by s; + } liga; + + feature mark { + lookup mark2base { + pos base e + mark @MC_top; + } mark2base; + + } mark; + """ # noqa: B950 + ) @pytest.mark.parametrize( "output_format, options, expected_ttx",