4920 Commits

Author SHA1 Message Date
Cosimo Lupo
18efee2c7b
TupleVariation: rename get{DeltaType,CoordWidth}; do not special-case scalar=0
we still need to branch between the case where coordinates are wrapped in (x, y) tuples or naked floats.
2019-06-14 11:03:38 +01:00
Nikolaus Waxweiler
f48051af23 Fix corrupt class-based pair kerning table merging 2019-06-14 10:05:48 +01:00
Cosimo Lupo
deaeb909a7
woff2: add support for hmtx transformation
no tests yet

fixup
2019-06-13 18:07:14 +01:00
ReadRoberts
cc3c928053 [varLib.cff] Fix important bug in merging FF2 PrivateDicts.
There was a bug that caused the PrivateDict of the first region to be used for all others.
2019-06-12 17:11:01 -07:00
ReadRoberts
ec54541e30 [varLib.cff] Fix merging bug when there are no blends or marking glyphs.
If the CFF2 VF has no blends, or no marking glyphs, the default variation table does not get built; this can be needed later for the PrivateDict.
2019-06-12 16:31:29 -07:00
ReadRoberts
b44c761526 [oltLib.builder] Fix bug in building a variation font.
The logic for building a Device subtable didn't know about the VariationIndex flavor of a ValueRecord Device subtable.
2019-06-12 14:31:38 -07:00
ReadRoberts
b756bcac18 [varLib.merger] Fix merging GPOS SinglePos subtables
When a SinglePost lookup is compiled, pretty much all compilers do some compression by combining similar ValueRecords into a single subtable. This compression produces different lengths of the list of subtables between source fonts. The original code required that all SinglePos lookups have the same subtables, often doesn't work.

I fixed this in varLib.merger.py by first flattening a SinglePos lookup to a single subtable, using the same record format for all records, and then merging the source fonts. After the merge is complete, I call fontTools.otlLib.builder.buildSinglePos() to rebuild the lookup subtables.
2019-06-12 14:30:30 -07:00
Cosimo Lupo
0162446f4c
woff2: don't normalize glyf+loca if we aren't transforming them
Also, the TTFont.getGlyphOrder() automatically makes up a dummy
glyph order from the maxp.numGlyphs, we simply need to ensure
'maxp' is decompiled before 'glyf'.

