This does two things:
1. Intersect subsetter glyphset with the table's Coverage before
passing to ClassDef1 for subsetting. Anything that doesn't
get past Coverage wouldn't ever get to ClassDef1,
2. Never reuse class0 of ClassDef2. There's unspoken assumption
that ClassDef2's class0 is never used for actual kerning, since
that's the unbounded "every other glyph" class. Previously our
ClassDef subsetter was reusing class0 if "every other glyph"
happened to become empty because of the subset glyphset. Don't
do that for PairPos's ClassDef2. As a result of this assumption,
don't keep a PairPosClass2 subtable if only ClassDef2's class0
survived subsetting.
Would be good to add tests for both.
Related to https://github.com/harfbuzz/harfbuzz/issues/2703
* Replaced all from ...py23 import * with explicit name imports, or removed completely when possible.
* Replaced tounicode() with tostr()
* Changed all BytesIO ans StringIO imports to from io import ..., replaced all UnicodeIO with StringIO.
* Replaced all unichr() with chr()
* Misc minor tweaks and fixes
In COLR.closure_glyphs augment the subset with the glyphs rechable from the COLRv1 base glyphs already in the subset.
In COLR.subset_glyphs, subset and rebuild LayerV1List and BaseGlyphV1List with the base glyphs to keep. Drop COLR if emptied
Allow specifying which LangSys tags to accept for each script, using
script.lang form. For example:
--layout-scripts=arab.dflt,arab.URD,latn
To keep DefaultLangSys and “URD” language for “arab” script, and all
languages for “latn” script.
While False does get the job done, the value is not always treated as
a boolean. It is overloaded so that 1 or greater is True, but more than
1 has a different meaning than 1. Hence usage should always be as an
integer as documented so that it's clear(er) this isn't just an on/off
toggle.
This import is causing an unsightly DeprecationWarning.
I checked manually: the only names being used from py23 are
open, range and zip, which are defined to be the same as the
corresponding Python 3 builtins, so this should cause no
visible change except for suppressing the warning.
This adds a `help` verb (and `--help` option) to the `fonttools` command line tool. Submodules will be listed in the help text if they have an importable `main` function with a docstring, and `main`'s docstring will be used as the one-line description for the help text.
Fixes https://github.com/fonttools/fonttools/issues/1879
In ChainContext{Subst,Pos}Format3, the array of input coverages is called
InputCoverage, whereas in non-Chain Context{Subst,Pos}Format3 subtables it
is called simply Coverage.
After subsetting some strikes might be empty (strikes don’t have to
cover all glyphs equally) which would cause a key error later when
saving the table.
Fixes https://github.com/fonttools/fonttools/issues/1633
When --recalc-bounds option is used the font extents in the head table
need to be updated, but since tables are lazy-loaded by default the
table will not be recompiled and will keep the old value. Force
recompiling the table by adding it to prune_post_subset tables, though
I’m not 100% sure this is the best approach.
deltas in VarData[0] are directly look up by GID so compacted
if any deltas are referenced by LsbMap / RsbMap but not used for advance widths, they are moved to the end of VarData[0]
updated expected test result expect_HVVAR.ttx accordingly
1. if AdvWidthMap/AdvHeightMap missing, deltas for unused (emptied) glyphs are zeroed
2. If indexMap exists and unused glyph ID <= last used glyph ID, then its major/minor number set to 0/0
3. If indexMap exists and unused glyph ID > last used glyph ID, then its major/minor number set to that of the last used glyph (removed from table)
* [subset CFF] Fix bug in de-subroutinizing when subroutines contain hints, issue 1493
The code was skipping executing a subroutine if it had already been desubroutinized. The initial set of vstemhm and hstemhm operators and values may be in a subroutine. If a charstring is being executed which calls such subroutines, they still need to be executed in order to count the number of hint values seen, so that the byte length of the hintmask can be calculated.
I fixed this bug by executing subroutines even if they have already been desubroutinized, as long as (we don't know yet if we are doing hintmasks) or ( we do need a hintmask, but have not yet seen it).
Clean up code per Cosimo's suggestions:
In arg list for stop_hint_count(), use *args to accept unused argument, rather than a dummy positional argument.
Change stop_hintcount_ops to a from a global variable to a class variable in _DesubroutinizingT2Decompiler.
Remove un-needed 'return' at line 387
Remove duplicate assignment of cs at line 437
Add patch for the bug where AttributeError is encountered when remove_hints is run after desubroutinize: remove lines deleting the GlobalSubrs for each FontDict. This always needed to be done only once, and is now in any case done in cff.GlobalSubrs.clear(), at the end of the desubroutinize() function.
Changed test case subset_test.py::'test_no_hinting_desubroutinize_CFF' to reference a font with a non-empty GlobalSubr, in order to trigger AttributeError traceback.