9660 Commits

Author SHA1 Message Date
Cosimo Lupo
47206d445d
Merge pull request #2669 from turrisxyz/Dependabot-GitHub-Actions
chore: Included githubactions in the dependabot config
2022-07-06 10:58:27 +01:00
Cosimo Lupo
2a07518b70
Merge pull request #2660 from fonttools/variable-colr
[varLib] add support for building variable COLR from set of master COLRv1 tables
2022-07-06 10:55:50 +01:00
Cosimo Lupo
46e780ffa2
Merge pull request #2668 from googlefonts/hb_repack
Update how table packing falls back to fontTools from harfbuzz.
2022-07-06 10:49:39 +01:00
Cosimo Lupo
b63df64f8d
Merge pull request #2675 from dscorbett/fealib-ignore-names-2-6
[feaLib] Let the parser set nameIDs 1 through 6
2022-07-06 10:42:27 +01:00
Cosimo Lupo
f1d715dbb1 Add integration test for variable COLR in varLib_test.py 2022-07-06 10:24:16 +01:00
Cosimo Lupo
ef3775a084 merger_test: add test for expandPaintColrLayers method 2022-07-06 09:59:16 +01:00
Cosimo Lupo
fd397bac32 merger_test: test with masters' layer reuse off and on to confirm output is the same 2022-07-06 09:14:17 +01:00
Cosimo Lupo
cdc7cc3cc4 COLR merger be cleverer and only deepcopy effectively reused layers
instead of blindly copying them all like in previous commit.
2022-07-05 20:37:54 +01:00
Cosimo Lupo
c27483fa54 [instancer] add --no-recalc-bounds CLI option 2022-07-05 19:02:21 +01:00
Cosimo Lupo
8a9f16d129 COLRVariationMerger: copy destination layers to ensure they are unique and can be modified in place 2022-07-05 17:53:39 +01:00
Cosimo Lupo
e5029801d2 support merging COLR masters with 'sparse' glyphsets or different layer count
There is no longer a requirement that all the masters have exactly the same base color glyphs as the default masters. Similarly, it's no longer required that all masters' LayerLists have the same total count of layers. It is sufficient that, for a base color glyph in the default master, a non-default master may (or may not) contain one with the same name and same effective number of layers (which in turn can be laid out differently in the respective LayerLists).
This provides greater flexibility when working with variable font project with sparse glyph sets.
2022-07-05 00:11:12 +01:00
Cosimo Lupo
a3f402e036 move build_n_ary_tree to misc/treeTools.py module
so I can import from varLib.merger as well
2022-07-04 23:08:14 +01:00
Cosimo Lupo
5d52124e49 varLib.errors: allow to give extra context as to where an error occurs in the optional 'cause' 2022-07-04 18:52:20 +01:00
Cosimo Lupo
4b9f35dc2b varLib.merger: subset self.ttfs to non-None (sparse) values in VariationMerger.mergeThings 2022-07-04 18:52:20 +01:00
Cosimo Lupo
3b0769b519 colorLib: let clipBoxes contain more glyphs than colorGlyphs, helps with sparse variable builds 2022-07-04 18:44:54 +01:00
Cosimo Lupo
eb00e499c0 colorLib: factor out LayerReuseCache class 2022-07-04 12:40:47 +01:00
David Corbett
8ec37c4bb3 [feaLib] Let the parser set nameIDs 1 through 6 2022-07-02 15:23:03 -04:00
Cosimo Lupo
c2887caf95 varLib/merger_test: test merging ClipBoxes 2022-06-28 18:23:06 +01:00
Cosimo Lupo
d85aa2d119 COLRVariationMerger: further optimize DeltaSetIndexMap
previously we only reused the VarIndexBase of a previously seen variable table when the current's varIdxes were _fully_ equal to one of the previous; now we also try to find a match anywhere in the accummulated list of self.varIdxes, including a partial match at the tail of the list.
2022-06-28 14:11:28 +01:00
Garret Rieger
10140f9df3 Remove TODO. 2022-06-27 18:32:04 +00:00
Garret Rieger
8196166e53 Add some additional comments about packing state machine. 2022-06-27 18:28:02 +00:00
Garret Rieger
d92fd2665c Use enum's for repacker state. 2022-06-27 18:18:20 +00:00
Garret Rieger
4acad94b93 Update harfbuzz repack test failure message expectation. 2022-06-27 18:13:52 +00:00
Cosimo Lupo
c397764720 COLRVariationMerger: implement reuse of VarIndexBase between tables with same varIdxes
When multiple variable tables refer to the same delta-sets they can now share the same VarIndexBase so the resulting DeltaSetIndexMap is a bit smaller.
For simplicity, we only reuse VarIndexBase when variable tables fully share (ie. same, and same number of) varIdxes; potentially we could reuse subsets of varIdxes (e.g. a VarColoStop.Alpha has a +0.5 delta, and later on elsewhere a PaintVarSolid.Alpha has a similar +0.5 delta; the latter could have a VarIndexBase that reuses an existing DeltaSetIndexMap entry for the former), but for now this I think is good enough.
2022-06-27 17:17:32 +01:00
Cosimo Lupo
99a754a48e varLib/merger.py: (minor) rename self.varTables => self.varTableIds 2022-06-27 15:54:51 +01:00
Cosimo Lupo
2b6e813b98 varLib/merger_test: minor reorder sub-tests to follow incremental PaintFormat 2022-06-27 15:38:55 +01:00
Cosimo Lupo
4ca582a273 otTraverse: add pretty __str__ for SubTablePath tuple
so one can debug print(path) and get things like 'Paint.Paint.ColorLine.ColorStop[1]'
2022-06-24 18:33:52 +01:00
Cosimo Lupo
f98c860ff2 Start adding Tests/varLib/merger_test.py for COLRVariationMerger 2022-06-24 18:16:28 +01:00
Cosimo Lupo
f02593cf1a COLRVariationMerger: fix logic in convertSubTablesToVarType
Before we were too greedy in the way we converted subtables to VarType. E.g. If a PaintTransform wrapping a PaintRadialGradient contained variations in the Affine2x3, we would incorrectly convert also the gradient's ColorLine (and ColorStops) to VarColorLine, VarColorStop, etc. (even if the gradient was not variable!). Instead we want skip traversing a given subtable including its children when the predicate doesn't match.
2022-06-24 18:14:58 +01:00
Cosimo Lupo
41943bb0e7 otTraverse: add options to skip_root and predicate to filter out entire sub-trees 2022-06-24 18:04:04 +01:00
Cosimo Lupo
a53a235302 varLib.merger: set Paint.Format to int(PaintFormat)
for consistency with the way tables are decompiled from binary data
2022-06-24 11:36:58 +01:00
Cosimo Lupo
7ab7940761 varLib: simplify a bit following varStore.py recent changes
#2662
2022-06-24 10:20:48 +01:00
Cosimo Lupo
fcd2a67f52 Merge remote-tracking branch 'origin/main' into variable-colr 2022-06-24 10:16:51 +01:00
naveen
19f5965aa0 chore: Included githubactions in the dependabot config
This should help with keeping the GitHub actions updated on new releases. This will also help with keeping it secure.