When transforming glyf, the glyf.glyphOrder is guaranteed to
be present (as the glyf table has been already decompiled), so
we don't need to deal with it being missing or incorrect
(hence removed spurious tests).
2019-06-12 18:41:13 +01:00
Cosimo Lupo
c98b71af5c
woff2: add support for unstransformed glyf and loca tables
Fixes https://github.com/fonttools/fonttools/issues/1636
2019-06-11 15:12:27 +01:00
Cosimo Lupo
1fc1d2f529
[loggingTools] remove unused backport of LastResortLogger
we are not in the business of logging.
2019-06-11 13:39:59 +01:00
Khaled Hosny
a56b1af2f6 [subset] Gracefully handle partial MATH table (#1635)
Both MathGlyphInfo and MathVariants can be None, so check for that first
before trying to access their methods.
2019-06-08 17:59:53 -07:00
Cosimo Lupo
97405ddb35
instancer: also update sidebearings+bbox of glyphs with no variations
Previously we were calling glyf.setCoordinates method only when a glyph had some
variation deltas to be applied to the default glyf coordinates.
However, some composite glyph may contain no variation delta but their base glyphs
may change, thus we still need to update the sidebearings and bounding box of the
composite glyphs.
2019-06-06 13:38:11 +01:00
Cosimo Lupo
ff473515a2
g_l_y_f: use '==' instead of 'is' for comparing equality with int literals 2019-06-04 16:16:31 +01:00
Cosimo Lupo
1febf7f5a2
minor formatting 2019-05-31 12:37:31 +01:00
Cosimo Lupo
06ad903ef1
instancer: rename locals from snake_case to camelCase for consistency
the rest of the instancer module uses camelCase, no point in having both styles within the same module
2019-05-31 12:26:03 +01:00
Cosimo Lupo
de2d5382ba
instancer: add more info to module-level docstring 2019-05-31 12:26:03 +01:00
Cosimo Lupo
b878b867c0
instancer: don't break on unsupported condition formats
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.
2019-05-30 13:13:06 +01:00
Cosimo Lupo
afc194db19
featureVars: populate counts on OT tables
this is done automatically upon compiling; however it's good to do it here
as well, in case one wants to pass the updated font directly to other modules
like 'subset' which requires these fields to be present -- without having
to first compile and decompile.
2019-05-30 12:29:23 +01:00
Cosimo Lupo
36f2775d6c
instancer: always keep FeatureVariationRecords with unknown condition format
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.
2019-05-30 11:22:01 +01:00
Cosimo Lupo
823f0fc021
instancer: fix invalid operand '-'; dict.keys() returns list in py27 2019-05-29 19:33:36 +01:00
Cosimo Lupo
5a3c3334fe
instancer: fix typo in logger name 2019-05-29 19:22:02 +01:00
Cosimo Lupo
11c662ee4d
instancer: only keep unique FeatureVariationRecords
After partial instancing, multiple FeatureVariationRecords may end up with
the same set of conditions (e.g. if one references two axes, one of which
is dropped, and a subsequent one also references the same axis that was
kept in the preceding record's condition set, and the min/max values are
the same for both records).
Therefore, we make sure only the first unique record with a given
configuration of conditions is kept. Any additional records with identical
conditions will never match the current context so they can be dropped.
2019-05-29 18:33:36 +01:00
Cosimo Lupo
60754aab8e
instancer: prune unreferenced lookups in instantiateFeatureVariations
the 'prune_lookups' method is dynamically set on the table_G_S_U_B class
only after importing the fontTools.subset module
2019-05-29 18:33:35 +01:00
Cosimo Lupo
7867c582da
instancer: remap axis indices in instantiateFeatureVariations
ConditionTable.AxisIndex needs to change when dropping axes, to
refer to the same axis in the modified fvar.axes array.

There was also another bug when a condition was not met,
and the `applies` flag (initialised to `True`) was not set to
`False`, thus substutions were incorrectly applied.
2019-05-29 18:20:11 +01:00
Cosimo Lupo
e2c0acf1c2
Merge remote-tracking branch 'origin/master' into partial-instancer 2019-05-29 18:04:54 +01:00
Cosimo Lupo
aa8a5bc616
featureVars: avoid duplicate refs to 'rvrn' feature in default langsys
the buildGSUB function creates an empty GSUB with no FeatureRecords, so the
FeatureIndex list should be empty initially; the index of the newly created
rvrn feature record will be appended later on by addFeatureVariationsRaw
function.
2019-05-29 13:40:57 +01:00
Cosimo Lupo
bec188c816
Bump version: 3.42.0 → 3.42.1.dev0 2019-05-28 12:07:55 +01:00
Cosimo Lupo
a0b8ff8b35
Release 3.42.0 2019-05-28 12:07:54 +01:00
Cosimo Lupo
89f42079b6
Merge pull request #1619 from schriftgestalt/tsType-type
fix sign of fsType
2019-05-28 03:38:20 -04:00
Behdad Esfahbod
ce21271c2d [subset] Use _list_subset() more 2019-05-27 13:56:46 -04:00
Behdad Esfahbod
77b394101f [subset] Skip out-of-range class values in mark attachment
Fixes https://github.com/fonttools/fonttools/issues/1478
2019-05-27 13:52:26 -04:00
Behdad Esfahbod
d38e26d324 [subset] Whitespace 2019-05-27 13:44:20 -04:00
Behdad Esfahbod
2ac470b96b Ouch, fix indentation
My bad.  Really sorry.
2019-05-25 17:18:35 -04:00
Behdad Esfahbod
0442d9062a Improve allEqual 2019-05-25 16:12:24 -04:00
Miguel Sousa
9fb0cac564 fontBuilder: Don't add a stub signature to DSIG
An empty DSIG is enough to make MS applications happy and also fixes an error reported by MS Font Validator
2019-05-25 10:09:13 -07:00
schriftgestalt
47f8d06d9a fix sign of fsType 2019-05-23 17:40:01 +02:00
Cosimo Lupo
17254fe37a
varLib.merger: Class2Record.Value{1,2} may not be initialised to None
When importing from TTX, these attribute are not there.
2019-05-21 18:42:38 -04:00
Cosimo Lupo
1fdee0454a
instancer: also in GDEF 1.3 VarStore is optional and can be None 2019-05-21 18:42:13 -04:00
Cosimo Lupo
4051976f48
Merge remote-tracking branch 'origin/master' into partial-instancer 2019-05-21 14:54:42 -04:00
Cosimo Lupo
058165dc5c
instancer: mention special None and 'drop' in docstring and --help 2019-05-21 14:40:26 -04:00
Cosimo Lupo
0e9c5d9fe8
instancer: rename 'None' to 'drop'
https://github.com/fonttools/fonttools/pull/1617#issuecomment-494455729
2019-05-21 14:06:44 -04:00
Cosimo Lupo
3bc983e78d
instancer: skip instantiating GPOS/GDEF if GDEF version < 0x00010003
in which case GDEF doesn't have a VarStore attatched, thus GPOS can't have variations
2019-05-21 12:17:27 -04:00
Cosimo Lupo
28fb29e758
instancer: make 'None' mean to drop an axis, or pinning at default
This allows to drop an axis (aka L1 instancing) without knowing the
axis' actual default value from fvar table. One can simply call
`instantiateVariableFont` function with a `None` value for a given
axis (i.e. axis_limits={'wght': None}); the `None` value is replaced
by the axis default value as per fvar table.

The same can be done from the console script as well.
The special string literal 'None' is parsed as the Python `None`
object. E.g.:

$ fonttools varLib.instancer MyFont-VF.ttf wght=None
2019-05-20 17:31:46 -04:00
Khaled Hosny
7e5644a0a8 [varLib] Fix merging GDEF.GlyphClassDef in mutator
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.
2019-05-18 04:44:34 +02:00
Khaled Hosny
6052357f14 [varLib] Command-line options to configure logging 2019-05-18 01:57:57 +02:00
Khaled Hosny
2861d65e56 [subset] Update font extents in head table
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.
2019-05-17 21:10:11 +02:00
Garret Rieger
dce15980fd Make --retain-gids truncate empty glyphs after the last non-empty glyph. 2019-05-16 10:13:33 -07:00
Cosimo Lupo
27a8ba480d
Merge remote-tracking branch 'origin/master' into partial-instancer 2019-05-15 13:09:19 -04:00
Cosimo Lupo
9208db110c
Bump version: 3.41.2 → 3.41.3.dev0 2019-05-13 13:29:19 +01:00
Cosimo Lupo
70357530ff
Release 3.41.2 2019-05-13 13:29:18 +01:00