diff options
author | Haibo Huang <hhb@google.com> | 2021-01-25 19:23:39 -0800 |
---|---|---|
committer | Haibo Huang <hhb@google.com> | 2021-01-26 12:43:36 -0800 |
commit | f8d82f7a26154921102824802b7c16b9ac722f85 (patch) | |
tree | 7e436bb43355218e783d501f0bd394bb9a19bc24 /Tests/subset | |
parent | e7b287f76cb1898590bcccd533663f6e5830b24b (diff) | |
download | fonttools-f8d82f7a26154921102824802b7c16b9ac722f85.tar.gz |
Upgrade fonttools to 4.19.0
Test: make
Change-Id: I94aa7732ede5deb42a281dd99302c2e3140af4a4
Diffstat (limited to 'Tests/subset')
-rw-r--r-- | Tests/subset/data/CmapSubsetTest.subset.ttx | 14 | ||||
-rw-r--r-- | Tests/subset/data/CmapSubsetTest.ttx | 225 | ||||
-rw-r--r-- | Tests/subset/data/TestContextSubstFormat3.ttx | 8 | ||||
-rw-r--r-- | Tests/subset/subset_test.py | 7 |
4 files changed, 247 insertions, 7 deletions
diff --git a/Tests/subset/data/CmapSubsetTest.subset.ttx b/Tests/subset/data/CmapSubsetTest.subset.ttx new file mode 100644 index 00000000..10b94a34 --- /dev/null +++ b/Tests/subset/data/CmapSubsetTest.subset.ttx @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ttFont sfntVersion="\x00\x01\x00\x00" ttLibVersion="4.18"> + + <cmap> + <tableVersion version="0"/> + <cmap_format_4 platformID="0" platEncID="3" language="0"> + <map code="0x61" name="a"/><!-- LATIN SMALL LETTER A --> + </cmap_format_4> + <cmap_format_4 platformID="3" platEncID="1" language="0"> + <map code="0x61" name="a"/><!-- LATIN SMALL LETTER A --> + </cmap_format_4> + </cmap> + +</ttFont> diff --git a/Tests/subset/data/CmapSubsetTest.ttx b/Tests/subset/data/CmapSubsetTest.ttx new file mode 100644 index 00000000..ffbfae7f --- /dev/null +++ b/Tests/subset/data/CmapSubsetTest.ttx @@ -0,0 +1,225 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ttFont sfntVersion="\x00\x01\x00\x00" ttLibVersion="4.18"> + + <GlyphOrder> + <!-- The 'id' attribute is only for humans; it is ignored when parsed. --> + <GlyphID id="0" name=".notdef"/> + <GlyphID id="1" name="a"/> + <GlyphID id="2" name="basket"/> + </GlyphOrder> + + <head> + <!-- Most of this table will be recalculated by the compiler --> + <tableVersion value="1.0"/> + <fontRevision value="0.0"/> + <checkSumAdjustment value="0xc643119c"/> + <magicNumber value="0x5f0f3cf5"/> + <flags value="00000000 00000011"/> + <unitsPerEm value="1000"/> + <created value="Tue Jan 12 16:39:39 2021"/> + <modified value="Tue Jan 12 16:39:39 2021"/> + <xMin value="50"/> + <yMin value="-200"/> + <xMax value="450"/> + <yMax value="800"/> + <macStyle value="00000000 00000000"/> + <lowestRecPPEM value="6"/> + <fontDirectionHint value="2"/> + <indexToLocFormat value="0"/> + <glyphDataFormat value="0"/> + </head> + + <hhea> + <tableVersion value="0x00010000"/> + <ascent value="1000"/> + <descent value="-200"/> + <lineGap value="0"/> + <advanceWidthMax value="942"/> + <minLeftSideBearing value="50"/> + <minRightSideBearing value="50"/> + <xMaxExtent value="450"/> + <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="3"/> + </hhea> + + <maxp> + <!-- Most of this table will be recalculated by the compiler --> + <tableVersion value="0x10000"/> + <numGlyphs value="3"/> + <maxPoints value="8"/> + <maxContours value="2"/> + <maxCompositePoints value="0"/> + <maxCompositeContours value="0"/> + <maxZones value="1"/> + <maxTwilightPoints value="0"/> + <maxStorage value="0"/> + <maxFunctionDefs value="0"/> + <maxInstructionDefs value="0"/> + <maxStackElements value="0"/> + <maxSizeOfInstructions value="0"/> + <maxComponentElements value="0"/> + <maxComponentDepth value="0"/> + </maxp> + + <OS_2> + <!-- The fields 'usFirstCharIndex' and 'usLastCharIndex' + will be recalculated by the compiler --> + <version value="4"/> + <xAvgCharWidth value="660"/> + <usWeightClass value="400"/> + <usWidthClass value="5"/> + <fsType value="00000000 00000100"/> + <ySubscriptXSize value="650"/> + <ySubscriptYSize value="600"/> + <ySubscriptXOffset value="0"/> + <ySubscriptYOffset value="75"/> + <ySuperscriptXSize value="650"/> + <ySuperscriptYSize value="600"/> + <ySuperscriptXOffset value="0"/> + <ySuperscriptYOffset value="350"/> + <yStrikeoutSize value="50"/> + <yStrikeoutPosition value="300"/> + <sFamilyClass value="0"/> + <panose> + <bFamilyType value="0"/> + <bSerifStyle value="0"/> + <bWeight value="0"/> + <bProportion value="0"/> + <bContrast value="0"/> + <bStrokeVariation value="0"/> + <bArmStyle value="0"/> + <bLetterForm value="0"/> + <bMidline value="0"/> + <bXHeight value="0"/> + </panose> + <ulUnicodeRange1 value="00000000 00000000 00000000 00000001"/> + <ulUnicodeRange2 value="00000010 00000000 00000000 00000000"/> + <ulUnicodeRange3 value="00000000 00000000 00000000 00000000"/> + <ulUnicodeRange4 value="00000000 00000000 00000000 00000000"/> + <achVendID value="NONE"/> + <fsSelection value="00000000 01000000"/> + <usFirstCharIndex value="97"/> + <usLastCharIndex value="65535"/> + <sTypoAscender value="800"/> + <sTypoDescender value="-200"/> + <sTypoLineGap value="200"/> + <usWinAscent value="1000"/> + <usWinDescent value="200"/> + <ulCodePageRange1 value="00000000 00000000 00000000 00000001"/> + <ulCodePageRange2 value="00000000 00000000 00000000 00000000"/> + <sxHeight value="500"/> + <sCapHeight value="700"/> + <usDefaultChar value="0"/> + <usBreakChar value="32"/> + <usMaxContext value="0"/> + </OS_2> + + <hmtx> + <mtx name=".notdef" width="500" lsb="50"/> + <mtx name="a" width="538" lsb="0"/> + <mtx name="basket" width="942" lsb="0"/> + </hmtx> + + <cmap> + <tableVersion version="0"/> + <cmap_format_4 platformID="0" platEncID="3" language="0"> + <map code="0x61" name="a"/><!-- LATIN SMALL LETTER A --> + </cmap_format_4> + <cmap_format_12 platformID="0" platEncID="4" format="12" reserved="0" length="40" language="0" nGroups="2"> + <map code="0x61" name="a"/><!-- LATIN SMALL LETTER A --> + <map code="0x1f9fa" name="basket"/><!-- BASKET --> + </cmap_format_12> + <cmap_format_4 platformID="3" platEncID="1" language="0"> + <map code="0x61" name="a"/><!-- LATIN SMALL LETTER A --> + </cmap_format_4> + <cmap_format_12 platformID="3" platEncID="10" format="12" reserved="0" length="40" language="0" nGroups="2"> + <map code="0x61" name="a"/><!-- LATIN SMALL LETTER A --> + <map code="0x1f9fa" name="basket"/><!-- BASKET --> + </cmap_format_12> + </cmap> + + <loca> + <!-- The 'loca' table will be calculated by the compiler --> + </loca> + + <glyf> + + <!-- The xMin, yMin, xMax and yMax values + will be recalculated by the compiler. --> + + <TTGlyph name=".notdef" xMin="50" yMin="-200" xMax="450" yMax="800"> + <contour> + <pt x="50" y="-200" on="1"/> + <pt x="50" y="800" on="1"/> + <pt x="450" y="800" on="1"/> + <pt x="450" y="-200" on="1"/> + </contour> + <contour> + <pt x="100" y="-150" on="1"/> + <pt x="400" y="-150" on="1"/> + <pt x="400" y="750" on="1"/> + <pt x="100" y="750" on="1"/> + </contour> + <instructions/> + </TTGlyph> + + <TTGlyph name="a"/><!-- contains no outline data --> + + <TTGlyph name="basket"/><!-- contains no outline data --> + + </glyf> + + <name> + <namerecord nameID="1" platformID="3" platEncID="1" langID="0x409"> + New Font + </namerecord> + <namerecord nameID="2" platformID="3" platEncID="1" langID="0x409"> + Regular + </namerecord> + <namerecord nameID="3" platformID="3" platEncID="1" langID="0x409"> + 0.000;NONE;NewFont-Regular + </namerecord> + <namerecord nameID="4" platformID="3" platEncID="1" langID="0x409"> + New Font Regular + </namerecord> + <namerecord nameID="5" platformID="3" platEncID="1" langID="0x409"> + Version 0.000 + </namerecord> + <namerecord nameID="6" platformID="3" platEncID="1" langID="0x409"> + NewFont-Regular + </namerecord> + </name> + + <post> + <formatType value="2.0"/> + <italicAngle value="0.0"/> + <underlinePosition value="-75"/> + <underlineThickness value="50"/> + <isFixedPitch value="0"/> + <minMemType42 value="0"/> + <maxMemType42 value="0"/> + <minMemType1 value="0"/> + <maxMemType1 value="0"/> + <psNames> + <!-- This file uses unique glyph names based on the information + found in the 'post' table. Since these names might not be unique, + we have to invent artificial names in case of clashes. In order to + be able to retain the original information, we need a name to + ps name mapping for those cases where they differ. That's what + you see below. + --> + </psNames> + <extraNames> + <!-- following are the name that are not taken from the standard Mac glyph order --> + <psName name="basket"/> + </extraNames> + </post> + +</ttFont> diff --git a/Tests/subset/data/TestContextSubstFormat3.ttx b/Tests/subset/data/TestContextSubstFormat3.ttx index 899b037e..3e9bfcd2 100644 --- a/Tests/subset/data/TestContextSubstFormat3.ttx +++ b/Tests/subset/data/TestContextSubstFormat3.ttx @@ -17,7 +17,7 @@ <!-- Most of this table will be recalculated by the compiler --> <tableVersion value="1.0"/> <fontRevision value="1.0"/> - <checkSumAdjustment value="0xa69ed898"/> + <checkSumAdjustment value="0xa6bcdc24"/> <magicNumber value="0x5f0f3cf5"/> <flags value="00000000 00001111"/> <unitsPerEm value="1000"/> @@ -142,15 +142,9 @@ <cmap_format_4 platformID="0" platEncID="3" language="0"> <map code="0x2b" name="plus"/><!-- PLUS SIGN --> </cmap_format_4> - <cmap_format_12 platformID="0" platEncID="4" format="12" reserved="0" length="28" language="0" nGroups="1"> - <map code="0x2b" name="plus"/><!-- PLUS SIGN --> - </cmap_format_12> <cmap_format_4 platformID="3" platEncID="1" language="0"> <map code="0x2b" name="plus"/><!-- PLUS SIGN --> </cmap_format_4> - <cmap_format_12 platformID="3" platEncID="10" format="12" reserved="0" length="28" language="0" nGroups="1"> - <map code="0x2b" name="plus"/><!-- PLUS SIGN --> - </cmap_format_12> </cmap> <loca> diff --git a/Tests/subset/subset_test.py b/Tests/subset/subset_test.py index 0d2f9fe2..d37634f1 100644 --- a/Tests/subset/subset_test.py +++ b/Tests/subset/subset_test.py @@ -753,6 +753,13 @@ class SubsetTest(unittest.TestCase): # check all glyphs are kept via GSUB closure, no changes expected self.expect_ttx(subsetfont, ttx) + def test_cmap_prune_format12(self): + _, fontpath = self.compile_font(self.getpath("CmapSubsetTest.ttx"), ".ttf") + subsetpath = self.temp_path(".ttf") + subset.main([fontpath, "--glyphs=a", "--output-file=%s" % subsetpath]) + subsetfont = TTFont(subsetpath) + self.expect_ttx(subsetfont, self.getpath("CmapSubsetTest.subset.ttx"), ["cmap"]) + @pytest.fixture def featureVarsTestFont(): |