Cosimo Lupo
8f66a1e813
COLRv1: add functions to un-build COLR otTables to raw dicts
...
This adds an unbuildColrV1 which does the inverse of colorLib.builder.buildColrV1.
Takes a LayerV1List and BaseGlypV1List and returns a map of base glyphs to raw data structures (list, dict, float, str, etc.).
Useful not only for debugging purpose, but also for implementing COLRv1 subsetting (where we need to drop whole chunks of paints which may be reused by multiple glyphs).
2021-02-03 16:47:59 +00:00
Cosimo Lupo
7516e0d95d
builder_test: add test with len(paints) > 255
2021-01-18 17:35:48 +00:00
Cosimo Lupo
9d33afe04d
COLRv1: support unlimited paints as 255-ary tree of PaintColrLayers
...
Fixes https://github.com/googlefonts/nanoemoji/pull/225
E.g. BASKET noto-emoji U+1F9FA contains 364 layers
2021-01-18 17:33:21 +00:00
Cosimo Lupo
b465dcff75
rename function to round_start_circle_stable_containment
...
as suggested in https://github.com/fonttools/fonttools/pull/2148#discussion_r557656073
2021-01-15 17:37:11 +00:00
Cosimo Lupo
4f1102ac6e
add a Circle class, handle concentrical case, explain why 2 iterations are enough
2021-01-15 16:59:17 +00:00
Cosimo Lupo
db14e6375e
COLRv1: avoid abrupt change after rounding c0 when too near c1's perimeter
...
Fixes https://github.com/googlefonts/picosvg/issues/158
Also see https://github.com/googlefonts/colr-gradients-spec/issues/204
2021-01-14 17:13:22 +00:00
Cosimo Lupo
538528d5a1
COLRv1: Implement PaintTranslate
...
https://github.com/googlefonts/colr-gradients-spec/pull/163
2020-12-15 16:58:31 +00:00
rsheeter
d888526659
Hook up paint skew and rotate
2020-12-02 21:21:19 -08:00
Cosimo Lupo
b6ef2408c5
colorLib_test: test that we accept either tuple or list for COLRv0 layer
...
https://github.com/googlefonts/ufo2ft/issues/426
2020-11-16 16:29:18 +00:00
rsheeter
cf2097f7c0
Update to builder per review discussion
2020-11-10 21:51:33 -08:00
rsheeter
cd39e6e246
Add a test
2020-11-06 14:59:52 -08:00
rsheeter
5c83b5be47
Don't generate a PaintColrLayers for a list of 1
2020-11-04 21:59:30 -08:00
rsheeter
f531038bf9
Start hooking up revised PaintColrLayers
2020-11-04 14:36:43 -08:00
Cosimo Lupo
e992953474
swap xy and yx fields in COLRv1 Affine2x3 struct
...
following the latest draft
See discussion at https://github.com/googlefonts/colr-gradients-spec/pull/85
2020-10-30 19:29:59 +00:00
Cosimo Lupo
6c752f677f
rename Paint{ColorGlyph,ColrSlice}
2020-10-27 19:15:50 +00:00
Cosimo Lupo
b654554109
add {First,Last}LayerIndex to PaintColorGlyph
...
as proposed in https://github.com/googlefonts/colr-gradients-spec/issues/86
The name of PaintColorGlyph may still change to PaintColorSlice, or PaintColrSlice, or PaintColorGlyphSlice, etc."
https://github.com/googlefonts/colr-gradients-spec/pull/87
2020-10-27 12:47:10 +00:00
Cosimo Lupo
8cffabfb58
builder_test: test buildPaint{ColorGlyph,Transform,Composite}
2020-10-26 18:14:13 +00:00
Cosimo Lupo
1803283baf
colorLib: use IntEnum instead of 'magic' Paint format integers
...
makes code more readable
2020-10-26 18:14:13 +00:00
Cosimo Lupo
a2aaf41a7e
colorLib: rename builders to match current Paint format names
2020-10-09 19:36:35 +01:00
Cosimo Lupo
fdf6a5c1fc
colorLib: update builders to latest COLRv1 draft
...
LayerV1Record and Affine2x2 are gone.
LayerV1List now contains a list of Paint DAGs
Added 4 new Paint formats: PaintGlyph, PaintColorGlyph, PaintTransform
and PaintComposite
2020-10-09 19:36:35 +01:00
Cosimo Lupo
ff79338607
rename radial gradient Paint.Affine attribute to Transform
...
as suggested by Peter Constable in
https://github.com/PeterConstable/OT_Drafts/blob/master/COLR_V1/COLRv1formats_rev3.md#paintformat3-table-conicalradial-gradient
2020-07-02 12:21:12 +01:00
Cosimo Lupo
ac0a755d20
make linear/radial gradient 'point-less', inline x0,y0,x1,y1,...
...
https://github.com/googlefonts/colr-gradients-spec/issues/21
2020-07-02 12:11:40 +01:00
Cosimo Lupo
dea9896421
rename COLR Color -> ColorIndex, transparency to alpha
...
https://github.com/googlefonts/colr-gradients-spec/issues/17
https://github.com/googlefonts/colr-gradients-spec/issues/19
2020-07-02 10:27:47 +01:00
Cosimo Lupo
4578f96e9d
colorLib_test: minor cosmetic changes
2020-07-01 18:29:26 +01:00
Cosimo Lupo
b215c000df
Rename LayerV1Array to LayerV1List, like with BaseGlyphV1List
...
See https://github.com/googlefonts/colr-gradients-spec/issues/14#issuecomment-652542829
2020-07-01 18:22:03 +01:00
Cosimo Lupo
5f18d9891c
rename BaseGlyphV1Array to BaseGlyphV1List
...
As suggested by Peter Constable in https://github.com/googlefonts/colr-gradients-spec/issues/14 and https://github.com/googlefonts/colr-gradients-spec/issues/18
2020-07-01 18:16:07 +01:00
Cosimo Lupo
971bcbff6f
colorLib: allow color stops to be built from list of dicts as well as tuples
2020-03-12 16:03:11 +00:00
Cosimo Lupo
5a8830ebc9
colorLib_test: add test for buildCORL with automatic or explicit 'version'
2020-03-11 19:01:25 +00:00
Cosimo Lupo
63e2be484e
colorLib: refactor _splitSolidAndGradientGlyphs and add test
2020-03-11 14:22:58 +00:00
Cosimo Lupo
5629d5d8d9
colorLib: allow to build Paint, ColorLine, Color from dict
2020-03-11 13:27:59 +00:00
Cosimo Lupo
0149f40588
colorLib_test: add tests for buildLayerV1Array, buildBaseGlyphV1Array
2020-03-10 15:34:53 +00:00
Cosimo Lupo
44d729ad3c
colorLib: in buildColorStop accept color tuple as parameter
...
and use Sequence instead of List for input params type hints
2020-03-10 11:49:04 +00:00
Cosimo Lupo
be3265f136
colorLib_test: add tests for build{Linear,Radial}GradientPaint
2020-03-10 11:49:04 +00:00
Cosimo Lupo
5eb11359ea
colorLib_test: add tests for more builder funcs
2020-03-09 16:58:13 +00:00
Cosimo Lupo
a0a4901a5e
colorLib_test: add tests for buildCPAL v1
2020-02-17 18:28:24 +00:00
Cosimo Lupo
acfae6721b
add tests for buildCORL and buildCPAL
2020-02-17 12:11:53 +00:00