Dependabot helps in keeping the supply chain secure https://docs.github.com/en/code-security/dependabot

GitHub actions up to date https://docs.github.com/en/code-security/dependabot/working-with-dependabot/keeping-your-actions-up-to-date-with-dependabot

https://github.com/ossf/scorecard/blob/main/docs/checks.md#dependency-update-tool
Signed-off-by: naveen <172697+naveensrinivasan@users.noreply.github.com>
2022-06-24 01:30:17 +00:00
Garret Rieger
c63b84db7e Update how table packing falls back to fontTools from harfbuzz.
Introduce three compilation modes:
1. Pure python: only uses the existing fonttools packing and overflow resolution.
2. Harfbuzz+python: uses harfbuzz packing and python overflow resolution. Extensions are allowed to be shared.
3. Python fallback: if harfbuzz+python runs out of resolution options, this disables extension sharing and only uses python packing. Once it succeeds control is passed back to the harfbuzz packer to produce the final packing with extension sharing enabled.
2022-06-23 19:39:56 +00:00
Behdad Esfahbod
97958a95e1
Merge pull request #2662 from fonttools/varstore-empty
[varLib.varStore] Support NO_VARIATION_INDEX
2022-06-23 12:02:00 -06:00
Behdad Esfahbod
5d70109645 [varStore] Comment 2022-06-23 12:01:20 -06:00
Behdad Esfahbod
e01f643a8e [varLib.varStore] Support NO_VARIATION_INDEX in optimizer & instancer
Fixes https://github.com/fonttools/fonttools/issues/2211
2022-06-23 12:01:20 -06:00
Behdad Esfahbod
cac7241514 [varLib.varStore] Add NO_VARIATION_INDEX
Part of https://github.com/fonttools/fonttools/issues/2211
2022-06-23 12:01:20 -06:00
Cosimo Lupo
0e6a4ec581 [otBase] temporarily disable extension sharing during harfbuzz repacking
If extension sharing is enabled some fonts may fail to repack due to fontTools repacker getting stuck in a unrecoverable error.

