diff --git a/Lib/fontTools/feaLib/builder_test.py b/Lib/fontTools/feaLib/builder_test.py
index 7352978e7..d7df4c0b4 100644
--- a/Lib/fontTools/feaLib/builder_test.py
+++ b/Lib/fontTools/feaLib/builder_test.py
@@ -110,7 +110,7 @@ class BuilderTest(unittest.TestCase):
expected = self.read_ttx(expected_ttx)
if actual != expected:
for line in difflib.unified_diff(
- expected, actual, fromfile=expected_ttx, tofile=path):
+ expected, actual, fromfile=path, tofile=expected_ttx):
sys.stdout.write(line)
self.fail("TTX output is different from expected")
diff --git a/Lib/fontTools/subset/__init__.py b/Lib/fontTools/subset/__init__.py
index 0f1340afd..bbdb4bd5e 100644
--- a/Lib/fontTools/subset/__init__.py
+++ b/Lib/fontTools/subset/__init__.py
@@ -7,7 +7,7 @@ from fontTools.misc.py23 import *
from fontTools import ttLib
from fontTools.ttLib.tables import otTables
from fontTools.misc import psCharStrings
-from fontTools.pens.basePen import NullPen
+from fontTools.pens.boundsPen import BoundsPen
from fontTools.misc.loggingTools import Timer
import sys
import struct
@@ -1847,8 +1847,8 @@ def prune_pre_subset(self, font, options):
private = font.Private
dfltWdX = private.defaultWidthX
nmnlWdX = private.nominalWidthX
- pen = NullPen()
- c.draw(pen) # this will set the charstring's width
+ pen = BoundsPen(None)
+ c.draw(pen) # this will set the charstring's width
if c.width != dfltWdX:
c.program = [c.width - nmnlWdX, 'endchar']
else:
@@ -2207,9 +2207,7 @@ def prune_post_subset(self, options):
subrs = getattr(c.private, "Subrs", [])
decompiler = _DehintingT2Decompiler(css, subrs, c.globalSubrs)
decompiler.execute(c)
- pen = NullPen()
for charstring in css:
- charstring.draw(pen) # this will set the charstring's width
charstring.drop_hints()
del css
diff --git a/Lib/fontTools/subset/subset_test.py b/Lib/fontTools/subset/subset_test.py
index 73c4b8782..253254d38 100644
--- a/Lib/fontTools/subset/subset_test.py
+++ b/Lib/fontTools/subset/subset_test.py
@@ -59,7 +59,7 @@ class SubsetTest(unittest.TestCase):
expected = self.read_ttx(expected_ttx)
if actual != expected:
for line in difflib.unified_diff(
- expected, actual, fromfile=expected_ttx, tofile=path):
+ expected, actual, fromfile=path, tofile=expected_ttx):
sys.stdout.write(line)
self.fail("TTX output is different from expected")
@@ -152,6 +152,7 @@ class SubsetTest(unittest.TestCase):
def test_timing_publishes_parts(self):
_, fontpath = self.compile_font(self.getpath("TestTTF-Regular.ttx"), ".ttf")
+ subsetpath = self.temp_path(".ttf")
options = subset.Options()
options.timing = True
@@ -194,44 +195,6 @@ class SubsetTest(unittest.TestCase):
# unknown tables are kept if --passthrough-tables option is passed
self.assertTrue(unknown_tag in subsetfont)
- def test_drop_hints_CFF(self):
- _, fontpath = self.compile_font(self.getpath("TestOTF-Regular.ttx"), ".otf")
- subsetpath = self.temp_path(".otf")
- subset.main([fontpath, "--no-hinting", "--notdef-outline",
- "--output-file=%s" % subsetpath, "*"])
- subsetfont = TTFont(subsetpath)
- self.expect_ttx(subsetfont, self.getpath(
- "expect_drop_hints_CFF.ttx"), ["CFF "])
-
- def test_desubroutinize_CFF(self):
- _, fontpath = self.compile_font(self.getpath("TestOTF-Regular.ttx"), ".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(
- "expect_desubroutinize_CFF.ttx"), ["CFF "])
-
- def test_drop_hints_desubroutinize_CFF(self):
- _, fontpath = self.compile_font(self.getpath("TestOTF-Regular.ttx"), ".otf")
- subsetpath = self.temp_path(".otf")
- subset.main([fontpath, "--no-hinting", "--desubroutinize", "--notdef-outline",
- "--output-file=%s" % subsetpath, "*"])
- subsetfont = TTFont(subsetpath)
- self.expect_ttx(subsetfont, self.getpath(
- "expect_drop_hints_desubroutinize_CFF.ttx"), ["CFF "])
-
- def test_drop_hints_TTF(self):
- _, fontpath = self.compile_font(self.getpath("TestTTF-Regular.ttx"), ".ttf")
- subsetpath = self.temp_path(".ttf")
- subset.main([fontpath, "--no-hinting", "--notdef-outline",
- "--output-file=%s" % subsetpath, "*"])
- subsetfont = TTFont(subsetpath)
- self.expect_ttx(subsetfont, self.getpath(
- "expect_drop_hints_TTF.ttx"), ["glyf", "maxp"])
- for tag in subset.Options().hinting_tables:
- self.assertTrue(tag not in subsetfont)
-
if __name__ == "__main__":
unittest.main()
diff --git a/Lib/fontTools/subset/testdata/expect_desubroutinize_CFF.ttx b/Lib/fontTools/subset/testdata/expect_desubroutinize_CFF.ttx
deleted file mode 100644
index 44ec5f094..000000000
--- a/Lib/fontTools/subset/testdata/expect_desubroutinize_CFF.ttx
+++ /dev/null
@@ -1,81 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 196 10 hmoveto
- 476 660 -476 hlineto
- 108 -602 rmoveto
- 74 132 54 103 rlineto
- 4 hlineto
- 52 -103 73 -132 rlineto
- -129 329 rmoveto
- -50 94 -66 119 rlineto
- 235 hlineto
- -66 -119 -49 -94 rlineto
- -175 -277 rmoveto
- 462 vlineto
- 127 -232 rlineto
- 217 -230 rmoveto
- -126 230 126 232 rlineto
- endchar
-
-
- 132 304 rmoveto
- 233 263 -233 hlineto
- endchar
-
-
- 100 304 263 hstem
- 132 233 vstem
- 132 304 rmoveto
- 233 263 -233 hlineto
- endchar
-
-
- endchar
-
-
-
-
-
-
-
-
-
-
diff --git a/Lib/fontTools/subset/testdata/expect_drop_hints_CFF.ttx b/Lib/fontTools/subset/testdata/expect_drop_hints_CFF.ttx
deleted file mode 100644
index 1ca35e315..000000000
--- a/Lib/fontTools/subset/testdata/expect_drop_hints_CFF.ttx
+++ /dev/null
@@ -1,75 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 132 304 rmoveto
- 233 263 -233 hlineto
- endchar
-
-
-
-
-
- 196 10 hmoveto
- 476 660 -476 hlineto
- 108 -602 rmoveto
- 74 132 54 103 rlineto
- 4 hlineto
- 52 -103 73 -132 rlineto
- -129 329 rmoveto
- -50 94 -66 119 rlineto
- 235 hlineto
- -66 -119 -49 -94 rlineto
- -175 -277 rmoveto
- 462 vlineto
- 127 -232 rlineto
- 217 -230 rmoveto
- -126 230 126 232 rlineto
- endchar
-
-
- -107 callsubr
-
-
- 100 -107 callsubr
-
-
- endchar
-
-
-
-
-
-
-
-
-
-
diff --git a/Lib/fontTools/subset/testdata/expect_drop_hints_TTF.ttx b/Lib/fontTools/subset/testdata/expect_drop_hints_TTF.ttx
deleted file mode 100644
index 35696c5b2..000000000
--- a/Lib/fontTools/subset/testdata/expect_drop_hints_TTF.ttx
+++ /dev/null
@@ -1,91 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/Lib/fontTools/subset/testdata/expect_drop_hints_desubroutinize_CFF.ttx b/Lib/fontTools/subset/testdata/expect_drop_hints_desubroutinize_CFF.ttx
deleted file mode 100644
index 3f559a453..000000000
--- a/Lib/fontTools/subset/testdata/expect_drop_hints_desubroutinize_CFF.ttx
+++ /dev/null
@@ -1,74 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 196 10 hmoveto
- 476 660 -476 hlineto
- 108 -602 rmoveto
- 74 132 54 103 rlineto
- 4 hlineto
- 52 -103 73 -132 rlineto
- -129 329 rmoveto
- -50 94 -66 119 rlineto
- 235 hlineto
- -66 -119 -49 -94 rlineto
- -175 -277 rmoveto
- 462 vlineto
- 127 -232 rlineto
- 217 -230 rmoveto
- -126 230 126 232 rlineto
- endchar
-
-
- 132 304 rmoveto
- 233 263 -233 hlineto
- endchar
-
-
- 100 132 304 rmoveto
- 233 263 -233 hlineto
- endchar
-
-
- endchar
-
-
-
-
-
-
-
-
-
-