1595 Commits

Author SHA1 Message Date
Cosimo Lupo
73073be3c2
Affine2x3 struct should be inlined inside PaintTransform
Not pointed to by an Offset32.
Thanks Dominik for spotting this!
2020-10-12 14:32:23 +01:00
Cosimo Lupo
7f6a05b007
otData: add new COLR Paint struct definitions, update to latest draft
Update C_O_L_R_test.py accordingly.

a
2020-10-09 19:36:35 +01:00
Cosimo Lupo
c7e3a692e1
otBase: support FormatSwitchingBaseTable with uint8 Format type 2020-10-08 12:39:56 +01:00
Cosimo Lupo
d60d84d3fc
otBase/otConverters: add support for 3-byte offsets 2020-10-08 12:39:54 +01:00
Cosimo Lupo
7f9462dfa6
compare paths independently of contour order
the order of contours modified by Skia is not stable and may change. So when we compare the original and the modified paths, we compare the paths as unordered sets of contours.

The order of contours doesn't produce any visible difference, but we try to keep the changes to the minimum here to avoid unnecessary diffs
2020-09-30 13:40:01 +01:00
Cosimo Lupo
66a0d91bf9
remove hinting from all glyphs, whether overlaps are removed or not 2020-09-30 13:36:28 +01:00
Cosimo Lupo
e94098606b
log modified glyps 2020-09-30 13:35:05 +01:00
Cosimo Lupo
7b9da7602c
skip empty paths with no contours
https://github.com/fonttools/fonttools/pull/2068#pullrequestreview-498472660
2020-09-29 16:24:17 +01:00
Cosimo Lupo
e1ad83add7
minor edit to comment [skip ci] 2020-09-29 14:44:51 +01:00
Cosimo Lupo
da439c7c57
decompose composites only if components intersect; let pathops.PathPen decompose components
requires https://github.com/fonttools/skia-pathops/pull/32
2020-09-29 14:14:55 +01:00
Cosimo Lupo
015d8265d2
use pathops.simplify() and remember if original path direction
pathops.simplify() returns a copy so we don't need to make a copy ourselves.

