[subset] Support sbix table
Test font is a subset of: https://github.com/djrrb/Bungee/blob/master/fonts/Bungee_Color_Fonts/BungeeColor-Regular_sbix_MacOS.ttf
This commit is contained in:
parent
f3c99cfef2
commit
4db8cb237f
@ -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',
|
||||
|
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("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")
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user