If nTracks == 0, nSizes is also == 0, the `else` part is sufficient.
There's a limit case when nTracks can be > 0, and nSizes == 0, but it's
unlikely or useless.
The current argument parser in subset.py must strip out spaces in values,
in order to allow specifying comma- or whitespace-separated lists (for
example, cf. [line 2289](https://github.com/behdad/fonttools/blob/master/Lib/fontTools/subset.py#L2289))
Because of that, users cannot correctly specify table tags whose length
is less than 4 by enclosing the space in quotes.
For example, 'SVG ' table will be alwyas dropped even if I pass
`--drop-tables-='SVG '` and `--no-subset-tables+='SVG '`.
As a workaround, this patch removes the spaces from the 'SVG ' and 'cvt '
tags in the constant lists of the Option class, and it only tests that
`tag.strip()` is contained in those list.
Of course, this also means `--drop-tables-='SVG '` is now the same as
`--drop-tables-='SVG' as far as the subsetter is concerned.
Fixes https://github.com/behdad/fonttools/issues/376
Related https://github.com/behdad/fonttools/issues/265
This should make the unit tests more readable, and it also prevents
failures where a changed fromXML() implementation fails to ignore
interspersed whitespace. This has recently caused some developer
nuisance; see https://github.com/behdad/fonttools/pull/367.
Instead of having a custom parser implementation, it would be nicer
to call the actual XMLReader. However, XMLReader has a deeply built-in
assumption that it is processing an entire TTX file. Changing this
assumption would certainly be possible, but it would need a re-write
of the XMLReader code; having a custom parser just for unit tests
seems less involved.
Resolves https://github.com/behdad/fonttools/issues/355
For making sure that `pyftsubset` still works after this change,
I have done the following steps:
* invoked Adobe's `makeotf` tool to build a custom font with a
MultipleSubst lookup. This lookup decomposes two two ligatures,
`c_t` and `f_f_i`, into their respective components.
* invoked the `pyftsubset` tool to produce a subset font with just
the `c_t` ligature;
* checked with `ttx` that the newly produced subset font contains
the requested `c_t` ligature and its components `c` and `t`,
but does not contain not any of `f_f_i`, `f`, or `i`.
Before this change, TTX (when running in Python 2.7) would fail
to compile a font if the input contained an `ltag` section.
With Python 3, it worked perfectly fine even before this change.
Resolves https://github.com/behdad/fonttools/issues/357
The list of subtables should go in the 'SubTable' attribute of Lookup object.
This also sets the 'LookupType', 'LookupFlag' and 'SubTableCount' attributes.