[AAT] Implement subsetting of opbd Optical Bounds table

This commit is contained in:
Sascha Brawer 2017-08-22 20:37:44 +02:00
parent 28b179a018
commit 84b0cacf95
6 changed files with 675 additions and 0 deletions

View File

@ -1694,6 +1694,22 @@ def subset_glyphs(self, s):
self.numVertOriginYMetrics = len(self.VOriginRecords) self.numVertOriginYMetrics = len(self.VOriginRecords)
return True # Never drop; has default metrics return True # Never drop; has default metrics
@_add_method(ttLib.getTableClass('opbd'))
def subset_glyphs(self, s):
table = self.table.OpticalBounds
if table.Format == 0:
table.OpticalBoundsDeltas = {glyph: table.OpticalBoundsDeltas[glyph]
for glyph in s.glyphs
if glyph in table.OpticalBoundsDeltas}
return len(table.OpticalBoundsDeltas) > 0
elif table.Format == 1:
table.OpticalBoundsPoints = {glyph: table.OpticalBoundsPoints[glyph]
for glyph in s.glyphs
if glyph in table.OpticalBoundsPoints}
return len(table.OpticalBoundsPoints) > 0
else:
assert False, "unknown 'opbd' format %s" % table.Format
@_add_method(ttLib.getTableClass('post')) @_add_method(ttLib.getTableClass('post'))
def prune_pre_subset(self, font, options): def prune_pre_subset(self, font, options):
if not options.glyph_names: if not options.glyph_names:

View File

