[Tests/subset] Add a test case for .notdef glyph width (#845)
This commit is contained in:
parent
87527d7261
commit
7ac8c32274
267
Tests/subset/data/NotdefWidthCID-Regular.ttx
Normal file
267
Tests/subset/data/NotdefWidthCID-Regular.ttx
Normal file
@ -0,0 +1,267 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ttFont sfntVersion="OTTO" ttLibVersion="3.7">
|
||||
|
||||
<GlyphOrder>
|
||||
<!-- The 'id' attribute is only for humans; it is ignored when parsed. -->
|
||||
<GlyphID id="0" name=".notdef"/>
|
||||
<GlyphID id="1" name="cid00001"/>
|
||||
</GlyphOrder>
|
||||
|
||||
<head>
|
||||
<!-- Most of this table will be recalculated by the compiler -->
|
||||
<tableVersion value="1.0"/>
|
||||
<fontRevision value="1.0"/>
|
||||
<checkSumAdjustment value="0x7f79b966"/>
|
||||
<magicNumber value="0x5f0f3cf5"/>
|
||||
<flags value="00000000 00000011"/>
|
||||
<unitsPerEm value="1000"/>
|
||||
<created value="Mon Jun 15 05:17:40 2015"/>
|
||||
<modified value="Thu Feb 16 03:38:22 2017"/>
|
||||
<xMin value="-1000"/>
|
||||
<yMin value="-1048"/>
|
||||
<xMax value="2928"/>
|
||||
<yMax value="1808"/>
|
||||
<macStyle value="00000000 00000000"/>
|
||||
<lowestRecPPEM value="3"/>
|
||||
<fontDirectionHint value="2"/>
|
||||
<indexToLocFormat value="0"/>
|
||||
<glyphDataFormat value="0"/>
|
||||
</head>
|
||||
|
||||
<hhea>
|
||||
<tableVersion value="0x00010000"/>
|
||||
<ascent value="1000"/>
|
||||
<descent value="-320"/>
|
||||
<lineGap value="0"/>
|
||||
<advanceWidthMax value="1000"/>
|
||||
<minLeftSideBearing value="-1000"/>
|
||||
<minRightSideBearing value="-181"/>
|
||||
<xMaxExtent value="2928"/>
|
||||
<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="3"/>
|
||||
<xAvgCharWidth value="979"/>
|
||||
<usWeightClass value="350"/>
|
||||
<usWidthClass value="5"/>
|
||||
<fsType value="00000000 00000000"/>
|
||||
<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="325"/>
|
||||
<sFamilyClass value="0"/>
|
||||
<panose>
|
||||
<bFamilyType value="2"/>
|
||||
<bSerifStyle value="11"/>
|
||||
<bWeight value="4"/>
|
||||
<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 00000000"/>
|
||||
<ulUnicodeRange2 value="00000000 00000000 00000000 00000000"/>
|
||||
<ulUnicodeRange3 value="00000000 00000000 00000000 00000000"/>
|
||||
<ulUnicodeRange4 value="00000000 00000000 00000000 00000000"/>
|
||||
<achVendID value="UKWN"/>
|
||||
<fsSelection value="00000000 00000000"/>
|
||||
<usFirstCharIndex value="32"/>
|
||||
<usLastCharIndex value="32"/>
|
||||
<sTypoAscender value="880"/>
|
||||
<sTypoDescender value="-120"/>
|
||||
<sTypoLineGap value="0"/>
|
||||
<usWinAscent value="1160"/>
|
||||
<usWinDescent value="320"/>
|
||||
<ulCodePageRange1 value="00000000 00000000 00000000 00000001"/>
|
||||
<ulCodePageRange2 value="00000000 00000000 00000000 00000000"/>
|
||||
<sxHeight value="543"/>
|
||||
<sCapHeight value="733"/>
|
||||
<usDefaultChar value="0"/>
|
||||
<usBreakChar value="32"/>
|
||||
<usMaxContext value="6"/>
|
||||
</OS_2>
|
||||
|
||||
<name>
|
||||
<namerecord nameID="1" platformID="3" platEncID="1" langID="0x409">
|
||||
Notdef Width CID
|
||||
</namerecord>
|
||||
<namerecord nameID="2" platformID="3" platEncID="1" langID="0x409">
|
||||
Regular
|
||||
</namerecord>
|
||||
</name>
|
||||
|
||||
<cmap>
|
||||
<tableVersion version="0"/>
|
||||
<cmap_format_4 platformID="0" platEncID="3" language="0">
|
||||
<map code="0x20" name="cid00001"/><!-- SPACE -->
|
||||
</cmap_format_4>
|
||||
<cmap_format_4 platformID="3" platEncID="1" language="0">
|
||||
<map code="0x20" name="cid00001"/><!-- SPACE -->
|
||||
</cmap_format_4>
|
||||
</cmap>
|
||||
|
||||
<post>
|
||||
<formatType value="3.0"/>
|
||||
<italicAngle value="0.0"/>
|
||||
<underlinePosition value="-125"/>
|
||||
<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="NotdefWidthCID-Regular">
|
||||
<ROS Registry="Adobe" Order="Identity" Supplement="0"/>
|
||||
<FullName value="Notdef Width CID Regular"/>
|
||||
<FamilyName value="Notdef Width CID"/>
|
||||
<Weight value="Regular"/>
|
||||
<isFixedPitch value="0"/>
|
||||
<ItalicAngle value="0"/>
|
||||
<UnderlinePosition value="-150"/>
|
||||
<UnderlineThickness value="50"/>
|
||||
<PaintType value="0"/>
|
||||
<CharstringType value="2"/>
|
||||
<FontMatrix value="0.001 0 0 0.001 0 0"/>
|
||||
<FontBBox value="-1000 -1000 1000 1000"/>
|
||||
<StrokeWidth value="0"/>
|
||||
<CIDFontVersion value="1.0"/>
|
||||
<CIDFontRevision value="0"/>
|
||||
<CIDFontType value="0"/>
|
||||
<CIDCount value="4"/>
|
||||
<!-- charset is dumped separately as the 'GlyphOrder' element -->
|
||||
<FDSelect format="3"/>
|
||||
<FDArray>
|
||||
<FontDict index="0">
|
||||
<FontName value="NotdefWidthCID-Regular-Space"/>
|
||||
<FontMatrix value="0.001 0 0 0.001 0 0"/>
|
||||
<Private>
|
||||
<BlueScale value="0.039625"/>
|
||||
<BlueShift value="7"/>
|
||||
<BlueFuzz value="1"/>
|
||||
<ForceBold value="0"/>
|
||||
<LanguageGroup value="0"/>
|
||||
<ExpansionFactor value="0.06"/>
|
||||
<initialRandomSeed value="0"/>
|
||||
<defaultWidthX value="602"/>
|
||||
<nominalWidthX value="630"/>
|
||||
<Subrs>
|
||||
<!-- The 'index' attribute is only for humans; it is ignored when parsed. -->
|
||||
</Subrs>
|
||||
</Private>
|
||||
</FontDict>
|
||||
<FontDict index="1">
|
||||
<FontName value="NotdefWidthCID-Regular-Notdef"/>
|
||||
<FontMatrix value="0.001 0 0 0.001 0 0"/>
|
||||
<Private>
|
||||
<BlueScale value="0.039625"/>
|
||||
<BlueShift value="7"/>
|
||||
<BlueFuzz value="1"/>
|
||||
<ForceBold value="0"/>
|
||||
<LanguageGroup value="0"/>
|
||||
<ExpansionFactor value="0.06"/>
|
||||
<initialRandomSeed value="0"/>
|
||||
<defaultWidthX value="1000"/>
|
||||
<nominalWidthX value="107"/>
|
||||
<Subrs>
|
||||
<!-- The 'index' attribute is only for humans; it is ignored when parsed. -->
|
||||
</Subrs>
|
||||
</Private>
|
||||
</FontDict>
|
||||
</FDArray>
|
||||
<CharStrings>
|
||||
<CharString name=".notdef" fdSelectIndex="1">
|
||||
-120 50 900 50 hstem
|
||||
100 50 700 50 vstem
|
||||
100 -120 rmoveto
|
||||
800 1000 -800 hlineto
|
||||
400 -459 rmoveto
|
||||
-318 409 rlineto
|
||||
636 hlineto
|
||||
-286 -450 rmoveto
|
||||
318 409 rlineto
|
||||
-818 vlineto
|
||||
-668 -41 rmoveto
|
||||
318 409 318 -409 rlineto
|
||||
-668 859 rmoveto
|
||||
318 -409 -318 -409 rlineto
|
||||
endchar
|
||||
</CharString>
|
||||
<CharString name="cid00001" fdSelectIndex="0">
|
||||
-407 endchar
|
||||
</CharString>
|
||||
</CharStrings>
|
||||
</CFFFont>
|
||||
|
||||
<GlobalSubrs>
|
||||
<!-- The 'index' attribute is only for humans; it is ignored when parsed. -->
|
||||
</GlobalSubrs>
|
||||
</CFF>
|
||||
|
||||
<VORG>
|
||||
<majorVersion value="1"/>
|
||||
<minorVersion value="0"/>
|
||||
<defaultVertOriginY value="880"/>
|
||||
<numVertOriginYMetrics value="0"/>
|
||||
</VORG>
|
||||
|
||||
<hmtx>
|
||||
<mtx name=".notdef" width="1000" lsb="100"/>
|
||||
<mtx name="cid00001" width="223" lsb="0"/>
|
||||
</hmtx>
|
||||
|
||||
<vhea>
|
||||
<tableVersion value="0x00011000"/>
|
||||
<ascent value="500"/>
|
||||
<descent value="-500"/>
|
||||
<lineGap value="0"/>
|
||||
<advanceHeightMax value="3000"/>
|
||||
<minTopSideBearing value="-1000"/>
|
||||
<minBottomSideBearing value="-672"/>
|
||||
<yMaxExtent value="2928"/>
|
||||
<caretSlopeRise value="0"/>
|
||||
<caretSlopeRun value="1"/>
|
||||
<caretOffset value="0"/>
|
||||
<reserved1 value="0"/>
|
||||
<reserved2 value="0"/>
|
||||
<reserved3 value="0"/>
|
||||
<reserved4 value="0"/>
|
||||
<metricDataFormat value="0"/>
|
||||
<numberOfVMetrics value="1"/>
|
||||
</vhea>
|
||||
|
||||
<vmtx>
|
||||
<mtx name=".notdef" height="1000" tsb="0"/>
|
||||
<mtx name="cid00001" height="1000" tsb="880"/>
|
||||
</vmtx>
|
||||
|
||||
</ttFont>
|
80
Tests/subset/data/expect_notdef_width_cid.ttx
Normal file
80
Tests/subset/data/expect_notdef_width_cid.ttx
Normal file
@ -0,0 +1,80 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ttFont sfntVersion="OTTO" ttLibVersion="3.7">
|
||||
|
||||
<CFF>
|
||||
<major value="1"/>
|
||||
<minor value="0"/>
|
||||
<CFFFont name="NotdefWidthCID-Regular">
|
||||
<ROS Registry="Adobe" Order="Identity" Supplement="0"/>
|
||||
<FullName value="Notdef Width CID Regular"/>
|
||||
<FamilyName value="Notdef Width CID"/>
|
||||
<Weight value="Regular"/>
|
||||
<isFixedPitch value="0"/>
|
||||
<ItalicAngle value="0"/>
|
||||
<UnderlinePosition value="-150"/>
|
||||
<UnderlineThickness value="50"/>
|
||||
<PaintType value="0"/>
|
||||
<CharstringType value="2"/>
|
||||
<FontMatrix value="0.001 0 0 0.001 0 0"/>
|
||||
<FontBBox value="-1000 -1000 1000 1000"/>
|
||||
<StrokeWidth value="0"/>
|
||||
<CIDFontVersion value="1.0"/>
|
||||
<CIDFontRevision value="0"/>
|
||||
<CIDFontType value="0"/>
|
||||
<CIDCount value="4"/>
|
||||
<!-- charset is dumped separately as the 'GlyphOrder' element -->
|
||||
<FDSelect format="3"/>
|
||||
<FDArray>
|
||||
<FontDict index="0">
|
||||
<FontName value="NotdefWidthCID-Regular-Space"/>
|
||||
<FontMatrix value="0.001 0 0 0.001 0 0"/>
|
||||
<Private>
|
||||
<BlueScale value="0.039625"/>
|
||||
<BlueShift value="7"/>
|
||||
<BlueFuzz value="1"/>
|
||||
<ForceBold value="0"/>
|
||||
<LanguageGroup value="0"/>
|
||||
<ExpansionFactor value="0.06"/>
|
||||
<initialRandomSeed value="0"/>
|
||||
<defaultWidthX value="602"/>
|
||||
<nominalWidthX value="630"/>
|
||||
<Subrs>
|
||||
<!-- The 'index' attribute is only for humans; it is ignored when parsed. -->
|
||||
</Subrs>
|
||||
</Private>
|
||||
</FontDict>
|
||||
<FontDict index="1">
|
||||
<FontName value="NotdefWidthCID-Regular-Notdef"/>
|
||||
<FontMatrix value="0.001 0 0 0.001 0 0"/>
|
||||
<Private>
|
||||
<BlueScale value="0.039625"/>
|
||||
<BlueShift value="7"/>
|
||||
<BlueFuzz value="1"/>
|
||||
<ForceBold value="0"/>
|
||||
<LanguageGroup value="0"/>
|
||||
<ExpansionFactor value="0.06"/>
|
||||
<initialRandomSeed value="0"/>
|
||||
<defaultWidthX value="1000"/>
|
||||
<nominalWidthX value="107"/>
|
||||
<Subrs>
|
||||
<!-- The 'index' attribute is only for humans; it is ignored when parsed. -->
|
||||
</Subrs>
|
||||
</Private>
|
||||
</FontDict>
|
||||
</FDArray>
|
||||
<CharStrings>
|
||||
<CharString name=".notdef" fdSelectIndex="1">
|
||||
endchar
|
||||
</CharString>
|
||||
<CharString name="cid00001" fdSelectIndex="0">
|
||||
-407 endchar
|
||||
</CharString>
|
||||
</CharStrings>
|
||||
</CFFFont>
|
||||
|
||||
<GlobalSubrs>
|
||||
<!-- The 'index' attribute is only for humans; it is ignored when parsed. -->
|
||||
</GlobalSubrs>
|
||||
</CFF>
|
||||
|
||||
</ttFont>
|
@ -265,6 +265,14 @@ class SubsetTest(unittest.TestCase):
|
||||
for tag in subset.Options().hinting_tables:
|
||||
self.assertTrue(tag not in subsetfont)
|
||||
|
||||
def test_notdef_width_cid(self):
|
||||
# https://github.com/fonttools/fonttools/pull/845
|
||||
_, fontpath = self.compile_font(self.getpath("NotdefWidthCID-Regular.ttx"), ".otf")
|
||||
subsetpath = self.temp_path(".otf")
|
||||
subset.main([fontpath, "--no-notdef-outline", "--gids=0,1", "--output-file=%s" % subsetpath])
|
||||
subsetfont = TTFont(subsetpath)
|
||||
self.expect_ttx(subsetfont, self.getpath("expect_notdef_width_cid.ttx"), ["CFF "])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(unittest.main())
|
||||
|
Loading…
x
Reference in New Issue
Block a user