diff options
author | Haibo Huang <hhb@google.com> | 2019-05-13 16:38:42 -0700 |
---|---|---|
committer | Haibo Huang <hhb@google.com> | 2019-05-13 16:38:42 -0700 |
commit | d648c2a4868c62db146c13f62b38d749db674ab2 (patch) | |
tree | cfeb5f4e886f8902407dc4c5bab3a88513d0fe55 /Tests/subset | |
parent | 195ed3228f2e5c0f6a9cc31e9c0f081646eda9eb (diff) | |
download | fonttools-d648c2a4868c62db146c13f62b38d749db674ab2.tar.gz |
Upgrade fonttools to 3.41.2
Test: None
Change-Id: I5263a62cab851cde83c296124418c8e72afffe4e
Diffstat (limited to 'Tests/subset')
-rw-r--r-- | Tests/subset/data/TestHVVAR.ttx | 443 | ||||
-rw-r--r-- | Tests/subset/data/expect_HVVAR.ttx | 166 | ||||
-rw-r--r-- | Tests/subset/data/expect_HVVAR_retain_gids.ttx | 182 | ||||
-rw-r--r-- | Tests/subset/data/test_cntrmask_CFF.desub.ttx | 70 | ||||
-rw-r--r-- | Tests/subset/data/test_cntrmask_CFF.ttx | 417 | ||||
-rw-r--r-- | Tests/subset/subset_test.py | 46 |
6 files changed, 1322 insertions, 2 deletions
diff --git a/Tests/subset/data/TestHVVAR.ttx b/Tests/subset/data/TestHVVAR.ttx new file mode 100644 index 00000000..3e746527 --- /dev/null +++ b/Tests/subset/data/TestHVVAR.ttx @@ -0,0 +1,443 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ttFont sfntVersion="\x00\x01\x00\x00" ttLibVersion="3.40"> + + <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="B"/> + <GlyphID id="3" name="C"/> + <GlyphID id="4" name="D"/> + <GlyphID id="5" name="E"/> + </GlyphOrder> + + <head> + <!-- Most of this table will be recalculated by the compiler --> + <tableVersion value="1.0"/> + <fontRevision value="1.0"/> + <checkSumAdjustment value="0xddab44f"/> + <magicNumber value="0x5f0f3cf5"/> + <flags value="00000000 00000001"/> + <unitsPerEm value="1000"/> + <created value="Tue Apr 23 17:22:52 2019"/> + <modified value="Tue Apr 23 17:22:52 2019"/> + <xMin value="0"/> + <yMin value="0"/> + <xMax value="0"/> + <yMax value="0"/> + <macStyle value="00000000 00000000"/> + <lowestRecPPEM value="7"/> + <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="700"/> + <minLeftSideBearing value="40"/> + <minRightSideBearing value="580"/> + <xMaxExtent value="80"/> + <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="4"/> + </hhea> + + <maxp> + <!-- Most of this table will be recalculated by the compiler --> + <tableVersion value="0x10000"/> + <numGlyphs value="6"/> + <maxPoints value="1"/> + <maxContours value="1"/> + <maxCompositePoints value="0"/> + <maxCompositeContours value="0"/> + <maxZones value="1"/> + <maxTwilightPoints value="0"/> + <maxStorage value="0"/> + <maxFunctionDefs value="1"/> + <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="3"/> + <xAvgCharWidth value="606"/> + <usWeightClass value="400"/> + <usWidthClass value="5"/> + <fsType value="00000000 00001000"/> + <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="5"/> + <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="00000000 00000000 00000000 00000000"/> + <ulUnicodeRange3 value="00000000 00000000 00000000 00000000"/> + <ulUnicodeRange4 value="00000000 00000000 00000000 00000000"/> + <achVendID value="UKWN"/> + <fsSelection value="00000000 01000000"/> + <usFirstCharIndex value="32"/> + <usLastCharIndex value="8722"/> + <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="700" lsb="80"/> + <mtx name="A" width="700" lsb="0"/> + <mtx name="B" width="625" lsb="40"/> + <mtx name="C" width="660" lsb="80"/> + <mtx name="D" width="660" lsb="80"/> + <mtx name="E" width="660" lsb="80"/> + </hmtx> + + <cmap> + <tableVersion version="0"/> + <cmap_format_4 platformID="0" platEncID="3" language="0"> + <map code="0x41" name="A"/><!-- SPACE --> + <map code="0x42" name="B"/><!-- DIGIT ZERO --> + <map code="0x43" name="C"/><!-- EQUALS SIGN --> + <map code="0x44" name="D"/><!-- MINUS SIGN --> + <map code="0x45" name="E"/><!-- PLUS SIGN --> + </cmap_format_4> + </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="0" yMin="0" xMax="0" yMax="0"> + <contour> + <pt x="0" y="0" on="1"/> + </contour> + <instructions/> + </TTGlyph> + + <TTGlyph name="A"/><!-- contains no outline data --> + + <TTGlyph name="B" xMin="0" yMin="0" xMax="0" yMax="0"> + <contour> + <pt x="0" y="0" on="1"/> + </contour> + <instructions/> + </TTGlyph> + + <TTGlyph name="C" xMin="0" yMin="0" xMax="0" yMax="0"> + <contour> + <pt x="0" y="0" on="1"/> + </contour> + <instructions/> + </TTGlyph> + + <TTGlyph name="D" xMin="0" yMin="0" xMax="0" yMax="0"> + <contour> + <pt x="0" y="0" on="1"/> + </contour> + <instructions/> + </TTGlyph> + + <TTGlyph name="E" xMin="0" yMin="0" xMax="0" yMax="0"> + <contour> + <pt x="0" y="0" on="1"/> + </contour> + <instructions/> + </TTGlyph> + + </glyf> + + <name> + <namerecord nameID="1" platformID="1" platEncID="0" langID="0x0" unicode="True"> + TestHVVAR + </namerecord> + <namerecord nameID="2" platformID="1" platEncID="0" langID="0x0" unicode="True"> + Regular + </namerecord> + <namerecord nameID="3" platformID="1" platEncID="0" langID="0x0" unicode="True"> + 1.000;UKWN;TestHVVAR-Regular + </namerecord> + <namerecord nameID="4" platformID="1" platEncID="0" langID="0x0" unicode="True"> + TestHVVAR + </namerecord> + <namerecord nameID="5" platformID="1" platEncID="0" langID="0x0" unicode="True"> + Version 1.000 + </namerecord> + <namerecord nameID="6" platformID="1" platEncID="0" langID="0x0" unicode="True"> + TestHVVAR-Regular + </namerecord> + <namerecord nameID="1" platformID="3" platEncID="1" langID="0x409"> + TestHVVAR + </namerecord> + <namerecord nameID="2" platformID="3" platEncID="1" langID="0x409"> + Regular + </namerecord> + <namerecord nameID="3" platformID="3" platEncID="1" langID="0x409"> + 1.000;UKWN;TestHVVAR-Regular + </namerecord> + <namerecord nameID="4" platformID="3" platEncID="1" langID="0x409"> + TestHVVAR-Regular + </namerecord> + <namerecord nameID="5" platformID="3" platEncID="1" langID="0x409"> + Version 1.000 + </namerecord> + <namerecord nameID="6" platformID="3" platEncID="1" langID="0x409"> + TestHVVAR-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 --> + </extraNames> + </post> + + <HVAR> + <Version value="0x00010000"/> + <VarStore Format="1"> + <Format value="1"/> + <VarRegionList> + <!-- RegionAxisCount=1 --> + <!-- RegionCount=2 --> + <Region index="0"> + <VarRegionAxis index="0"> + <StartCoord value="-1.0"/> + <PeakCoord value="-1.0"/> + <EndCoord value="0.0"/> + </VarRegionAxis> + </Region> + <Region index="1"> + <VarRegionAxis index="0"> + <StartCoord value="0.0"/> + <PeakCoord value="1.0"/> + <EndCoord value="1.0"/> + </VarRegionAxis> + </Region> + </VarRegionList> + <!-- VarDataCount=2 --> + <VarData index="0"> + <!-- ItemCount=6 --> + <NumShorts value="0"/> + <!-- VarRegionCount=1 --> + <VarRegionIndex index="0" value="1"/> + <Item index="0" value="[1]"/> + <Item index="1" value="[2]"/> + <Item index="2" value="[3]"/> + <Item index="3" value="[4]"/> + <Item index="4" value="[5]"/> + <Item index="5" value="[6]"/> + </VarData> + <VarData index="1"> + <!-- ItemCount=6 --> + <NumShorts value="1"/> + <!-- VarRegionCount=2 --> + <VarRegionIndex index="0" value="0"/> + <VarRegionIndex index="1" value="1"/> + <Item index="0" value="[10, 21]"/> + <Item index="1" value="[11, 22]"/> + <Item index="2" value="[126, 23]"/> + <Item index="3" value="[127, 24]"/> + <Item index="4" value="[-128, 25]"/> + <Item index="5" value="[-129, 26]"/> + </VarData> + </VarStore> + <LsbMap> + <Map glyph=".notdef" outer="0" inner="2"/> + <Map glyph="A" outer="0" inner="5"/> + <Map glyph="B" outer="1" inner="1"/> + <Map glyph="C" outer="1" inner="4"/> + <Map glyph="D" outer="0" inner="3"/> + <Map glyph="E" outer="1" inner="0"/> + </LsbMap> + <RsbMap> + <Map glyph=".notdef" outer="0" inner="1"/> + <Map glyph="A" outer="0" inner="4"/> + <Map glyph="B" outer="1" inner="5"/> + <Map glyph="C" outer="0" inner="0"/> + <Map glyph="D" outer="1" inner="2"/> + <Map glyph="E" outer="1" inner="3"/> + </RsbMap> + </HVAR> + + <VVAR> + <Version value="0x00010000"/> + <VarStore Format="1"> + <Format value="1"/> + <VarRegionList> + <!-- RegionAxisCount=1 --> + <!-- RegionCount=4 --> + <Region index="0"> + <VarRegionAxis index="0"> + <StartCoord value="-1.0"/> + <PeakCoord value="-1.0"/> + <EndCoord value="0.0"/> + </VarRegionAxis> + </Region> + <Region index="1"> + <VarRegionAxis index="0"> + <StartCoord value="0.0"/> + <PeakCoord value="1.0"/> + <EndCoord value="1.0"/> + </VarRegionAxis> + </Region> + <Region index="2"> + <VarRegionAxis index="0"> + <StartCoord value="-1.0"/> + <PeakCoord value="-0.5"/> + <EndCoord value="0.0"/> + </VarRegionAxis> + </Region> + <Region index="3"> + <VarRegionAxis index="0"> + <StartCoord value="0.0"/> + <PeakCoord value="0.5"/> + <EndCoord value="1.0"/> + </VarRegionAxis> + </Region> + </VarRegionList> + <!-- VarDataCount=2 --> + <VarData index="0"> + <!-- ItemCount=4 --> + <NumShorts value="0"/> + <!-- VarRegionCount=1 --> + <VarRegionIndex index="0" value="1"/> + <Item index="0" value="[32]"/> + <Item index="1" value="[17]"/> + <Item index="2" value="[0]"/> + <Item index="3" value="[14]"/> + <Item index="4" value="[5]"/> + <Item index="5" value="[6]"/> + </VarData> + <VarData index="1"> + <!-- ItemCount=6 --> + <NumShorts value="3"/> + <!-- VarRegionCount=4 --> + <VarRegionIndex index="0" value="0"/> + <VarRegionIndex index="1" value="1"/> + <VarRegionIndex index="2" value="2"/> + <VarRegionIndex index="3" value="3"/> + <Item index="0" value="[0, 1, 11, 21]"/> + <Item index="1" value="[0, 2, 12, 22]"/> + <Item index="2" value="[128, 130, 13, 23]"/> + <Item index="3" value="[0, 4, 14, 24]"/> + <Item index="4" value="[0, 5, -129, 25]"/> + <Item index="5" value="[14, 6, 16, 26]"/> + </VarData> + </VarStore> + <AdvHeightMap> + <Map glyph=".notdef" outer="1" inner="0"/> + <Map glyph="A" outer="1" inner="2"/> + <Map glyph="B" outer="0" inner="2"/> + <Map glyph="C" outer="0" inner="0"/> + <Map glyph="D" outer="1" inner="1"/> + <Map glyph="E" outer="0" inner="1"/> + </AdvHeightMap> + <VOrgMap> + <Map glyph=".notdef" outer="1" inner="3"/> + <Map glyph="A" outer="1" inner="5"/> + <Map glyph="B" outer="0" inner="5"/> + <Map glyph="C" outer="0" inner="3"/> + <Map glyph="D" outer="1" inner="4"/> + <Map glyph="E" outer="0" inner="4"/> + </VOrgMap> + </VVAR> + + <avar> + <segment axis="wght"> + <mapping from="-1.0" to="-1.0"/> + <mapping from="0.0" to="0.0"/> + <mapping from="0.3" to="0.5"/> + <mapping from="1.0" to="1.0"/> + </segment> + </avar> + + <fvar> + <Axis> + <AxisTag>wght</AxisTag> + <Flags>0x0</Flags> + <MinValue>100.0</MinValue> + <DefaultValue>400.0</DefaultValue> + <MaxValue>900.0</MaxValue> + <AxisNameID>257</AxisNameID> + </Axis> + <NamedInstance flags="0x0" subfamilyNameID="258"> + <coord axis="wght" value="100.0"/> + </NamedInstance> + <NamedInstance flags="0x0" subfamilyNameID="259"> + <coord axis="wght" value="300.0"/> + </NamedInstance> + <NamedInstance flags="0x0" subfamilyNameID="260"> + <coord axis="wght" value="400.0"/> + </NamedInstance> + <NamedInstance flags="0x0" subfamilyNameID="261"> + <coord axis="wght" value="700.0"/> + </NamedInstance> + <NamedInstance flags="0x0" subfamilyNameID="262"> + <coord axis="wght" value="900.0"/> + </NamedInstance> + </fvar> + +</ttFont> diff --git a/Tests/subset/data/expect_HVVAR.ttx b/Tests/subset/data/expect_HVVAR.ttx new file mode 100644 index 00000000..5fbc1770 --- /dev/null +++ b/Tests/subset/data/expect_HVVAR.ttx @@ -0,0 +1,166 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ttFont sfntVersion="\x00\x01\x00\x00" ttLibVersion="3.40"> + + <GlyphOrder> + <!-- The 'id' attribute is only for humans; it is ignored when parsed. --> + <GlyphID id="0" name=".notdef"/> + <GlyphID id="1" name="B"/> + <GlyphID id="2" name="D"/> + </GlyphOrder> + + <HVAR> + <Version value="0x00010000"/> + <VarStore Format="1"> + <Format value="1"/> + <VarRegionList> + <!-- RegionAxisCount=1 --> + <!-- RegionCount=2 --> + <Region index="0"> + <VarRegionAxis index="0"> + <StartCoord value="-1.0"/> + <PeakCoord value="-1.0"/> + <EndCoord value="0.0"/> + </VarRegionAxis> + </Region> + <Region index="1"> + <VarRegionAxis index="0"> + <StartCoord value="0.0"/> + <PeakCoord value="1.0"/> + <EndCoord value="1.0"/> + </VarRegionAxis> + </Region> + </VarRegionList> + <!-- VarDataCount=2 --> + <VarData index="0"> + <!-- ItemCount=5 --> + <NumShorts value="0"/> + <!-- VarRegionCount=1 --> + <VarRegionIndex index="0" value="1"/> + <Item index="0" value="[1]"/> + <Item index="1" value="[3]"/> + <Item index="2" value="[5]"/> + <Item index="3" value="[2]"/> + <Item index="4" value="[4]"/> + </VarData> + <VarData index="1"> + <!-- ItemCount=3 --> + <NumShorts value="1"/> + <!-- VarRegionCount=2 --> + <VarRegionIndex index="0" value="0"/> + <VarRegionIndex index="1" value="1"/> + <Item index="0" value="[11, 22]"/> + <Item index="1" value="[126, 23]"/> + <Item index="2" value="[-129, 26]"/> + </VarData> + </VarStore> + <LsbMap> + <Map glyph=".notdef" outer="0" inner="1"/> + <Map glyph="B" outer="1" inner="0"/> + <Map glyph="D" outer="0" inner="4"/> + </LsbMap> + <RsbMap> + <Map glyph=".notdef" outer="0" inner="3"/> + <Map glyph="B" outer="1" inner="2"/> + <Map glyph="D" outer="1" inner="1"/> + </RsbMap> + </HVAR> + + <VVAR> + <Version value="0x00010000"/> + <VarStore Format="1"> + <Format value="1"/> + <VarRegionList> + <!-- RegionAxisCount=1 --> + <!-- RegionCount=3 --> + <Region index="0"> + <VarRegionAxis index="0"> + <StartCoord value="0.0"/> + <PeakCoord value="1.0"/> + <EndCoord value="1.0"/> + </VarRegionAxis> + </Region> + <Region index="1"> + <VarRegionAxis index="0"> + <StartCoord value="-1.0"/> + <PeakCoord value="-0.5"/> + <EndCoord value="0.0"/> + </VarRegionAxis> + </Region> + <Region index="2"> + <VarRegionAxis index="0"> + <StartCoord value="0.0"/> + <PeakCoord value="0.5"/> + <EndCoord value="1.0"/> + </VarRegionAxis> + </Region> + </VarRegionList> + <!-- VarDataCount=2 --> + <VarData index="0"> + <!-- ItemCount=2 --> + <NumShorts value="0"/> + <!-- VarRegionCount=1 --> + <VarRegionIndex index="0" value="0"/> + <Item index="0" value="[0]"/> + <Item index="1" value="[6]"/> + </VarData> + <VarData index="1"> + <!-- ItemCount=4 --> + <NumShorts value="1"/> + <!-- VarRegionCount=3 --> + <VarRegionIndex index="0" value="1"/> + <VarRegionIndex index="1" value="0"/> + <VarRegionIndex index="2" value="2"/> + <Item index="0" value="[11, 1, 21]"/> + <Item index="1" value="[12, 2, 22]"/> + <Item index="2" value="[14, 4, 24]"/> + <Item index="3" value="[-129, 5, 25]"/> + </VarData> + </VarStore> + <AdvHeightMap> + <Map glyph=".notdef" outer="1" inner="0"/> + <Map glyph="B" outer="0" inner="0"/> + <Map glyph="D" outer="1" inner="1"/> + </AdvHeightMap> + <VOrgMap> + <Map glyph=".notdef" outer="1" inner="2"/> + <Map glyph="B" outer="0" inner="1"/> + <Map glyph="D" outer="1" inner="3"/> + </VOrgMap> + </VVAR> + + <avar> + <segment axis="wght"> + <mapping from="-1.0" to="-1.0"/> + <mapping from="0.0" to="0.0"/> + <mapping from="0.3" to="0.5"/> + <mapping from="1.0" to="1.0"/> + </segment> + </avar> + + <fvar> + <Axis> + <AxisTag>wght</AxisTag> + <Flags>0x0</Flags> + <MinValue>100.0</MinValue> + <DefaultValue>400.0</DefaultValue> + <MaxValue>900.0</MaxValue> + <AxisNameID>257</AxisNameID> + </Axis> + <NamedInstance flags="0x0" subfamilyNameID="258"> + <coord axis="wght" value="100.0"/> + </NamedInstance> + <NamedInstance flags="0x0" subfamilyNameID="259"> + <coord axis="wght" value="300.0"/> + </NamedInstance> + <NamedInstance flags="0x0" subfamilyNameID="260"> + <coord axis="wght" value="400.0"/> + </NamedInstance> + <NamedInstance flags="0x0" subfamilyNameID="261"> + <coord axis="wght" value="700.0"/> + </NamedInstance> + <NamedInstance flags="0x0" subfamilyNameID="262"> + <coord axis="wght" value="900.0"/> + </NamedInstance> + </fvar> + +</ttFont> diff --git a/Tests/subset/data/expect_HVVAR_retain_gids.ttx b/Tests/subset/data/expect_HVVAR_retain_gids.ttx new file mode 100644 index 00000000..da2eaf4f --- /dev/null +++ b/Tests/subset/data/expect_HVVAR_retain_gids.ttx @@ -0,0 +1,182 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ttFont sfntVersion="\x00\x01\x00\x00" ttLibVersion="3.40"> + + <GlyphOrder> + <!-- The 'id' attribute is only for humans; it is ignored when parsed. --> + <GlyphID id="0" name=".notdef"/> + <GlyphID id="1" name="glyph00001"/> + <GlyphID id="2" name="B"/> + <GlyphID id="3" name="glyph00003"/> + <GlyphID id="4" name="D"/> + <GlyphID id="5" name="glyph00005"/> + </GlyphOrder> + + <HVAR> + <Version value="0x00010000"/> + <VarStore Format="1"> + <Format value="1"/> + <VarRegionList> + <!-- RegionAxisCount=1 --> + <!-- RegionCount=2 --> + <Region index="0"> + <VarRegionAxis index="0"> + <StartCoord value="-1.0"/> + <PeakCoord value="-1.0"/> + <EndCoord value="0.0"/> + </VarRegionAxis> + </Region> + <Region index="1"> + <VarRegionAxis index="0"> + <StartCoord value="0.0"/> + <PeakCoord value="1.0"/> + <EndCoord value="1.0"/> + </VarRegionAxis> + </Region> + </VarRegionList> + <!-- VarDataCount=2 --> + <VarData index="0"> + <!-- ItemCount=6 --> + <NumShorts value="0"/> + <!-- VarRegionCount=1 --> + <VarRegionIndex index="0" value="1"/> + <Item index="0" value="[1]"/> + <Item index="1" value="[2]"/> + <Item index="2" value="[3]"/> + <Item index="3" value="[4]"/> + <Item index="4" value="[5]"/> + <Item index="5" value="[0]"/> + </VarData> + <VarData index="1"> + <!-- ItemCount=3 --> + <NumShorts value="1"/> + <!-- VarRegionCount=2 --> + <VarRegionIndex index="0" value="0"/> + <VarRegionIndex index="1" value="1"/> + <Item index="0" value="[11, 22]"/> + <Item index="1" value="[126, 23]"/> + <Item index="2" value="[-129, 26]"/> + </VarData> + </VarStore> + <LsbMap> + <Map glyph=".notdef" outer="0" inner="2"/> + <Map glyph="B" outer="1" inner="0"/> + <Map glyph="D" outer="0" inner="3"/> + <Map glyph="glyph00001" outer="0" inner="0"/> + <Map glyph="glyph00003" outer="0" inner="0"/> + <Map glyph="glyph00005" outer="0" inner="3"/> + </LsbMap> + <RsbMap> + <Map glyph=".notdef" outer="0" inner="1"/> + <Map glyph="B" outer="1" inner="2"/> + <Map glyph="D" outer="1" inner="1"/> + <Map glyph="glyph00001" outer="0" inner="0"/> + <Map glyph="glyph00003" outer="0" inner="0"/> + <Map glyph="glyph00005" outer="1" inner="1"/> + </RsbMap> + </HVAR> + + <VVAR> + <Version value="0x00010000"/> + <VarStore Format="1"> + <Format value="1"/> + <VarRegionList> + <!-- RegionAxisCount=1 --> + <!-- RegionCount=3 --> + <Region index="0"> + <VarRegionAxis index="0"> + <StartCoord value="0.0"/> + <PeakCoord value="1.0"/> + <EndCoord value="1.0"/> + </VarRegionAxis> + </Region> + <Region index="1"> + <VarRegionAxis index="0"> + <StartCoord value="-1.0"/> + <PeakCoord value="-0.5"/> + <EndCoord value="0.0"/> + </VarRegionAxis> + </Region> + <Region index="2"> + <VarRegionAxis index="0"> + <StartCoord value="0.0"/> + <PeakCoord value="0.5"/> + <EndCoord value="1.0"/> + </VarRegionAxis> + </Region> + </VarRegionList> + <!-- VarDataCount=2 --> + <VarData index="0"> + <!-- ItemCount=2 --> + <NumShorts value="0"/> + <!-- VarRegionCount=1 --> + <VarRegionIndex index="0" value="0"/> + <Item index="0" value="[0]"/> + <Item index="1" value="[6]"/> + </VarData> + <VarData index="1"> + <!-- ItemCount=4 --> + <NumShorts value="1"/> + <!-- VarRegionCount=3 --> + <VarRegionIndex index="0" value="1"/> + <VarRegionIndex index="1" value="0"/> + <VarRegionIndex index="2" value="2"/> + <Item index="0" value="[11, 1, 21]"/> + <Item index="1" value="[12, 2, 22]"/> + <Item index="2" value="[14, 4, 24]"/> + <Item index="3" value="[-129, 5, 25]"/> + </VarData> + </VarStore> + <AdvHeightMap> + <Map glyph=".notdef" outer="1" inner="0"/> + <Map glyph="B" outer="0" inner="0"/> + <Map glyph="D" outer="1" inner="1"/> + <Map glyph="glyph00001" outer="0" inner="0"/> + <Map glyph="glyph00003" outer="0" inner="0"/> + <Map glyph="glyph00005" outer="1" inner="1"/> + </AdvHeightMap> + <VOrgMap> + <Map glyph=".notdef" outer="1" inner="2"/> + <Map glyph="B" outer="0" inner="1"/> + <Map glyph="D" outer="1" inner="3"/> + <Map glyph="glyph00001" outer="0" inner="0"/> + <Map glyph="glyph00003" outer="0" inner="0"/> + <Map glyph="glyph00005" outer="1" inner="3"/> + </VOrgMap> + </VVAR> + + <avar> + <segment axis="wght"> + <mapping from="-1.0" to="-1.0"/> + <mapping from="0.0" to="0.0"/> + <mapping from="0.3" to="0.5"/> + <mapping from="1.0" to="1.0"/> + </segment> + </avar> + + <fvar> + <Axis> + <AxisTag>wght</AxisTag> + <Flags>0x0</Flags> + <MinValue>100.0</MinValue> + <DefaultValue>400.0</DefaultValue> + <MaxValue>900.0</MaxValue> + <AxisNameID>257</AxisNameID> + </Axis> + <NamedInstance flags="0x0" subfamilyNameID="258"> + <coord axis="wght" value="100.0"/> + </NamedInstance> + <NamedInstance flags="0x0" subfamilyNameID="259"> + <coord axis="wght" value="300.0"/> + </NamedInstance> + <NamedInstance flags="0x0" subfamilyNameID="260"> + <coord axis="wght" value="400.0"/> + </NamedInstance> + <NamedInstance flags="0x0" subfamilyNameID="261"> + <coord axis="wght" value="700.0"/> + </NamedInstance> + <NamedInstance flags="0x0" subfamilyNameID="262"> + <coord axis="wght" value="900.0"/> + </NamedInstance> + </fvar> + +</ttFont> diff --git a/Tests/subset/data/test_cntrmask_CFF.desub.ttx b/Tests/subset/data/test_cntrmask_CFF.desub.ttx new file mode 100644 index 00000000..ff1c8c59 --- /dev/null +++ b/Tests/subset/data/test_cntrmask_CFF.desub.ttx @@ -0,0 +1,70 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ttFont sfntVersion="OTTO" ttLibVersion="3.41"> + + <CFF> + <major value="1"/> + <minor value="0"/> + <CFFFont name="LibertinusSerif-Regular"> + <version value="6.8"/> + <Notice value="Copyright © 2012-2019 The Libertinus Project Authors."/> + <FullName value="Libertinus Serif Regular"/> + <FamilyName value="Libertinus Serif"/> + <Weight value="Regular"/> + <isFixedPitch value="0"/> + <ItalicAngle value="0"/> + <UnderlinePosition value="-98"/> + <UnderlineThickness value="40"/> + <PaintType value="0"/> + <CharstringType value="2"/> + <FontMatrix value="0.001 0 0 0.001 0 0"/> + <FontBBox value="-6275 -256 6171 1125"/> + <StrokeWidth value="0"/> + <!-- charset is dumped separately as the 'GlyphOrder' element --> + <Encoding name="StandardEncoding"/> + <Private> + <BlueValues value="-12 0 429 442 460 472 600 610 645 658 688 698"/> + <OtherBlues value="-238 -227"/> + <FamilyBlues value="-12 0 429 442 460 472 600 610 645 658 688 698"/> + <FamilyOtherBlues value="-238 -227"/> + <BlueScale value="0.0396"/> + <BlueShift value="6"/> + <BlueFuzz value="1"/> + <StdHW value="36"/> + <StdVW value="79"/> + <StemSnapH value="36"/> + <StemSnapV value="79 86"/> + <ForceBold value="0"/> + <LanguageGroup value="0"/> + <ExpansionFactor value="0.06"/> + <initialRandomSeed value="0"/> + <defaultWidthX value="0"/> + <nominalWidthX value="595"/> + </Private> + <CharStrings> + <CharString name=".notdef"> + -95 endchar + </CharString> + <CharString name="Idieresis"> + -298 -2 33 583 33 62 96 hstem + 6 96 4 85 4 96 vstem + cntrmask 00011100 + 191 122 rmoveto + 401 vlineto + 0 83 17 5 70 3 6 6 0 21 -6 6 -44 -1 -47.5 -1 -38.5 0 -33.5 0 -48.5 1 -47 1 -6 -6 0 -21 6 -6 70 -3 17 -5 0 -83 rrcurveto + -401 vlineto + 0 -83 -17 -5 -70 -3 -6 -6 0 -21 6 -6 45 1 48.7002 1 36.2998 0 35.59961 0 48.40039 -1 45 -1 6 6 0 21 -6 6 -70 3 -17 5 0 83 rrcurveto + 4 635 rmoveto + -26 22 -22 26 26 22 22 26 26 -22 22 -26 -26 -22 -22 -26 vhcurveto + -189 hmoveto + -26 22 -22 26 26 22 22 26 26 -22 22 -26 -26 -22 -22 -26 vhcurveto + endchar + </CharString> + </CharStrings> + </CFFFont> + + <GlobalSubrs> + <!-- The 'index' attribute is only for humans; it is ignored when parsed. --> + </GlobalSubrs> + </CFF> + +</ttFont> diff --git a/Tests/subset/data/test_cntrmask_CFF.ttx b/Tests/subset/data/test_cntrmask_CFF.ttx new file mode 100644 index 00000000..5ab6268f --- /dev/null +++ b/Tests/subset/data/test_cntrmask_CFF.ttx @@ -0,0 +1,417 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ttFont sfntVersion="OTTO" ttLibVersion="3.41"> + + <GlyphOrder> + <!-- The 'id' attribute is only for humans; it is ignored when parsed. --> + <GlyphID id="0" name=".notdef"/> + <GlyphID id="1" name="Idieresis"/> + </GlyphOrder> + + <head> + <!-- Most of this table will be recalculated by the compiler --> + <tableVersion value="1.0"/> + <fontRevision value="6.79999"/> + <checkSumAdjustment value="0xd2a3b881"/> + <magicNumber value="0x5f0f3cf5"/> + <flags value="00000000 00001011"/> + <unitsPerEm value="1000"/> + <created value="Thu Aug 24 21:44:22 2006"/> + <modified value="Thu Jan 1 00:00:00 1970"/> + <xMin value="-6275"/> + <yMin value="-256"/> + <xMax value="6171"/> + <yMax value="1125"/> + <macStyle value="00000000 00000000"/> + <lowestRecPPEM value="8"/> + <fontDirectionHint value="2"/> + <indexToLocFormat value="0"/> + <glyphDataFormat value="0"/> + </head> + + <hhea> + <tableVersion value="0x00010000"/> + <ascent value="894"/> + <descent value="-246"/> + <lineGap value="0"/> + <advanceWidthMax value="6272"/> + <minLeftSideBearing value="-6275"/> + <minRightSideBearing value="-953"/> + <xMaxExtent value="6171"/> + <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="2"/> + </hhea> + + <maxp> + <tableVersion value="0x5000"/> + <numGlyphs value="2"/> + </maxp> + + <OS_2> + <!-- The fields 'usFirstCharIndex' and 'usLastCharIndex' + will be recalculated by the compiler --> + <version value="4"/> + <xAvgCharWidth value="559"/> + <usWeightClass value="400"/> + <usWidthClass value="5"/> + <fsType value="00000000 00000000"/> + <ySubscriptXSize value="650"/> + <ySubscriptYSize value="700"/> + <ySubscriptXOffset value="0"/> + <ySubscriptYOffset value="140"/> + <ySuperscriptXSize value="650"/> + <ySuperscriptYSize value="700"/> + <ySuperscriptXOffset value="0"/> + <ySuperscriptYOffset value="480"/> + <yStrikeoutSize value="49"/> + <yStrikeoutPosition value="258"/> + <sFamilyClass value="261"/> + <panose> + <bFamilyType value="2"/> + <bSerifStyle value="0"/> + <bWeight value="5"/> + <bProportion value="3"/> + <bContrast value="0"/> + <bStrokeVariation value="0"/> + <bArmStyle value="0"/> + <bLetterForm value="0"/> + <bMidline value="0"/> + <bXHeight value="0"/> + </panose> + <ulUnicodeRange1 value="00000000 00000000 00000000 00000010"/> + <ulUnicodeRange2 value="00000000 00000000 00000000 00000000"/> + <ulUnicodeRange3 value="00000000 00000000 00000000 00000000"/> + <ulUnicodeRange4 value="00000000 00000000 00000000 00000000"/> + <achVendID value="ALIF"/> + <fsSelection value="00000000 11000000"/> + <usFirstCharIndex value="207"/> + <usLastCharIndex value="207"/> + <sTypoAscender value="894"/> + <sTypoDescender value="-246"/> + <sTypoLineGap value="0"/> + <usWinAscent value="894"/> + <usWinDescent value="246"/> + <ulCodePageRange1 value="01100000 00000000 00000001 10111111"/> + <ulCodePageRange2 value="00000000 00000000 00000000 00000000"/> + <sxHeight value="429"/> + <sCapHeight value="658"/> + <usDefaultChar value="32"/> + <usBreakChar value="32"/> + <usMaxContext value="12"/> + </OS_2> + + <name> + <namerecord nameID="0" platformID="3" platEncID="1" langID="0x409"> + Copyright © 2012-2019 The Libertinus Project Authors. + </namerecord> + <namerecord nameID="1" platformID="3" platEncID="1" langID="0x409"> + Libertinus Serif + </namerecord> + <namerecord nameID="2" platformID="3" platEncID="1" langID="0x409"> + Regular + </namerecord> + <namerecord nameID="3" platformID="3" platEncID="1" langID="0x409"> + 6.8;ALIF;LibertinusSerif-Regular + </namerecord> + <namerecord nameID="4" platformID="3" platEncID="1" langID="0x409"> + Libertinus Serif Regular + </namerecord> + <namerecord nameID="5" platformID="3" platEncID="1" langID="0x409"> + Version 6.8 + </namerecord> + <namerecord nameID="6" platformID="3" platEncID="1" langID="0x409"> + LibertinusSerif-Regular + </namerecord> + </name> + + <cmap> + <tableVersion version="0"/> + <cmap_format_4 platformID="0" platEncID="3" language="0"> + <map code="0xcf" name="Idieresis"/><!-- LATIN CAPITAL LETTER I WITH DIAERESIS --> + </cmap_format_4> + <cmap_format_12 platformID="0" platEncID="4" format="12" reserved="0" length="28" language="0" nGroups="1"> + <map code="0xcf" name="Idieresis"/><!-- LATIN CAPITAL LETTER I WITH DIAERESIS --> + </cmap_format_12> + <cmap_format_4 platformID="3" platEncID="1" language="0"> + <map code="0xcf" name="Idieresis"/><!-- LATIN CAPITAL LETTER I WITH DIAERESIS --> + </cmap_format_4> + <cmap_format_12 platformID="3" platEncID="10" format="12" reserved="0" length="28" language="0" nGroups="1"> + <map code="0xcf" name="Idieresis"/><!-- LATIN CAPITAL LETTER I WITH DIAERESIS --> + </cmap_format_12> + </cmap> + + <post> + <formatType value="3.0"/> + <italicAngle value="0.0"/> + <underlinePosition value="-78"/> + <underlineThickness value="40"/> + <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="LibertinusSerif-Regular"> + <version value="6.8"/> + <Notice value="Copyright © 2012-2019 The Libertinus Project Authors."/> + <FullName value="Libertinus Serif Regular"/> + <FamilyName value="Libertinus Serif"/> + <Weight value="Regular"/> + <isFixedPitch value="0"/> + <ItalicAngle value="0"/> + <UnderlinePosition value="-98"/> + <UnderlineThickness value="40"/> + <PaintType value="0"/> + <CharstringType value="2"/> + <FontMatrix value="0.001 0 0 0.001 0 0"/> + <FontBBox value="-6275 -256 6171 1125"/> + <StrokeWidth value="0"/> + <!-- charset is dumped separately as the 'GlyphOrder' element --> + <Encoding name="StandardEncoding"/> + <Private> + <BlueValues value="-12 0 429 442 460 472 600 610 645 658 688 698"/> + <OtherBlues value="-238 -227"/> + <FamilyBlues value="-12 0 429 442 460 472 600 610 645 658 688 698"/> + <FamilyOtherBlues value="-238 -227"/> + <BlueScale value="0.0396"/> + <BlueShift value="6"/> + <BlueFuzz value="1"/> + <StdHW value="36"/> + <StdVW value="79"/> + <StemSnapH value="36"/> + <StemSnapV value="79 86"/> + <ForceBold value="0"/> + <LanguageGroup value="0"/> + <ExpansionFactor value="0.06"/> + <initialRandomSeed value="0"/> + <defaultWidthX value="0"/> + <nominalWidthX value="595"/> + <Subrs> + <!-- The 'index' attribute is only for humans; it is ignored when parsed. --> + <CharString index="0"> + -26 22 -22 26 26 22 22 26 26 -22 22 -26 -26 -22 -22 -26 vhcurveto + return + </CharString> + <CharString index="1"> + 401 vlineto + 0 83 17 5 70 3 6 6 0 21 -6 6 -44 -1 -47.5 -1 -38.5 0 -33.5 0 -48.5 1 -47 1 -6 -6 0 -21 6 -6 70 -3 17 -5 0 -83 rrcurveto + -401 vlineto + 0 -83 -17 -5 -70 -3 -6 -6 0 -21 6 -6 45 1 48.7002 1 36.2998 0 35.59961 0 48.40039 -1 45 -1 6 6 0 21 -6 6 -70 3 -17 5 0 83 rrcurveto + return + </CharString> + </Subrs> + </Private> + <CharStrings> + <CharString name=".notdef"> + -95 endchar + </CharString> + <CharString name="Idieresis"> + -298 -2 33 583 33 62 96 hstem + 6 96 4 85 4 96 vstem + cntrmask 00011100 + 191 122 rmoveto + -106 callsubr + 4 635 rmoveto + -107 callsubr + -189 hmoveto + -107 callsubr + endchar + </CharString> + </CharStrings> + </CFFFont> + + <GlobalSubrs> + <!-- The 'index' attribute is only for humans; it is ignored when parsed. --> + </GlobalSubrs> + </CFF> + + <GDEF> + <Version value="0x00010002"/> + <GlyphClassDef Format="1"> + <ClassDef glyph="Idieresis" class="1"/> + </GlyphClassDef> + <MarkGlyphSetsDef> + <MarkSetTableFormat value="1"/> + <!-- MarkSetCount=1 --> + <Coverage index="0" Format="1"> + </Coverage> + </MarkGlyphSetsDef> + </GDEF> + + <GPOS> + <Version value="0x00010000"/> + <ScriptList> + <!-- ScriptCount=4 --> + <ScriptRecord index="0"> + <ScriptTag value="DFLT"/> + <Script> + <DefaultLangSys> + <ReqFeatureIndex value="65535"/> + <!-- FeatureCount=1 --> + <FeatureIndex index="0" value="0"/> + </DefaultLangSys> + <!-- LangSysCount=0 --> + </Script> + </ScriptRecord> + <ScriptRecord index="1"> + <ScriptTag value="cyrl"/> + <Script> + <DefaultLangSys> + <ReqFeatureIndex value="65535"/> + <!-- FeatureCount=1 --> + <FeatureIndex index="0" value="1"/> + </DefaultLangSys> + <!-- LangSysCount=0 --> + </Script> + </ScriptRecord> + <ScriptRecord index="2"> + <ScriptTag value="grek"/> + <Script> + <DefaultLangSys> + <ReqFeatureIndex value="65535"/> + <!-- FeatureCount=1 --> + <FeatureIndex index="0" value="2"/> + </DefaultLangSys> + <!-- LangSysCount=0 --> + </Script> + </ScriptRecord> + <ScriptRecord index="3"> + <ScriptTag value="latn"/> + <Script> + <DefaultLangSys> + <ReqFeatureIndex value="65535"/> + <!-- FeatureCount=1 --> + <FeatureIndex index="0" value="3"/> + </DefaultLangSys> + <!-- LangSysCount=0 --> + </Script> + </ScriptRecord> + </ScriptList> + <FeatureList> + <!-- FeatureCount=4 --> + <FeatureRecord index="0"> + <FeatureTag value="kern"/> + <Feature> + <!-- LookupCount=1 --> + <LookupListIndex index="0" value="0"/> + </Feature> + </FeatureRecord> + <FeatureRecord index="1"> + <FeatureTag value="kern"/> + <Feature> + <!-- LookupCount=1 --> + <LookupListIndex index="0" value="0"/> + </Feature> + </FeatureRecord> + <FeatureRecord index="2"> + <FeatureTag value="kern"/> + <Feature> + <!-- LookupCount=1 --> + <LookupListIndex index="0" value="0"/> + </Feature> + </FeatureRecord> + <FeatureRecord index="3"> + <FeatureTag value="kern"/> + <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="Idieresis"/> + </Coverage> + <ValueFormat1 value="4"/> + <ValueFormat2 value="0"/> + <ClassDef1 Format="1"> + <ClassDef glyph="Idieresis" class="1"/> + </ClassDef1> + <ClassDef2 Format="2"> + </ClassDef2> + <!-- Class1Count=2 --> + <!-- Class2Count=1 --> + <Class1Record index="0"> + <Class2Record index="0"> + <Value1 XAdvance="0"/> + </Class2Record> + </Class1Record> + <Class1Record index="1"> + <Class2Record index="0"> + <Value1 XAdvance="0"/> + </Class2Record> + </Class1Record> + </PairPos> + </Lookup> + </LookupList> + </GPOS> + + <GSUB> + <Version value="0x00010000"/> + <ScriptList> + <!-- ScriptCount=5 --> + <ScriptRecord index="0"> + <ScriptTag value="DFLT"/> + <Script> + <DefaultLangSys> + <ReqFeatureIndex value="65535"/> + <!-- FeatureCount=0 --> + </DefaultLangSys> + <!-- LangSysCount=0 --> + </Script> + </ScriptRecord> + <ScriptRecord index="1"> + <ScriptTag value="cyrl"/> + <Script> + <!-- LangSysCount=0 --> + </Script> + </ScriptRecord> + <ScriptRecord index="2"> + <ScriptTag value="grek"/> + <Script> + <!-- LangSysCount=0 --> + </Script> + </ScriptRecord> + <ScriptRecord index="3"> + <ScriptTag value="hebr"/> + <Script> + <!-- LangSysCount=0 --> + </Script> + </ScriptRecord> + <ScriptRecord index="4"> + <ScriptTag value="latn"/> + <Script> + <!-- LangSysCount=0 --> + </Script> + </ScriptRecord> + </ScriptList> + <FeatureList> + <!-- FeatureCount=0 --> + </FeatureList> + <LookupList> + <!-- LookupCount=0 --> + </LookupList> + </GSUB> + + <hmtx> + <mtx name=".notdef" width="500" lsb="0"/> + <mtx name="Idieresis" width="297" lsb="6"/> + </hmtx> + +</ttFont> diff --git a/Tests/subset/subset_test.py b/Tests/subset/subset_test.py index 2fc3b8af..eb632dc0 100644 --- a/Tests/subset/subset_test.py +++ b/Tests/subset/subset_test.py @@ -426,6 +426,16 @@ class SubsetTest(unittest.TestCase): self.expect_ttx(subsetfont, self.getpath( "test_hinted_subrs_CFF.desub.ttx"), ["CFF "]) + def test_desubroutinize_cntrmask_CFF(self): + ttxpath = self.getpath("test_cntrmask_CFF.ttx") + _, fontpath = self.compile_font(ttxpath, ".otf") + subsetpath = self.temp_path(".otf") + subset.main([fontpath, "--desubroutinize", "--notdef-outline", + "--output-file=%s" % subsetpath, "*"]) + subsetfont = TTFont(subsetpath) + self.expect_ttx(subsetfont, self.getpath( + "test_cntrmask_CFF.desub.ttx"), ["CFF "]) + def test_no_hinting_desubroutinize_CFF(self): ttxpath = self.getpath("test_hinted_subrs_CFF.ttx") _, fontpath = self.compile_font(ttxpath, ".otf") @@ -485,6 +495,24 @@ class SubsetTest(unittest.TestCase): subset.main([fontpath, "--recalc-timestamp", "--output-file=%s" % subsetpath, "*"]) self.assertLess(modified, TTFont(subsetpath)['head'].modified) + def test_recalc_max_context(self): + ttxpath = self.getpath("Lobster.subset.ttx") + font = TTFont() + font.importXML(ttxpath) + max_context = font['OS/2'].usMaxContext + _, fontpath = self.compile_font(ttxpath, ".otf") + subsetpath = self.temp_path(".otf") + + # by default, the subsetter does not recalculate the usMaxContext + subset.main([fontpath, "--drop-tables+=GSUB,GPOS", + "--output-file=%s" % subsetpath]) + self.assertEqual(max_context, TTFont(subsetpath)['OS/2'].usMaxContext) + + subset.main([fontpath, "--recalc-max-context", + "--drop-tables+=GSUB,GPOS", + "--output-file=%s" % subsetpath]) + self.assertEqual(0, TTFont(subsetpath)['OS/2'].usMaxContext) + def test_retain_gids_ttf(self): _, fontpath = self.compile_font(self.getpath("TestTTF-Regular.ttx"), ".ttf") font = TTFont(fontpath) @@ -553,8 +581,8 @@ class SubsetTest(unittest.TestCase): self.assertEqual(cs["B"].program, ["endchar"]) def test_retain_gids_cff2(self): - fontpath = self.getpath("../../varLib/data/TestCFF2VF.otf") - font = TTFont(fontpath) + ttx_path = self.getpath("../../varLib/data/master_ttx_varfont_otf/TestCFF2VF.ttx") + font, fontpath = self.compile_font(ttx_path, ".otf") self.assertEqual(font["hmtx"]["A"], (600, 31)) self.assertEqual(font["hmtx"]["T"], (600, 41)) @@ -586,6 +614,20 @@ class SubsetTest(unittest.TestCase): self.assertGreater(len(cs["A"].program), 0) self.assertEqual(cs["glyph00002"].program, []) + def test_HVAR_VVAR(self): + _, fontpath = self.compile_font(self.getpath("TestHVVAR.ttx"), ".ttf") + subsetpath = self.temp_path(".ttf") + subset.main([fontpath, "--text=BD", "--output-file=%s" % subsetpath]) + subsetfont = TTFont(subsetpath) + self.expect_ttx(subsetfont, self.getpath("expect_HVVAR.ttx"), ["GlyphOrder", "HVAR", "VVAR", "avar", "fvar"]) + + def test_HVAR_VVAR_retain_gids(self): + _, fontpath = self.compile_font(self.getpath("TestHVVAR.ttx"), ".ttf") + subsetpath = self.temp_path(".ttf") + subset.main([fontpath, "--text=BD", "--retain-gids", "--output-file=%s" % subsetpath]) + subsetfont = TTFont(subsetpath) + self.expect_ttx(subsetfont, self.getpath("expect_HVVAR_retain_gids.ttx"), ["GlyphOrder", "HVAR", "VVAR", "avar", "fvar"]) + if __name__ == "__main__": sys.exit(unittest.main()) |