aboutsummaryrefslogtreecommitdiff
path: root/Tests/subset
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2021-04-01 15:12:06 -0700
committerElliott Hughes <enh@google.com>2021-04-01 15:12:06 -0700
commit6cf80b8fa7eece3694d7375ff5de9a7f2cd19f7e (patch)
tree8e925d800e27f7a70c2b6a131b14526bc0f095b5 /Tests/subset
parent0e9d14bbfdfd2a1bf74c38eed07dc9b0ddf0162f (diff)
downloadfonttools-6cf80b8fa7eece3694d7375ff5de9a7f2cd19f7e.tar.gz
Upgrade fonttools to 4.22.0android-s-beta-2android-s-beta-1
Test: make Change-Id: I69cdb494f27868e707969c325386f039e5ea0e45
Diffstat (limited to 'Tests/subset')
-rw-r--r--Tests/subset/data/GPOS_PairPos_Format2_ClassDef1_useClass0.subset.ttx62
-rw-r--r--Tests/subset/data/GPOS_PairPos_Format2_ClassDef2_useClass0.subset.ttx17
-rw-r--r--Tests/subset/data/GPOS_PairPos_Format2_PR_2221.ttx322
-rw-r--r--Tests/subset/data/Lobster.subset.ttx8
-rw-r--r--Tests/subset/data/TestContextSubstFormat3.ttx28
-rw-r--r--Tests/subset/data/expect_keep_math.ttx12
-rw-r--r--Tests/subset/data/expect_layout_scripts.ttx6
-rw-r--r--Tests/subset/data/layout_scripts.ttx12
-rw-r--r--Tests/subset/data/test_cntrmask_CFF.ttx10
-rw-r--r--Tests/subset/subset_test.py37
10 files changed, 473 insertions, 41 deletions
diff --git a/Tests/subset/data/GPOS_PairPos_Format2_ClassDef1_useClass0.subset.ttx b/Tests/subset/data/GPOS_PairPos_Format2_ClassDef1_useClass0.subset.ttx
new file mode 100644
index 00000000..3df9aa8f
--- /dev/null
+++ b/Tests/subset/data/GPOS_PairPos_Format2_ClassDef1_useClass0.subset.ttx
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ttFont sfntVersion="OTTO" ttLibVersion="4.21">
+
+ <GPOS>
+ <Version value="0x00010000"/>
+ <ScriptList>
+ <!-- ScriptCount=1 -->
+ <ScriptRecord index="0">
+ <ScriptTag value="latn"/>
+ <Script>
+ <DefaultLangSys>
+ <ReqFeatureIndex value="65535"/>
+ <!-- FeatureCount=1 -->
+ <FeatureIndex index="0" value="0"/>
+ </DefaultLangSys>
+ <!-- LangSysCount=0 -->
+ </Script>
+ </ScriptRecord>
+ </ScriptList>
+ <FeatureList>
+ <!-- FeatureCount=1 -->
+ <FeatureRecord index="0">
+ <FeatureTag value="test"/>
+ <Feature>
+ <!-- LookupCount=1 -->
+ <LookupListIndex index="0" value="0"/>
+ </Feature>
+ </FeatureRecord>
+ </FeatureList>
+ <LookupList>
+ <!-- LookupCount=1 -->
+ <Lookup index="0">
+ <LookupType value="2"/>
+ <LookupFlag value="0"/>
+ <!-- SubTableCount=1 -->
+ <PairPos index="0" Format="2">
+ <Coverage>
+ <Glyph value="g33"/>
+ </Coverage>
+ <ValueFormat1 value="1"/>
+ <ValueFormat2 value="0"/>
+ <ClassDef1>
+ </ClassDef1>
+ <ClassDef2>
+ <ClassDef glyph="g33" class="1"/>
+ </ClassDef2>
+ <!-- Class1Count=1 -->
+ <!-- Class2Count=2 -->
+ <Class1Record index="0">
+ <Class2Record index="0">
+ <Value1 XPlacement="0"/>
+ </Class2Record>
+ <Class2Record index="1">
+ <Value1 XPlacement="-100"/>
+ </Class2Record>
+ </Class1Record>
+ </PairPos>
+ </Lookup>
+ </LookupList>
+ </GPOS>
+
+</ttFont>
diff --git a/Tests/subset/data/GPOS_PairPos_Format2_ClassDef2_useClass0.subset.ttx b/Tests/subset/data/GPOS_PairPos_Format2_ClassDef2_useClass0.subset.ttx
new file mode 100644
index 00000000..dc599f13
--- /dev/null
+++ b/Tests/subset/data/GPOS_PairPos_Format2_ClassDef2_useClass0.subset.ttx
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ttFont sfntVersion="OTTO" ttLibVersion="4.21">
+
+ <GPOS>
+ <Version value="0x00010000"/>
+ <ScriptList>
+ <!-- ScriptCount=0 -->
+ </ScriptList>
+ <FeatureList>
+ <!-- FeatureCount=0 -->
+ </FeatureList>
+ <LookupList>
+ <!-- LookupCount=0 -->
+ </LookupList>
+ </GPOS>
+
+</ttFont>
diff --git a/Tests/subset/data/GPOS_PairPos_Format2_PR_2221.ttx b/Tests/subset/data/GPOS_PairPos_Format2_PR_2221.ttx
new file mode 100644
index 00000000..d5132d15
--- /dev/null
+++ b/Tests/subset/data/GPOS_PairPos_Format2_PR_2221.ttx
@@ -0,0 +1,322 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ttFont sfntVersion="OTTO" ttLibVersion="4.21">
+
+ <GlyphOrder>
+ <!-- The 'id' attribute is only for humans; it is ignored when parsed. -->
+ <GlyphID id="0" name=".notdef"/>
+ <GlyphID id="1" name="g33"/>
+ <GlyphID id="2" name="g35"/>
+ </GlyphOrder>
+
+ <head>
+ <!-- Most of this table will be recalculated by the compiler -->
+ <tableVersion value="1.0"/>
+ <fontRevision value="1.0"/>
+ <checkSumAdjustment value="0x3d6ba467"/>
+ <magicNumber value="0x5f0f3cf5"/>
+ <flags value="00000000 00000001"/>
+ <unitsPerEm value="1500"/>
+ <created value="Thu Jan 1 00:00:00 1970"/>
+ <modified value="Mon Mar 29 14:18:07 2021"/>
+ <xMin value="24"/>
+ <yMin value="-31"/>
+ <xMax value="1000"/>
+ <yMax value="689"/>
+ <macStyle value="00000000 00000000"/>
+ <lowestRecPPEM value="3"/>
+ <fontDirectionHint value="2"/>
+ <indexToLocFormat value="0"/>
+ <glyphDataFormat value="0"/>
+ </head>
+
+ <hhea>
+ <tableVersion value="0x00010000"/>
+ <ascent value="2500"/>
+ <descent value="0"/>
+ <lineGap value="200"/>
+ <advanceWidthMax value="1500"/>
+ <minLeftSideBearing value="300"/>
+ <minRightSideBearing value="224"/>
+ <xMaxExtent value="1276"/>
+ <caretSlopeRise value="1"/>
+ <caretSlopeRun value="0"/>
+ <caretOffset value="0"/>
+ <reserved0 value="0"/>
+ <reserved1 value="0"/>
+ <reserved2 value="0"/>
+ <reserved3 value="0"/>
+ <metricDataFormat value="0"/>
+ <numberOfHMetrics value="1"/>
+ </hhea>
+
+ <maxp>
+ <tableVersion value="0x5000"/>
+ <numGlyphs value="3"/>
+ </maxp>
+
+ <OS_2>
+ <!-- The fields 'usFirstCharIndex' and 'usLastCharIndex'
+ will be recalculated by the compiler -->
+ <version value="2"/>
+ <xAvgCharWidth value="2500"/>
+ <usWeightClass value="400"/>
+ <usWidthClass value="5"/>
+ <fsType value="00000000 00001100"/>
+ <ySubscriptXSize value="500"/>
+ <ySubscriptYSize value="500"/>
+ <ySubscriptXOffset value="250"/>
+ <ySubscriptYOffset value="50"/>
+ <ySuperscriptXSize value="500"/>
+ <ySuperscriptYSize value="500"/>
+ <ySuperscriptXOffset value="0"/>
+ <ySuperscriptYOffset value="500"/>
+ <yStrikeoutSize value="50"/>
+ <yStrikeoutPosition value="500"/>
+ <sFamilyClass value="0"/>
+ <panose>
+ <bFamilyType value="2"/>
+ <bSerifStyle value="10"/>
+ <bWeight value="6"/>
+ <bProportion value="3"/>
+ <bContrast value="6"/>
+ <bStrokeVariation value="5"/>
+ <bArmStyle value="11"/>
+ <bLetterForm value="2"/>
+ <bMidline value="2"/>
+ <bXHeight value="4"/>
+ </panose>
+ <ulUnicodeRange1 value="00000000 00000000 00000000 00000001"/>
+ <ulUnicodeRange2 value="00000000 00000000 00000000 00000000"/>
+ <ulUnicodeRange3 value="00000000 00000000 00000000 00000000"/>
+ <ulUnicodeRange4 value="00000000 00000000 00000000 00000000"/>
+ <achVendID value="ADBE"/>
+ <fsSelection value="00000000 01000000"/>
+ <usFirstCharIndex value="33"/>
+ <usLastCharIndex value="35"/>
+ <sTypoAscender value="2500"/>
+ <sTypoDescender value="0"/>
+ <sTypoLineGap value="200"/>
+ <usWinAscent value="2500"/>
+ <usWinDescent value="0"/>
+ <ulCodePageRange1 value="11100000 00111111 00000001 11111111"/>
+ <ulCodePageRange2 value="11111111 11111111 00000000 00000000"/>
+ <sxHeight value="2500"/>
+ <sCapHeight value="2500"/>
+ <usDefaultChar value="65"/>
+ <usBreakChar value="65"/>
+ <usMaxContext value="0"/>
+ </OS_2>
+
+ <name>
+ <namerecord nameID="1" platformID="3" platEncID="1" langID="0x409">
+ gpos2_2_font5
+ </namerecord>
+ <namerecord nameID="2" platformID="3" platEncID="1" langID="0x409">
+ Regular
+ </namerecord>
+ <namerecord nameID="3" platformID="3" platEncID="1" langID="0x409">
+ gpos2_2_font5
+ </namerecord>
+ <namerecord nameID="4" platformID="3" platEncID="1" langID="0x409">
+ gpos2_2_font5
+ </namerecord>
+ <namerecord nameID="5" platformID="3" platEncID="1" langID="0x409">
+ Version1.0
+ </namerecord>
+ <namerecord nameID="6" platformID="3" platEncID="1" langID="0x409">
+ gpos2_2_font5
+ </namerecord>
+ </name>
+
+ <cmap>
+ <tableVersion version="0"/>
+ <cmap_format_4 platformID="3" platEncID="1" language="0">
+ <map code="0x21" name="g33"/><!-- EXCLAMATION MARK -->
+ <map code="0x23" name="g35"/><!-- NUMBER SIGN -->
+ </cmap_format_4>
+ </cmap>
+
+ <post>
+ <formatType value="3.0"/>
+ <italicAngle value="0.0"/>
+ <underlinePosition value="-100"/>
+ <underlineThickness value="50"/>
+ <isFixedPitch value="0"/>
+ <minMemType42 value="0"/>
+ <maxMemType42 value="0"/>
+ <minMemType1 value="0"/>
+ <maxMemType1 value="0"/>
+ </post>
+
+ <CFF>
+ <major value="1"/>
+ <minor value="0"/>
+ <CFFFont name="dummy">
+ <version value="001.000"/>
+ <Notice value="Copyright (c) 2002 Adobe Systems Incorporated. All Rights Reserved."/>
+ <FullName value="dummy"/>
+ <FamilyName value="dummy"/>
+ <Weight value="Regular"/>
+ <isFixedPitch value="0"/>
+ <ItalicAngle value="0"/>
+ <UnderlinePosition value="-125"/>
+ <UnderlineThickness value="50"/>
+ <PaintType value="0"/>
+ <CharstringType value="2"/>
+ <FontMatrix value="0.0008 0 0 0.0008 0 0"/>
+ <UniqueID value="44788"/>
+ <FontBBox value="24 -31 1000 689"/>
+ <StrokeWidth value="0"/>
+ <!-- charset is dumped separately as the 'GlyphOrder' element -->
+ <Encoding name="StandardEncoding"/>
+ <Private>
+ <BlueValues value="-25 0 657 682 439 464 640 653 708 733 475 500"/>
+ <OtherBlues value="283 308 -251 -226 -154 -129 -194 -169"/>
+ <FamilyBlues value="-25 0 657 682 439 464 640 653 708 733 475 500"/>
+ <FamilyOtherBlues value="283 308 -251 -226 -154 -129 -194 -169"/>
+ <BlueScale value="0.039625"/>
+ <BlueShift value="7"/>
+ <BlueFuzz value="1"/>
+ <StdHW value="32"/>
+ <StdVW value="85"/>
+ <StemSnapH value="32"/>
+ <StemSnapV value="85 90"/>
+ <ForceBold value="0"/>
+ <LanguageGroup value="0"/>
+ <ExpansionFactor value="0.06"/>
+ <initialRandomSeed value="0"/>
+ <defaultWidthX value="2500"/>
+ <nominalWidthX value="2500"/>
+ <Subrs>
+ <!-- The 'index' attribute is only for humans; it is ignored when parsed. -->
+ <CharString index="0">
+ 92 580 rmoveto
+ 13 6 13 7 14 4 54 16 184 1 9 -81 1 -13 -3 -13 -3 -14 -9 -45 -124 -14 -42 -8 rrcurveto
+ -2 -2 1 -1 hhcurveto
+ -2 vlineto
+ -30 -15 5 -40 35 -4 60 -5 62 -4 47 -43 83 -75 -108 -134 -82 -20 -75 -17 -101 91 -42 -14 -22 -8 -7 -18 10 -21 2 -2 2 -2 1 -2 10 -10 11 -3 10 2 rrcurveto
+ 2 2 -1 1 hhcurveto
+ 16 -7 15 -7 15 -7 33 -14 33 -14 35 -7 103 -18 81 94 48 78 51 83 -64 98 -77 36 -4 1 -3 2 -4 2 17 7 16 9 15 12 77 61 -32 107 -79 40 -91 47 -115 -9 -91 -40 rrcurveto
+ -27 -24 18 -37 36 7 rrcurveto
+ 408 -580 rmoveto
+ return
+ </CharString>
+ <CharString index="1">
+ 41 642 rmoveto
+ 1 -2 1 -1 -1 vvcurveto
+ -7 2 -7 5 -5 vhcurveto
+ 15 -69 -71 -105 61 -45 71 -50 214 60 48 -116 9 -20 3 -24 -3 -22 -13 -128 -51 -35 -120 -6 -38 -1 -62 -5 -26 34 -29 22 -33 -28 16 -33 39 -51 75 0 59 2 83 5 76 21 49 69 rrcurveto
+ 25 36 0 48 11 42 19 72 -43 43 -42 45 -62 68 -159 -25 -76 26 -20 43 44 56 -6 66 101 14 102 -5 103 -1 37 7 0 42 -35 11 -109 1 -110 5 -108 -17 rrcurveto
+ -1 1 0 0 1 vvcurveto
+ -25 33 -45 -26 18 -38 rrcurveto
+ 407 -673 rmoveto
+ return
+ </CharString>
+ </Subrs>
+ </Private>
+ <CharStrings>
+ <CharString name=".notdef">
+ endchar
+ </CharString>
+ <CharString name="g33">
+ -107 callsubr
+ -107 callsubr
+ endchar
+ </CharString>
+ <CharString name="g35">
+ -107 callsubr
+ -106 callsubr
+ endchar
+ </CharString>
+ </CharStrings>
+ </CFFFont>
+
+ <GlobalSubrs>
+ <!-- The 'index' attribute is only for humans; it is ignored when parsed. -->
+ </GlobalSubrs>
+ </CFF>
+
+ <GPOS>
+ <Version value="0x00010000"/>
+ <ScriptList>
+ <!-- ScriptCount=1 -->
+ <ScriptRecord index="0">
+ <ScriptTag value="latn"/>
+ <Script>
+ <DefaultLangSys>
+ <ReqFeatureIndex value="65535"/>
+ <!-- FeatureCount=1 -->
+ <FeatureIndex index="0" value="0"/>
+ </DefaultLangSys>
+ <!-- LangSysCount=0 -->
+ </Script>
+ </ScriptRecord>
+ </ScriptList>
+ <FeatureList>
+ <!-- FeatureCount=1 -->
+ <FeatureRecord index="0">
+ <FeatureTag value="test"/>
+ <Feature>
+ <!-- LookupCount=1 -->
+ <LookupListIndex index="0" value="0"/>
+ </Feature>
+ </FeatureRecord>
+ </FeatureList>
+ <LookupList>
+ <!-- LookupCount=1 -->
+ <Lookup index="0">
+ <LookupType value="2"/>
+ <LookupFlag value="0"/>
+ <!-- SubTableCount=1 -->
+ <PairPos index="0" Format="2">
+ <Coverage Format="1">
+ <Glyph value="g33"/>
+ <Glyph value="g35"/>
+ </Coverage>
+ <ValueFormat1 value="1"/>
+ <ValueFormat2 value="0"/>
+ <ClassDef1 Format="1">
+ <ClassDef glyph="g33" class="1"/>
+ <ClassDef glyph="g35" class="2"/>
+ </ClassDef1>
+ <ClassDef2 Format="1">
+ <ClassDef glyph="g33" class="1"/>
+ </ClassDef2>
+ <!-- Class1Count=3 -->
+ <!-- Class2Count=2 -->
+ <Class1Record index="0">
+ <Class2Record index="0">
+ <Value1 XPlacement="0"/>
+ </Class2Record>
+ <Class2Record index="1">
+ <Value1 XPlacement="0"/>
+ </Class2Record>
+ </Class1Record>
+ <Class1Record index="1">
+ <Class2Record index="0">
+ <Value1 XPlacement="0"/>
+ </Class2Record>
+ <Class2Record index="1">
+ <Value1 XPlacement="-100"/>
+ </Class2Record>
+ </Class1Record>
+ <Class1Record index="2">
+ <Class2Record index="0">
+ <Value1 XPlacement="0"/>
+ </Class2Record>
+ <Class2Record index="1">
+ <Value1 XPlacement="-100"/>
+ </Class2Record>
+ </Class1Record>
+ </PairPos>
+ </Lookup>
+ </LookupList>
+ </GPOS>
+
+ <hmtx>
+ <mtx name=".notdef" width="1500" lsb="300"/>
+ <mtx name="g33" width="1500" lsb="300"/>
+ <mtx name="g35" width="1500" lsb="300"/>
+ </hmtx>
+
+</ttFont>
diff --git a/Tests/subset/data/Lobster.subset.ttx b/Tests/subset/data/Lobster.subset.ttx
index c35e570d..8089b246 100644
--- a/Tests/subset/data/Lobster.subset.ttx
+++ b/Tests/subset/data/Lobster.subset.ttx
@@ -490,7 +490,7 @@ This license is available with a FAQ at: http://scripts.sil.org/OFL
<LookupFlag value="0"/>
<!-- SubTableCount=1 -->
<PairPos index="0" Format="1">
- <Coverage Format="2">
+ <Coverage>
<Glyph value="one"/>
<Glyph value="three"/>
<Glyph value="two"/>
@@ -616,7 +616,7 @@ This license is available with a FAQ at: http://scripts.sil.org/OFL
<LookupType value="1"/>
<LookupFlag value="0"/>
<!-- SubTableCount=1 -->
- <SingleSubst index="0" Format="1">
+ <SingleSubst index="0">
<Substitution in="A" out="A.salt"/>
<Substitution in="B" out="B.salt"/>
</SingleSubst>
@@ -625,7 +625,7 @@ This license is available with a FAQ at: http://scripts.sil.org/OFL
<LookupType value="4"/>
<LookupFlag value="0"/>
<!-- SubTableCount=1 -->
- <LigatureSubst index="0" Format="1">
+ <LigatureSubst index="0">
<LigatureSet glyph="I">
<Ligature components="J" glyph="IJ"/>
</LigatureSet>
@@ -635,7 +635,7 @@ This license is available with a FAQ at: http://scripts.sil.org/OFL
<LookupType value="1"/>
<LookupFlag value="0"/>
<!-- SubTableCount=1 -->
- <SingleSubst index="0" Format="1">
+ <SingleSubst index="0">
<Substitution in="A" out="A.salt"/>
<Substitution in="B" out="B.salt"/>
</SingleSubst>
diff --git a/Tests/subset/data/TestContextSubstFormat3.ttx b/Tests/subset/data/TestContextSubstFormat3.ttx
index 3e9bfcd2..0ed43ee2 100644
--- a/Tests/subset/data/TestContextSubstFormat3.ttx
+++ b/Tests/subset/data/TestContextSubstFormat3.ttx
@@ -328,7 +328,7 @@
<GDEF>
<Version value="0x00010000"/>
- <GlyphClassDef Format="2">
+ <GlyphClassDef>
<ClassDef glyph=".notdef" class="1"/>
<ClassDef glyph="glyph00002" class="1"/>
<ClassDef glyph="glyph00003" class="1"/>
@@ -430,17 +430,17 @@
<LookupFlag value="0"/>
<!-- SubTableCount=1 -->
<ChainContextSubst index="0" Format="2">
- <Coverage Format="1">
+ <Coverage>
<Glyph value="plus"/>
</Coverage>
- <BacktrackClassDef Format="1">
+ <BacktrackClassDef>
<ClassDef glyph="glyph00005" class="1"/>
<ClassDef glyph="glyph00007" class="1"/>
</BacktrackClassDef>
- <InputClassDef Format="1">
+ <InputClassDef>
<ClassDef glyph="plus" class="1"/>
</InputClassDef>
- <LookAheadClassDef Format="2">
+ <LookAheadClassDef>
</LookAheadClassDef>
<!-- ChainSubClassSetCount=2 -->
<ChainSubClassSet index="0" empty="1"/>
@@ -527,13 +527,13 @@
<ContextSubst index="0" Format="3">
<!-- GlyphCount=3 -->
<!-- SubstCount=2 -->
- <Coverage index="0" Format="1">
+ <Coverage index="0">
<Glyph value="glyph00002"/>
</Coverage>
- <Coverage index="1" Format="1">
+ <Coverage index="1">
<Glyph value="glyph00004"/>
</Coverage>
- <Coverage index="2" Format="1">
+ <Coverage index="2">
<Glyph value="glyph00005"/>
</Coverage>
<SubstLookupRecord index="0">
@@ -548,10 +548,10 @@
<ContextSubst index="1" Format="3">
<!-- GlyphCount=2 -->
<!-- SubstCount=2 -->
- <Coverage index="0" Format="1">
+ <Coverage index="0">
<Glyph value="glyph00002"/>
</Coverage>
- <Coverage index="1" Format="1">
+ <Coverage index="1">
<Glyph value="glyph00005"/>
</Coverage>
<SubstLookupRecord index="0">
@@ -568,7 +568,7 @@
<LookupType value="1"/>
<LookupFlag value="0"/>
<!-- SubTableCount=1 -->
- <SingleSubst index="0" Format="1">
+ <SingleSubst index="0">
<Substitution in="plus" out="glyph00005"/>
</SingleSubst>
</Lookup>
@@ -576,7 +576,7 @@
<LookupType value="1"/>
<LookupFlag value="0"/>
<!-- SubTableCount=1 -->
- <SingleSubst index="0" Format="1">
+ <SingleSubst index="0">
<Substitution in="plus" out="glyph00004"/>
</SingleSubst>
</Lookup>
@@ -584,7 +584,7 @@
<LookupType value="1"/>
<LookupFlag value="0"/>
<!-- SubTableCount=1 -->
- <SingleSubst index="0" Format="1">
+ <SingleSubst index="0">
<Substitution in="plus" out="glyph00002"/>
</SingleSubst>
</Lookup>
@@ -592,7 +592,7 @@
<LookupType value="1"/>
<LookupFlag value="0"/>
<!-- SubTableCount=1 -->
- <SingleSubst index="0" Format="2">
+ <SingleSubst index="0">
<Substitution in="glyph00002" out="glyph00003"/>
<Substitution in="glyph00005" out="glyph00006"/>
<Substitution in="plus" out="glyph00007"/>
diff --git a/Tests/subset/data/expect_keep_math.ttx b/Tests/subset/data/expect_keep_math.ttx
index c734dd9c..f2bc41df 100644
--- a/Tests/subset/data/expect_keep_math.ttx
+++ b/Tests/subset/data/expect_keep_math.ttx
@@ -417,7 +417,7 @@
</MathConstants>
<MathGlyphInfo>
<MathItalicsCorrectionInfo>
- <Coverage Format="1">
+ <Coverage>
<Glyph value="u1D435"/>
</Coverage>
<!-- ItalicsCorrectionCount=1 -->
@@ -426,7 +426,7 @@
</ItalicsCorrection>
</MathItalicsCorrectionInfo>
<MathTopAccentAttachment>
- <TopAccentCoverage Format="1">
+ <TopAccentCoverage>
<Glyph value="A"/>
<Glyph value="uni0302"/>
<Glyph value="u1D400"/>
@@ -466,14 +466,14 @@
<Value value="1164"/>
</TopAccentAttachment>
</MathTopAccentAttachment>
- <ExtendedShapeCoverage Format="1">
+ <ExtendedShapeCoverage>
<Glyph value="parenleft.size1"/>
<Glyph value="parenleft.size2"/>
<Glyph value="parenleft.size3"/>
<Glyph value="parenleft.size4"/>
</ExtendedShapeCoverage>
<MathKernInfo>
- <MathKernCoverage Format="1">
+ <MathKernCoverage>
<Glyph value="A"/>
<Glyph value="u1D400"/>
</MathKernCoverage>
@@ -522,10 +522,10 @@
</MathGlyphInfo>
<MathVariants>
<MinConnectorOverlap value="50"/>
- <VertGlyphCoverage Format="1">
+ <VertGlyphCoverage>
<Glyph value="parenleft"/>
</VertGlyphCoverage>
- <HorizGlyphCoverage Format="1">
+ <HorizGlyphCoverage>
<Glyph value="uni0302"/>
</HorizGlyphCoverage>
<!-- VertGlyphCount=1 -->
diff --git a/Tests/subset/data/expect_layout_scripts.ttx b/Tests/subset/data/expect_layout_scripts.ttx
index f3eea822..bd350832 100644
--- a/Tests/subset/data/expect_layout_scripts.ttx
+++ b/Tests/subset/data/expect_layout_scripts.ttx
@@ -89,7 +89,7 @@
<LookupType value="1"/>
<LookupFlag value="0"/>
<!-- SubTableCount=1 -->
- <SingleSubst index="0" Format="2">
+ <SingleSubst index="0">
<Substitution in="uni06F4" out="uni06F4.urd"/>
<Substitution in="uni06F6" out="uni06F6.urd"/>
<Substitution in="uni06F7" out="uni06F7.urd"/>
@@ -99,7 +99,7 @@
<LookupType value="1"/>
<LookupFlag value="0"/>
<!-- SubTableCount=1 -->
- <SingleSubst index="0" Format="1">
+ <SingleSubst index="0">
<Substitution in="uni06F0" out="uni06F0.numr"/>
<Substitution in="uni06F1" out="uni06F1.numr"/>
<Substitution in="uni06F2" out="uni06F2.numr"/>
@@ -119,7 +119,7 @@
<LookupType value="1"/>
<LookupFlag value="0"/>
<!-- SubTableCount=1 -->
- <SingleSubst index="0" Format="1">
+ <SingleSubst index="0">
<Substitution in="i" out="i.TRK"/>
</SingleSubst>
</Lookup>
diff --git a/Tests/subset/data/layout_scripts.ttx b/Tests/subset/data/layout_scripts.ttx
index 37b2fd81..ddf0cd63 100644
--- a/Tests/subset/data/layout_scripts.ttx
+++ b/Tests/subset/data/layout_scripts.ttx
@@ -733,7 +733,7 @@
<GDEF>
<Version value="0x00010000"/>
- <GlyphClassDef Format="2">
+ <GlyphClassDef>
<ClassDef glyph="i" class="1"/>
<ClassDef glyph="i.TRK" class="1"/>
<ClassDef glyph="uni06F0" class="1"/>
@@ -906,7 +906,7 @@
<LookupType value="1"/>
<LookupFlag value="0"/>
<!-- SubTableCount=1 -->
- <SingleSubst index="0" Format="2">
+ <SingleSubst index="0">
<Substitution in="uni06F4" out="uni06F4.urd"/>
<Substitution in="uni06F6" out="uni06F6.urd"/>
<Substitution in="uni06F7" out="uni06F7.urd"/>
@@ -916,7 +916,7 @@
<LookupType value="1"/>
<LookupFlag value="0"/>
<!-- SubTableCount=1 -->
- <SingleSubst index="0" Format="2">
+ <SingleSubst index="0">
<Substitution in="uni06F4" out="uni06F4.urd"/>
<Substitution in="uni06F6" out="uni06F6.urd"/>
<Substitution in="uni06F7" out="uni06F7.urd"/>
@@ -926,7 +926,7 @@
<LookupType value="1"/>
<LookupFlag value="0"/>
<!-- SubTableCount=1 -->
- <SingleSubst index="0" Format="1">
+ <SingleSubst index="0">
<Substitution in="uni06F6" out="uni06F6.urd"/>
<Substitution in="uni06F7" out="uni06F7.urd"/>
</SingleSubst>
@@ -935,7 +935,7 @@
<LookupType value="1"/>
<LookupFlag value="0"/>
<!-- SubTableCount=1 -->
- <SingleSubst index="0" Format="1">
+ <SingleSubst index="0">
<Substitution in="uni06F0" out="uni06F0.numr"/>
<Substitution in="uni06F1" out="uni06F1.numr"/>
<Substitution in="uni06F2" out="uni06F2.numr"/>
@@ -955,7 +955,7 @@
<LookupType value="1"/>
<LookupFlag value="0"/>
<!-- SubTableCount=1 -->
- <SingleSubst index="0" Format="1">
+ <SingleSubst index="0">
<Substitution in="i" out="i.TRK"/>
</SingleSubst>
</Lookup>
diff --git a/Tests/subset/data/test_cntrmask_CFF.ttx b/Tests/subset/data/test_cntrmask_CFF.ttx
index 5ab6268f..9e7d2051 100644
--- a/Tests/subset/data/test_cntrmask_CFF.ttx
+++ b/Tests/subset/data/test_cntrmask_CFF.ttx
@@ -237,13 +237,13 @@
<GDEF>
<Version value="0x00010002"/>
- <GlyphClassDef Format="1">
+ <GlyphClassDef>
<ClassDef glyph="Idieresis" class="1"/>
</GlyphClassDef>
<MarkGlyphSetsDef>
<MarkSetTableFormat value="1"/>
<!-- MarkSetCount=1 -->
- <Coverage index="0" Format="1">
+ <Coverage index="0">
</Coverage>
</MarkGlyphSetsDef>
</GDEF>
@@ -335,15 +335,15 @@
<LookupFlag value="0"/>
<!-- SubTableCount=1 -->
<PairPos index="0" Format="2">
- <Coverage Format="1">
+ <Coverage>
<Glyph value="Idieresis"/>
</Coverage>
<ValueFormat1 value="4"/>
<ValueFormat2 value="0"/>
- <ClassDef1 Format="1">
+ <ClassDef1>
<ClassDef glyph="Idieresis" class="1"/>
</ClassDef1>
- <ClassDef2 Format="2">
+ <ClassDef2>
</ClassDef2>
<!-- Class1Count=2 -->
<!-- Class2Count=1 -->
diff --git a/Tests/subset/subset_test.py b/Tests/subset/subset_test.py
index 370f9b62..6fa1bf60 100644
--- a/Tests/subset/subset_test.py
+++ b/Tests/subset/subset_test.py
@@ -1,5 +1,5 @@
import io
-from fontTools.misc.py23 import *
+from fontTools.misc.py23 import tobytes, tostr
from fontTools.misc.testTools import getXML
from fontTools import subset
from fontTools.fontBuilder import FontBuilder
@@ -762,6 +762,37 @@ class SubsetTest(unittest.TestCase):
subsetfont = TTFont(subsetpath)
self.expect_ttx(subsetfont, self.getpath("CmapSubsetTest.subset.ttx"), ["cmap"])
+ def test_GPOS_PairPos_Format2_useClass0(self):
+ # Check two things related to class 0 ('every other glyph'):
+ # 1) that it's reused for ClassDef1 when it becomes empty as the subset glyphset
+ # is intersected with the table's Coverage
+ # 2) that it is never reused for ClassDef2 even when it happens to become empty
+ # because of the subset glyphset. In this case, we don't keep a PairPosClass2
+ # subtable if only ClassDef2's class0 survived subsetting.
+ # The test font (from Harfbuzz test suite) is constructed to trigger these two
+ # situations depending on the input subset --text.
+ # https://github.com/fonttools/fonttools/pull/2221
+ _, fontpath = self.compile_font(
+ self.getpath("GPOS_PairPos_Format2_PR_2221.ttx"), ".ttf"
+ )
+ subsetpath = self.temp_path(".ttf")
+
+ for n, text in enumerate("!#", start=1):
+ expected_ttx = self.getpath(
+ f"GPOS_PairPos_Format2_ClassDef{n}_useClass0.subset.ttx"
+ )
+ with self.subTest(text=text, expected_ttx=expected_ttx):
+ subset.main(
+ [
+ fontpath,
+ f"--text='{text}'",
+ "--layout-features+=test",
+ "--output-file=%s" % subsetpath,
+ ]
+ )
+ subsetfont = TTFont(subsetpath)
+ self.expect_ttx(subsetfont, expected_ttx, ["GPOS"])
+
@pytest.fixture
def featureVarsTestFont():
@@ -859,7 +890,7 @@ def test_subset_single_pos_format():
' <LookupFlag value="0"/>',
' <!-- SubTableCount=1 -->',
' <SinglePos index="0" Format="2">',
- ' <Coverage Format="1">',
+ ' <Coverage>',
' <Glyph value="a"/>',
' <Glyph value="b"/>',
' <Glyph value="c"/>',
@@ -886,7 +917,7 @@ def test_subset_single_pos_format():
' <LookupFlag value="0"/>',
' <!-- SubTableCount=1 -->',
' <SinglePos index="0" Format="1">',
- ' <Coverage Format="1">',
+ ' <Coverage>',
' <Glyph value="a"/>',
' <Glyph value="c"/>',
' </Coverage>',