'clockwise' option is defined in https://github.com/fonttools/skia-pathops/pull/31
2020-09-27 17:31:30 +01:00
Cosimo Lupo
0ceb146196
process simple glyphs before composites
to avoid decomposing only because a component's base glyph contains overlaps.
2020-09-27 17:29:25 +01:00
Cosimo Lupo
2bcc103c36
move it to ttLib.removeOverlaps module 2020-09-23 19:13:58 +01:00
Simon Cozens
a18b6bfb6c
Merge pull request #2052 from simoncozens/fealib-debug
feaLib source debugging
2020-09-17 20:13:23 +01:00
Simon Cozens
7135255d4a Style nits 2020-09-11 09:35:45 +01:00
Simon Cozens
95a941ec15 Re-case debug info module 2020-09-11 09:31:07 +01:00
Simon Cozens
af4f1f6d6e Prefer module constant to hard-coded string for Debg table key 2020-09-10 16:00:06 +01:00
Caleb Maclennan
221fa07c3b
Default checkChecksums to off for WOFF2 Reader 2020-09-10 16:41:30 +03:00
Caleb Maclennan
705b9663d2
Default checkChecksums to off for SFNT Reader 2020-09-10 16:41:30 +03:00
Caleb Maclennan
7e3c4acfde
Use 0 not False to disable checkChecksums as documented and used
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.
2020-09-10 16:41:30 +03:00
Simon Cozens
02c305c2fc Serialize JSON object before writing to XML 2020-09-10 13:22:33 +01:00
Simon Cozens
4e70b30eb0 Ensure LookupCount is processed 2020-09-10 08:29:15 +01:00
Simon Cozens
98803b7bf8 Reformat, tidy from review comments 2020-09-09 19:56:55 +01:00
Simon Cozens
41c1dcce1c Tidy up as per review 2020-09-09 19:56:44 +01:00
Simon Cozens
4cddc38263 Use a named tuple, tidy ttx dump code 2020-09-09 19:56:05 +01:00
Just van Rossum
9064e53c7a
Add registry for custom table packer/unpacker classes (#2055)
* Add custom table packer/unpacker registry

* fix documentation for getTableClass(): it will never return None

* add unregisterCustomTableClass(), mostly for testing
2020-09-09 11:35:06 +02:00
Simon Cozens
b548c5f2e1 Namespace debug output. 2020-08-25 20:22:54 +01:00
Simon Cozens
50e1105604 Parse Debg info in LookupList 2020-08-25 20:19:31 +01:00
Simon Cozens
aebb2e511c The long-threatened Debg table! 2020-08-25 14:06:14 +01:00
Just van Rossum
bec19252c5
[ttLib] Fix for #2044: fix maxp.maxComponentDepth calculation (#2045)
Fix for #2044: don't overwrite the initial maxComponentDepth variable, as this will give the wrong value when there are multiple nested components.
2020-08-14 20:13:01 +02:00
Cosimo Lupo
09c0e42031
Partly revert "use 32-bit GlyphIDs in COLRv1 baseGlyphs and layers"
This reverts commit 690080b14d9a4f193092ffc172a39b3e212d307c.

We keep 16-bit GlyphIDs for COLRv1 tables, at least for now
https://github.com/googlefonts/colr-gradients-spec/pull/24

I keep the GlyphID32 converter in case we may need it in the future.
2020-07-08 16:06:45 +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
ff7dc9a1c5
Rename: Var* types: Scalar->Fixed, NormalizedScalar->F2Dot14, etc.
VariablePosition -> VarInt16
VariableDistance -> VarUInt16

cf. https://github.com/googlefonts/colr-gradients-spec/issues/17
2020-07-01 20:13:14 +01:00
Cosimo Lupo
690080b14d
use 32-bit GlyphIDs in COLRv1 baseGlyphs and layers
For forward-compatibility, see https://github.com/googlefonts/colr-gradients-spec/issues/8
2020-07-01 19:50:48 +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
Just van Rossum
dc7d016538
[ttLib.tables._n_a_m_e] Fix #1997: Only attempt to recovered malformed data from bytes (#1998)
* don't attempt to recover malformed data from str, only from bytes. Fixes #1997
2020-06-16 16:35:40 +02:00
Just van Rossum
90c7c7fae1
Fix for #1985: ensure that the AxisNameID in the STAT table is > 255 (#1986)
Fix for #1985:
* ensure that the AxisNameID in the STAT table is not less than 256. This needed an additional argument to the addMultiLingualName() name table method.
* fvar axis name IDs must also not be less than 256, just like STAT axis names.
2020-06-08 19:39:28 +02:00
Guillaume Ayoub
2a1f09dbb2 Don’t calculate whole sets of unicode codepoints
_getUnicodeRangeSets used to calculate sets containing lots of numbers, only to
get intersections between a set and ranges. Creating and manipulating a lot of
big sets requires a lot of memory.

The function has been replaced by _getUnicodeRanges, returning a list of range
starts boundaries and a list of range stops + corresponding bits.

Tests on intersectUnicodeRanges save about 130 MB (!) of RAM, with no
significant speed penalty.
2020-06-05 11:28:18 +02:00
Cosimo Lupo
9d8a7e27fe
[COLR] should set self.version after decompiling COLRv1
we set self.version for COLRv0 already; makes easier to check COLR.version
2020-05-21 16:57:35 +01:00
Cosimo Lupo
02e51072a4
sfnt: must import SimpleNamespace
Thanks Zachary for reporting this
7ca42f6623 (commitcomment-39299386)

Amazingly we have no tests for reading TTCs
2020-05-20 09:16:06 +01:00
Cosimo Lupo
7ca42f6623
Merge pull request #1967 from anthrotype/pickle
sfnt: add __getstate__ and __setstate__ to SFNTReader to make it pickelable
2020-05-19 14:03:52 +01:00
Cosimo Lupo
72f9e7794a
SFNTReader: define __getstate__/__setstate__ to reopen external file
Instead of copying to BytesIO, we can return the file name in getstate and reopen the file in setstate. This keeps the TTFont truly lazy as it avoids the extra copy
2020-05-18 12:41:25 +01:00
Cosimo Lupo
942fbfe07a
sfnt: custom __deepcopy__ not needed with __getstate__
also, we only need to copy file to stream when self.file is _not_ already an io.BytesIO.
2020-05-18 11:57:03 +01:00
Cosimo Lupo
d767061e8d
sfnt: add __getstate__ to SFNTReader to make it pickelable
Fixes https://github.com/fonttools/fonttools/issues/1962
2020-05-18 11:33:50 +01:00
Just van Rossum
db26cf804e
[ttLib.name] Fix findMultilingualName() (#1963)
* when reading from binary, name.string may be an encoded bytes sequence: we should call toUnicode() before we compare to the requested string

* fix expected output
2020-05-16 11:29:23 +02:00
Simon Cozens
089f24da6b
Ensure all fonttools CLI tools have help documentation (#1948)
Note UI change : `fonttools varLib.models` now takes prefixed options `-d` or `-l` instead of guessing the intended feature from the number of arguments.

We have a number of command line tools which are somewhat opaque. (varLib.models in particular was very confusing.) This ensures that they all use argparse to have a consistent interface, and all have --help documentation which at least details their parameters, and hopefully therefore gives more of a clue about what they do. Those which use logging have had a command-line logging parameter added.
2020-05-12 15:11:30 +01:00
Simon Cozens
2cef07af80
[doc] Add help options to fonttools CLI (#1920)
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.
2020-05-12 06:31:13 +01:00