@ -0,0 +1,299 @@
<?xml version="1.0" encoding="UTF-8"?>
<ttFont sfntVersion="\x00\x01\x00\x00" ttLibVersion="3.0">
<GlyphOrder>
<GlyphID id="0" name=".notdef"/>
<GlyphID id="1" name="space"/>
<GlyphID id="2" name="zero"/>
<GlyphID id="3" name="one"/>
<GlyphID id="4" name="two"/>
<GlyphID id="5" name="A"/>
</GlyphOrder>
<head>
<!-- Most of this table will be recalculated by the compiler -->
<tableVersion value="1.0"/>
<fontRevision value="1.0"/>
<checkSumAdjustment value="0xf1c8c54f"/>
<magicNumber value="0x5f0f3cf5"/>
<flags value="00000000 00000011"/>
<unitsPerEm value="1000"/>
<created value="Thu Mar 31 07:56:22 2016"/>
<modified value="Thu Mar 31 11:16:24 2016"/>
<xMin value="40"/>
<yMin value="-10"/>
<xMax value="620"/>
<yMax value="710"/>
<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="40"/>
<xMaxExtent value="620"/>
<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="32"/>
<maxContours value="2"/>
<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="space" width="700" lsb="0"/>
<mtx name="zero" width="625" lsb="40"/>
<mtx name="one" width="660" lsb="80"/>
<mtx name="two" width="660" lsb="80"/>
<mtx name="A" width="660" lsb="80"/>
</hmtx>
<cmap>
<tableVersion version="0"/>
<cmap_format_4 platformID="0" platEncID="3" language="0">
<map code="0x20" name="space"/>
<map code="0x30" name="zero"/>
<map code="0x31" name="one"/>
<map code="0x32" name="two"/>
<map code="0x41" name="A"/>
</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="80" yMin="0" xMax="620" yMax="700">
<contour>
<pt x="620" y="700" on="1"/>
<pt x="620" y="0" on="1"/>
<pt x="80" y="0" on="1"/>
<pt x="80" y="700" on="1"/>
</contour>
<contour>
<pt x="160" y="80" on="1"/>
<pt x="540" y="80" on="1"/>
<pt x="540" y="620" on="1"/>
<pt x="160" y="620" on="1"/>
</contour>
<instructions><assembly>
</assembly></instructions>
</TTGlyph>
<TTGlyph name="one" xMin="80" yMin="230" xMax="580" yMax="490">
<contour>
<pt x="580" y="490" on="1"/>
<pt x="580" y="410" on="1"/>
<pt x="80" y="410" on="1"/>
<pt x="80" y="490" on="1"/>
</contour>
<contour>
<pt x="580" y="310" on="1"/>
<pt x="580" y="230" on="1"/>
<pt x="80" y="230" on="1"/>
<pt x="80" y="310" on="1"/>
</contour>
<instructions><assembly>
</assembly></instructions>
</TTGlyph>
<TTGlyph name="two" xMin="80" yMin="310" xMax="580" yMax="390">
<contour>
<pt x="580" y="390" on="1"/>
<pt x="580" y="310" on="1"/>
<pt x="80" y="310" on="1"/>
<pt x="80" y="390" on="1"/>
</contour>
<instructions><assembly>
</assembly></instructions>
</TTGlyph>
<TTGlyph name="A" xMin="80" yMin="100" xMax="580" yMax="600">
<contour>
<pt x="580" y="310" on="1"/>
<pt x="370" y="310" on="1"/>
<pt x="370" y="100" on="1"/>
<pt x="290" y="100" on="1"/>
<pt x="290" y="310" on="1"/>
<pt x="80" y="310" on="1"/>
<pt x="80" y="390" on="1"/>
<pt x="290" y="390" on="1"/>
<pt x="290" y="600" on="1"/>
<pt x="370" y="600" on="1"/>
<pt x="370" y="390" on="1"/>
<pt x="580" y="390" on="1"/>
</contour>
<instructions><assembly>
</assembly></instructions>
</TTGlyph>
<TTGlyph name="space"/><!-- contains no outline data -->
<TTGlyph name="zero" xMin="40" yMin="-10" xMax="585" yMax="710">
<contour>
<pt x="237" y="-10" on="0"/>
<pt x="113" y="78" on="0"/>
<pt x="40" y="241" on="0"/>
<pt x="40" y="350" on="1"/>
<pt x="40" y="459" on="0"/>
<pt x="113" y="622" on="0"/>
<pt x="237" y="710" on="0"/>
<pt x="313" y="710" on="1"/>
<pt x="388" y="710" on="0"/>
<pt x="513" y="622" on="0"/>
<pt x="585" y="459" on="0"/>
<pt x="585" y="350" on="1"/>
<pt x="585" y="241" on="0"/>
<pt x="513" y="78" on="0"/>
<pt x="388" y="-10" on="0"/>
<pt x="313" y="-10" on="1"/>
</contour>
<contour>
<pt x="366" y="74" on="0"/>
<pt x="454" y="144" on="0"/>
<pt x="505" y="270" on="0"/>
<pt x="505" y="350" on="1"/>
<pt x="505" y="430" on="0"/>
<pt x="454" y="556" on="0"/>
<pt x="366" y="626" on="0"/>
<pt x="313" y="626" on="1"/>
<pt x="260" y="626" on="0"/>
<pt x="171" y="556" on="0"/>
<pt x="120" y="430" on="0"/>
<pt x="120" y="350" on="1"/>
<pt x="120" y="270" on="0"/>
<pt x="171" y="144" on="0"/>
<pt x="260" y="74" on="0"/>
<pt x="313" y="74" on="1"/>
</contour>
<instructions><assembly>
</assembly></instructions>
</TTGlyph>
</glyf>
<name>
<namerecord nameID="1" platformID="1" platEncID="0" langID="0x0" unicode="True">
TestOPBD
</namerecord>
<namerecord nameID="2" platformID="1" platEncID="0" langID="0x0" unicode="True">
Regular
</namerecord>
</name>
<gasp>
<gaspRange rangeMaxPPEM="7" rangeGaspBehavior="10"/>
<gaspRange rangeMaxPPEM="19" rangeGaspBehavior="7"/>
<gaspRange rangeMaxPPEM="65535" rangeGaspBehavior="15"/>
</gasp>
<opbd>
<Version value="0x00010000"/>
<OpticalBounds Format="0">
<OpticalBoundsDeltas>
<Lookup glyph="A">
<Left value="-99"/>
<Top value="0"/>
<Right value="55"/>
<Bottom value="0"/>
</Lookup>
<Lookup glyph="zero">
<Left value="-1"/>
<Top value="2"/>
<Right value="200"/>
<Bottom value="77"/>
</Lookup>
</OpticalBoundsDeltas>
</OpticalBounds>
</opbd>
</ttFont>

View File

