We assert that the composite glyph's sidebearings and bbox are updated when its parent glyph
has changed.
The tests will fail, but a fix will follow shortly.
continue checking subsequent condition tables in case the other may
be format=1 and may reference a pinned axis; in which case, these
conditions need to be dropped from the condition set, or the whole
record needs to be dropped if the instance coordinate is outside the
condition range.
Condition tables within a condition set are associated with a AND
boolean operator, so if any one doesn't match, the whole set doesn't
apply. Even if we don't recognize one condition format, if we do
ascertain that another condition table does not match the current
partial instance location, we can drop the FeatureVariation record
since it doesn't apply.
instead of reading off existing FeatureVars.ttx test file.
This gives us more flexibility to add more tests, and keeps the input
values closer to the expected results
there was a logic issue in the function that checks whether a FeatureVariationRecord
has a unique set of condition (was returning False instead of True for unsupported condition).
It's safer to always keep such records with unknown condition formats as new formats
may be added in the future. A warning is already issued in these cases.
Added new test VF font (a subset of NotoSans-VF only containing glyphs 'A', 'Agrave' and 'T');
the VF was instanced with varLib.mutator, producing a series of full instances, which are
included as ttx files as well.
The tests run the partial instancer twice, once only instancing wght, then again for wdth,
and assert that the generated instance is identical to those.
The code was setting GlyphClassDef.classDefs for the base font to an
empty dict then reading it from all fonts. It accidentally works when
creating variable fonts because the GlyphClassDef of the other fonts
will be used, but when mutating there is only one font.
Fix by reading the glyph classes before assigning to an empty dict.
Do not round them to integer, but let the caller do the rounding immediately before adding them to the default instance (or just before compiling the binary table as with glyf).
This ensures that the glyphs' left sidebearings are calculated in the same way as they were by varLib.mutator.
If we round deltas too early, then we may get off-by-one differences.
See the glyf table setCoordinates method where left sidebearings are computed.
added a dummy STAT table to PartialInstancer-VF.ttx font that has all 4 AxisValue formats.
It doesn't have contain AxisValue for each fvar NamedInstance like the spec recommends, but it's ok for the sake of this test
This required a fix to fontTools/cffLib. When reading a CFF2 variable font (VF) from XML, the VF state in FontDict and PrivateDict does not get set. I made a temporary fix by adding a loop to set PrivateDict.vstore for all the PrivateDict objects after the XML file has been read. This should not be necessary, and in the near future I will revisit both this issue, and the related use of isCFF2 when compiling/decompiling.
* Added getter (in the form of a property decorator) for T2Charstring.vsindex. Fixes endless compile loop in some circumstances.
Fixed bug in mutator: need to remove vsindex from snapshotted charstrings, plus formatting clean up
* Fix for subsetting HVAR tables that have an AdvanceWidthMap when the --retain-gid option is used. Needed to make subset_test.py::test_retain_gids_cff2 tests pass.
* in varLib/cffLib.py, add support for sparse sources, and sources with more than one model, and hence more than one VarData element in the VarStore.
CFF2 source fonts with multiple FontDicts in the FDArray need some extra work. With sparse fonts, some of the source fonts may have a fewer FontDicts than the default font. The getfd_map function() builds a map from the FontDict indices in the default font to those in each region font. This is needed when building up the blend value lists in the master font FontDict PrivateDicts, in order to fetch PrivateDict values from the correct FontDict in each region font.
In specializer.py, add support for CFF2 CharStrings with blend operators. 1) In generalizeCommands, convert a blend op to a list of args that are blend lists for the following regular operator. A blend list as a default font value, followed by the delta tuple. 2) In specializeCommands(), convert these back to blend ops, combining as many successive blend lists as allowed by the stack limit.
Add test case for sparse CFF2 sources.
The test font has 55 glyphs. 2 glyphs use only 2 sources (weight = 0 and 100). The rest use 4 source fonts: the two end points of the weight axis, and two intermediate masters. The intermediate masters are only 1 design space unit apart, and are used to change glyph design at the point in design space. For the rest, at most 2 glyphs use the same set of source fonts. There are 12 source fonts.
Add test case for specializer programToCommands() and commandsToProgram by converting each CharString.program in the font to a command list, and back again, and comparing original and final versions.
If we modify the default instance coordinates, then the inferred deltas that
are left in gvar are no longer valid, so we need to calculate them using the
original default coordinates.
They are then re-optimized using the modified default coordinates.
Also, the default deltas returned from instantiateTupleVariationStore are now
already rounded to integer.
The instantiateTupleVariationStore function now groups TupleVariation
tables that have the same axes 'tents', then merges them into a single
TupleVariation by summing their deltas. The rounding to integer happens
after summing the scaled deltas as floats, to reduce off-by-one errors.
To be able to sum gvar TupleVariation, it needs to calculate the inferred
deltas so it now takes two optional lists (origCoords and endPts) that
are passed on to iup_delta function. These only make sense for gvar
type of TupleVariation, of course, and are unused for cvar tuples.
It also run iup_delta_optimize on the gvar deltas that are left after
partial instancing and whose inferred deltas had to be interpolated.
This can be disabled with --no-optimize CLI option.
Also added calcInferredDeltas and optimize methods to TupleVariation
class, which use functions from varLib.iup module, plus tests
that exercise them.