Merge pull request #1674 from fonttools/subset-sbix

[subset] Support sbix table
This commit is contained in:
Khaled Hosny 2019-08-01 10:29:18 +02:00 committed by GitHub
commit 97b61b6b1f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 20257 additions and 3 deletions

View File

@ -208,8 +208,7 @@ Font table options:
set of tables that will be be dropped.
By default, the following tables are dropped:
'BASE', 'JSTF', 'DSIG', 'EBDT', 'EBLC', 'EBSC', 'SVG ', 'PCLT', 'LTSH'
and Graphite tables: 'Feat', 'Glat', 'Gloc', 'Silf', 'Sill'
and color tables: 'sbix'.
and Graphite tables: 'Feat', 'Glat', 'Gloc', 'Silf', 'Sill'.
The tool will attempt to subset the remaining tables.
Examples:
--drop-tables-='SVG '
@ -1392,6 +1391,13 @@ def subset_glyphs(self, s):
for strike in self.strikeData]
return True
@_add_method(ttLib.getTableClass('sbix'))
def subset_glyphs(self, s):
for strike in self.strikes.values():
strike.glyphs = {g: strike.glyphs[g] for g in s.glyphs if g in strike.glyphs}
return True
@_add_method(ttLib.getTableClass('GSUB'))
def closure_glyphs(self, s):
s.table = self.table
@ -2273,7 +2279,6 @@ class Options(object):
_drop_tables_default = ['BASE', 'JSTF', 'DSIG', 'EBDT', 'EBLC',
'EBSC', 'SVG', 'PCLT', 'LTSH']
_drop_tables_default += ['Feat', 'Glat', 'Gloc', 'Silf', 'Sill'] # Graphite
_drop_tables_default += ['sbix'] # Color
_no_subset_tables_default = ['avar', 'fvar',
'gasp', 'head', 'hhea', 'maxp',
'vhea', 'OS/2', 'loca', 'name', 'cvt',

File diff suppressed because it is too large Load Diff

12532
Tests/subset/data/sbix.ttx Normal file

File diff suppressed because it is too large Load Diff

View File

@ -331,6 +331,14 @@ class SubsetTest(unittest.TestCase):
self.assertTrue("x" in subsetfont['CBDT'].strikeData[0])
self.assertTrue("y" in subsetfont['CBDT'].strikeData[0])
def test_sbix(self):
_, fontpath = self.compile_font(self.getpath("sbix.ttx"), ".ttf")
subsetpath = self.temp_path(".ttf")
subset.main([fontpath, "--gids=0,1", "--output-file=%s" % subsetpath])
subsetfont = TTFont(subsetpath)
self.expect_ttx(subsetfont, self.getpath(
"expect_sbix.ttx"), ["sbix"])
def test_timing_publishes_parts(self):
_, fontpath = self.compile_font(self.getpath("TestTTF-Regular.ttx"), ".ttf")