@ -0,0 +1,299 @@
<?xml version="1.0" encoding="UTF-8"?>
<ttFont sfntVersion="\x00\x01\x00\x00" ttLibVersion="3.0">
<GlyphOrder>
<GlyphID id="0" name=".notdef"/>
<GlyphID id="1" name="space"/>
<GlyphID id="2" name="zero"/>
<GlyphID id="3" name="one"/>
<GlyphID id="4" name="two"/>
<GlyphID id="5" name="A"/>
</GlyphOrder>
<head>
<!-- Most of this table will be recalculated by the compiler -->
<tableVersion value="1.0"/>
<fontRevision value="1.0"/>
<checkSumAdjustment value="0xf1c8c54f"/>
<magicNumber value="0x5f0f3cf5"/>
<flags value="00000000 00000011"/>
<unitsPerEm value="1000"/>
<created value="Thu Mar 31 07:56:22 2016"/>
<modified value="Thu Mar 31 11:16:24 2016"/>
<xMin value="40"/>
<yMin value="-10"/>
<xMax value="620"/>
<yMax value="710"/>
<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="40"/>
<xMaxExtent value="620"/>
<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="32"/>
<maxContours value="2"/>
<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="space" width="700" lsb="0"/>
<mtx name="zero" width="625" lsb="40"/>
<mtx name="one" width="660" lsb="80"/>
<mtx name="two" width="660" lsb="80"/>
<mtx name="A" width="660" lsb="80"/>
</hmtx>
<cmap>
<tableVersion version="0"/>
<cmap_format_4 platformID="0" platEncID="3" language="0">
<map code="0x20" name="space"/>
<map code="0x30" name="zero"/>
<map code="0x31" name="one"/>
<map code="0x32" name="two"/>
<map code="0x41" name="A"/>
</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="80" yMin="0" xMax="620" yMax="700">
<contour>
<pt x="620" y="700" on="1"/>
<pt x="620" y="0" on="1"/>
<pt x="80" y="0" on="1"/>
<pt x="80" y="700" on="1"/>
</contour>
<contour>
<pt x="160" y="80" on="1"/>
<pt x="540" y="80" on="1"/>
<pt x="540" y="620" on="1"/>
<pt x="160" y="620" on="1"/>
</contour>
<instructions><assembly>
</assembly></instructions>
</TTGlyph>
<TTGlyph name="one" xMin="80" yMin="230" xMax="580" yMax="490">
<contour>
<pt x="580" y="490" on="1"/>
<pt x="580" y="410" on="1"/>
<pt x="80" y="410" on="1"/>
<pt x="80" y="490" on="1"/>
</contour>
<contour>
<pt x="580" y="310" on="1"/>
<pt x="580" y="230" on="1"/>
<pt x="80" y="230" on="1"/>
<pt x="80" y="310" on="1"/>
</contour>
<instructions><assembly>
</assembly></instructions>
</TTGlyph>
<TTGlyph name="two" xMin="80" yMin="310" xMax="580" yMax="390">
<contour>
<pt x="580" y="390" on="1"/>
<pt x="580" y="310" on="1"/>
<pt x="80" y="310" on="1"/>
<pt x="80" y="390" on="1"/>
</contour>
<instructions><assembly>
</assembly></instructions>
</TTGlyph>
<TTGlyph name="A" xMin="80" yMin="100" xMax="580" yMax="600">
<contour>
<pt x="580" y="310" on="1"/>
<pt x="370" y="310" on="1"/>
<pt x="370" y="100" on="1"/>
<pt x="290" y="100" on="1"/>
<pt x="290" y="310" on="1"/>
<pt x="80" y="310" on="1"/>
<pt x="80" y="390" on="1"/>
<pt x="290" y="390" on="1"/>
<pt x="290" y="600" on="1"/>
<pt x="370" y="600" on="1"/>
<pt x="370" y="390" on="1"/>
<pt x="580" y="390" on="1"/>
</contour>
<instructions><assembly>
</assembly></instructions>
</TTGlyph>
<TTGlyph name="space"/><!-- contains no outline data -->
<TTGlyph name="zero" xMin="40" yMin="-10" xMax="585" yMax="710">
<contour>
<pt x="237" y="-10" on="0"/>
<pt x="113" y="78" on="0"/>
<pt x="40" y="241" on="0"/>
<pt x="40" y="350" on="1"/>
<pt x="40" y="459" on="0"/>
<pt x="113" y="622" on="0"/>
<pt x="237" y="710" on="0"/>
<pt x="313" y="710" on="1"/>
<pt x="388" y="710" on="0"/>
<pt x="513" y="622" on="0"/>
<pt x="585" y="459" on="0"/>
<pt x="585" y="350" on="1"/>
<pt x="585" y="241" on="0"/>
<pt x="513" y="78" on="0"/>
<pt x="388" y="-10" on="0"/>
<pt x="313" y="-10" on="1"/>
</contour>
<contour>
<pt x="366" y="74" on="0"/>
<pt x="454" y="144" on="0"/>
<pt x="505" y="270" on="0"/>
<pt x="505" y="350" on="1"/>
<pt x="505" y="430" on="0"/>
<pt x="454" y="556" on="0"/>
<pt x="366" y="626" on="0"/>
<pt x="313" y="626" on="1"/>
<pt x="260" y="626" on="0"/>
<pt x="171" y="556" on="0"/>
<pt x="120" y="430" on="0"/>
<pt x="120" y="350" on="1"/>
<pt x="120" y="270" on="0"/>
<pt x="171" y="144" on="0"/>
<pt x="260" y="74" on="0"/>
<pt x="313" y="74" on="1"/>
</contour>
<instructions><assembly>
</assembly></instructions>
</TTGlyph>
</glyf>
<name>
<namerecord nameID="1" platformID="1" platEncID="0" langID="0x0" unicode="True">
TestOPBD
</namerecord>
<namerecord nameID="2" platformID="1" platEncID="0" langID="0x0" unicode="True">
Regular
</namerecord>
</name>
<gasp>
<gaspRange rangeMaxPPEM="7" rangeGaspBehavior="10"/>
<gaspRange rangeMaxPPEM="19" rangeGaspBehavior="7"/>
<gaspRange rangeMaxPPEM="65535" rangeGaspBehavior="15"/>
</gasp>
<opbd>
<Version value="0x00010000"/>
<OpticalBounds Format="1">
<OpticalBoundsPoints>
<Lookup glyph="A">
<Left value="3"/>
<Top value="4"/>
<Right value="5"/>
<Bottom value="6"/>
</Lookup>
<Lookup glyph="zero">
<Left value="9"/>
<Top value="8"/>
<Right value="7"/>
<Bottom value="6"/>
</Lookup>
</OpticalBoundsPoints>
</OpticalBounds>
</opbd>
</ttFont>

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<ttFont>
<opbd>
<Version value="0x00010000"/>
<OpticalBounds Format="0">
<OpticalBoundsDeltas>
<Lookup glyph="A">
<Left value="-99"/>
<Top value="0"/>
<Right value="55"/>
<Bottom value="0"/>
</Lookup>
</OpticalBoundsDeltas>
</OpticalBounds>
</opbd>
</ttFont>

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<ttFont>
<opbd>
<Version value="0x00010000"/>
<OpticalBounds Format="1">
<OpticalBoundsPoints>
<Lookup glyph="A">
<Left value="3"/>
<Top value="4"/>
<Right value="5"/>
<Bottom value="6"/>
</Lookup>
</OpticalBoundsPoints>
</OpticalBounds>
</opbd>
</ttFont>

