From bd47bdae97be1fbb4fb340971b2f50ccb9eb0f39 Mon Sep 17 00:00:00 2001 From: Cosimo Lupo Date: Thu, 21 Oct 2021 14:39:43 +0200 Subject: [PATCH] subset: don't drop SVG table, add WIP subset/svg.py stub simply pass-through for now --- Lib/fontTools/subset/__init__.py | 9 +++++---- Lib/fontTools/subset/svg.py | 7 +++++++ 2 files changed, 12 insertions(+), 4 deletions(-) create mode 100644 Lib/fontTools/subset/svg.py diff --git a/Lib/fontTools/subset/__init__.py b/Lib/fontTools/subset/__init__.py index b98e9ee22..798508f42 100644 --- a/Lib/fontTools/subset/__init__.py +++ b/Lib/fontTools/subset/__init__.py @@ -10,6 +10,7 @@ from fontTools.pens.basePen import NullPen from fontTools.misc.loggingTools import Timer from fontTools.subset.util import _add_method, _uniq_sort from fontTools.subset.cff import * +from fontTools.subset.svg import * import sys import struct import array @@ -207,12 +208,12 @@ Font table options: Specify (=), add to (+=) or exclude from (-=) the comma-separated set of tables that will be be dropped. By default, the following tables are dropped: - 'BASE', 'JSTF', 'DSIG', 'EBDT', 'EBLC', 'EBSC', 'SVG ', 'PCLT', 'LTSH' + 'BASE', 'JSTF', 'DSIG', 'EBDT', 'EBLC', 'EBSC', 'PCLT', 'LTSH' and Graphite tables: 'Feat', 'Glat', 'Gloc', 'Silf', 'Sill'. The tool will attempt to subset the remaining tables. Examples: - --drop-tables-='SVG ' - * Drop the default set of tables but keep 'SVG '. + --drop-tables-='BASE' + * Drop the default set of tables but keep 'BASE'. --drop-tables+=GSUB * Drop the default set of tables and 'GSUB'. --drop-tables=DSIG @@ -2486,7 +2487,7 @@ class Options(object): # spaces in tag names (e.g. "SVG ", "cvt ") are stripped by the argument parser _drop_tables_default = ['BASE', 'JSTF', 'DSIG', 'EBDT', 'EBLC', - 'EBSC', 'SVG', 'PCLT', 'LTSH'] + 'EBSC', 'PCLT', 'LTSH'] _drop_tables_default += ['Feat', 'Glat', 'Gloc', 'Silf', 'Sill'] # Graphite _no_subset_tables_default = ['avar', 'fvar', 'gasp', 'head', 'hhea', 'maxp', diff --git a/Lib/fontTools/subset/svg.py b/Lib/fontTools/subset/svg.py new file mode 100644 index 000000000..c1fa00bc2 --- /dev/null +++ b/Lib/fontTools/subset/svg.py @@ -0,0 +1,7 @@ +from fontTools.subset.util import _add_method +from fontTools import ttLib + + +@_add_method(ttLib.getTableClass("SVG ")) +def subset_glyphs(self, s): + return True # XXX