Merge pull request #1674 from fonttools/subset-sbix
[subset] Support sbix table
This commit is contained in:
commit
97b61b6b1f
@ -208,8 +208,7 @@ Font table options:
|
|||||||
set of tables that will be be dropped.
|
set of tables that will be be dropped.
|
||||||
By default, the following tables are dropped:
|
By default, the following tables are dropped:
|
||||||
'BASE', 'JSTF', 'DSIG', 'EBDT', 'EBLC', 'EBSC', 'SVG ', 'PCLT', 'LTSH'
|
'BASE', 'JSTF', 'DSIG', 'EBDT', 'EBLC', 'EBSC', 'SVG ', 'PCLT', 'LTSH'
|
||||||
and Graphite tables: 'Feat', 'Glat', 'Gloc', 'Silf', 'Sill'
|
and Graphite tables: 'Feat', 'Glat', 'Gloc', 'Silf', 'Sill'.
|
||||||
and color tables: 'sbix'.
|
|
||||||
The tool will attempt to subset the remaining tables.
|
The tool will attempt to subset the remaining tables.
|
||||||
Examples:
|
Examples:
|
||||||
--drop-tables-='SVG '
|
--drop-tables-='SVG '
|
||||||
@ -1392,6 +1391,13 @@ def subset_glyphs(self, s):
|
|||||||
for strike in self.strikeData]
|
for strike in self.strikeData]
|
||||||
return True
|
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'))
|
@_add_method(ttLib.getTableClass('GSUB'))
|
||||||
def closure_glyphs(self, s):
|
def closure_glyphs(self, s):
|
||||||
s.table = self.table
|
s.table = self.table
|
||||||
@ -2273,7 +2279,6 @@ class Options(object):
|
|||||||
_drop_tables_default = ['BASE', 'JSTF', 'DSIG', 'EBDT', 'EBLC',
|
_drop_tables_default = ['BASE', 'JSTF', 'DSIG', 'EBDT', 'EBLC',
|
||||||
'EBSC', 'SVG', 'PCLT', 'LTSH']
|
'EBSC', 'SVG', 'PCLT', 'LTSH']
|
||||||
_drop_tables_default += ['Feat', 'Glat', 'Gloc', 'Silf', 'Sill'] # Graphite
|
_drop_tables_default += ['Feat', 'Glat', 'Gloc', 'Silf', 'Sill'] # Graphite
|
||||||
_drop_tables_default += ['sbix'] # Color
|
|
||||||
_no_subset_tables_default = ['avar', 'fvar',
|
_no_subset_tables_default = ['avar', 'fvar',
|
||||||
'gasp', 'head', 'hhea', 'maxp',
|
'gasp', 'head', 'hhea', 'maxp',
|
||||||
'vhea', 'OS/2', 'loca', 'name', 'cvt',
|
'vhea', 'OS/2', 'loca', 'name', 'cvt',
|
||||||
|
7709
Tests/subset/data/expect_sbix.ttx
Normal file
7709
Tests/subset/data/expect_sbix.ttx
Normal file
File diff suppressed because it is too large
Load Diff
12532
Tests/subset/data/sbix.ttx
Normal file
12532
Tests/subset/data/sbix.ttx
Normal file
File diff suppressed because it is too large
Load Diff
@ -331,6 +331,14 @@ class SubsetTest(unittest.TestCase):
|
|||||||
self.assertTrue("x" in subsetfont['CBDT'].strikeData[0])
|
self.assertTrue("x" in subsetfont['CBDT'].strikeData[0])
|
||||||
self.assertTrue("y" 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):
|
def test_timing_publishes_parts(self):
|
||||||
_, fontpath = self.compile_font(self.getpath("TestTTF-Regular.ttx"), ".ttf")
|
_, fontpath = self.compile_font(self.getpath("TestTTF-Regular.ttx"), ".ttf")
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user