https://github.com/fonttools/fonttools/issues/2661
2022-06-23 16:34:12 +01:00
Simon Cozens
d224e1f73d
[feaLib] show all missing glyphs at once (#2665) 2022-06-23 15:04:59 +01:00
Cosimo Lupo
b4d85f23cf
Merge pull request #2663 from turrisxyz/Pinned-Dependencies-GitHub
chore: Set permissions for GitHub actions
2022-06-23 11:19:38 +01:00
nathannaveen
83f69028a3 chore: Set permissions for GitHub actions
Restrict the GitHub token permissions only to the required ones; this way, even if the attackers will succeed in compromising your workflow, they won’t be able to do much.

- Included permissions for the action. https://github.com/ossf/scorecard/blob/main/docs/checks.md#token-permissions

https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions

https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs

[Keeping your GitHub Actions and workflows secure Part 1: Preventing pwn requests](https://securitylab.github.com/research/github-actions-preventing-pwn-requests/)

Signed-off-by: nathannaveen <42319948+nathannaveen@users.noreply.github.com>
2022-06-23 00:58:26 +00:00
Behdad Esfahbod
e917c43ca9 [varLib.varStore] Add operator __bool__ and use it
Part of https://github.com/fonttools/fonttools/issues/2211#issuecomment-790125437
2022-06-21 14:03:20 -06:00
Cosimo Lupo
9c0bc3814f varLib: add --no-colr-layer-reuse option to disable rebuilding LayerList 2022-06-21 17:27:12 +01:00
Cosimo Lupo
00959d3132 varLib: build variable COLR table when master fonts contain COLRv1 2022-06-21 17:27:12 +01:00
Cosimo Lupo
e58c43d187 varLib.merger: add a COLRVariationMerger to merge multiple master COLRv1 into a variable COLR 2022-06-21 17:27:12 +01:00
Cosimo Lupo
24941e613f otTraverse: add module containing methods for traversing trees of otData tables
this is adapted from nanoemoji's
d65a627154/src/nanoemoji/util.py (L122-L162)
2022-06-21 17:27:12 +01:00
Cosimo Lupo
fae63959a9 otTables: add class attributes to link Var{Table} <-> {Table}
so one can go from Affine2x3 <-> VarAffine2x3 and similar types that have an associated Var{Type}
2022-06-21 17:27:12 +01:00
Cosimo Lupo
ca2f9e0a94 otBase: use OptionalValue.DEFAULT in populateDefaults() 2022-06-21 17:27:12 +01:00