View File

@ -123,6 +123,31 @@ class SubsetTest(unittest.TestCase):
subsetfont = TTFont(subsetpath) subsetfont = TTFont(subsetpath)
self.expect_ttx(subsetfont, self.getpath("expect_keep_math.ttx"), ["GlyphOrder", "CFF ", "MATH", "hmtx"]) self.expect_ttx(subsetfont, self.getpath("expect_keep_math.ttx"), ["GlyphOrder", "CFF ", "MATH", "hmtx"])
def test_subset_opbd_remove(self):
# In the test font, only the glyphs 'A' and 'zero' have an entry in
# the Optical Bounds table. When subsetting, we do not request any
# of those glyphs. Therefore, the produced subsetted font should
# not contain an 'opbd' table.
_, fontpath = self.compile_font(self.getpath("TestOPBD-0.ttx"), ".ttf")
subsetpath = self.temp_path(".ttf")
subset.main([fontpath, "--glyphs=one", "--output-file=%s" % subsetpath])
subsetfont = TTFont(subsetpath)
self.assertNotIn("opbd", subsetfont)
def test_subset_opbd_format_0(self):
_, fontpath = self.compile_font(self.getpath("TestOPBD-0.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("expect_opbd_0.ttx"), ["opbd"])
def test_subset_opbd_format_1(self):
_, fontpath = self.compile_font(self.getpath("TestOPBD-1.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("expect_opbd_1.ttx"), ["opbd"])
def test_subset_prop_remove_default_zero(self): def test_subset_prop_remove_default_zero(self):
# If all glyphs have an AAT glyph property with value 0, # If all glyphs have an AAT glyph property with value 0,
# the "prop" table should be removed from the subsetted font. # the "prop" table should be removed from the subsetted font.