102 Commits

Author SHA1 Message Date
Behdad Esfahbod
0213bea88e [TupleVariation] Option to optimize for loading speed, not size 2024-10-06 18:11:48 -06:00
Behdad Esfahbod
e3ba7a7e0b [lazyTools] Simplify based on review feedback 2024-05-22 18:46:07 -06:00
Behdad Esfahbod
3ff2ee61e1 Move lazy datastructures to misc.lazyTools 2024-05-22 18:45:28 -06:00
Behdad Esfahbod
7471ac6d4d [gvar] Speed up loading by not reading all offsets 2024-05-22 18:45:28 -06:00
Behdad Esfahbod
61916c1034 [gvar] Speed up loading a bit
More to come.
2024-05-22 18:45:28 -06:00
Behdad Esfahbod
bcd5e4c216 Rip out glyf1 VarComposites
In favor of separate VARC table.

ttGlyphSet does NOT yet know how to draw VARC table though.

The 9 failing tests are all VarComposite-related and need
to be updated with VARC equivalents eventually when we
add VARC support to subsetter and instancer.
2024-05-22 18:45:27 -06:00
Behdad Esfahbod
86420d1150 [gvar] Decompile VarComposite glyph 2023-01-30 11:26:20 -07:00
Nikolaus Waxweiler
d584daa8fd Blacken code 2022-12-13 11:26:36 +00:00
Behdad Esfahbod
6aca5be9b7 [gvar] Don't expand glyph for unused pointCount
Keep it in the API though.
2022-12-09 11:39:07 -07:00
Behdad Esfahbod
96de954d29 [gvar] Don't expand glyph during decompile if no variation data 2022-12-07 21:34:36 -07:00
Behdad Esfahbod
3a258573af [gvar] Avoid decompiling glyphs that don't have variations 2022-12-07 14:50:15 -07:00
Cosimo Lupo
36de9df3cc [gvar] be non lazy for TTFont.lazy=False, add ensureDecompiled
like cmap, or glyf or OTL tables, we need to respect lazy=False flag and decompile everything upfront, also we want to add an ensureDecompiled method (called by TTFont.ensureDecompiled) to allow loading everything in one go even when a font had been opened lazily.
2022-08-31 11:10:50 +01:00
Just van Rossum
a32a92e6d7 add custom __init__ in favor of setting .data externally 2022-08-26 10:53:32 -06:00
Just van Rossum
a0af5727e1 Use UserDict for lazy gar variations dict; alternative for #2779 2022-08-26 10:53:32 -06:00
Just van Rossum
0637b24b2a Read gvar more lazily by not parsing all of the 'glyf' table 2022-08-24 16:38:00 +02:00
Behdad Esfahbod
9ebebcba6d [gvar] Minor simplify 2022-08-14 12:07:54 -06:00
Behdad Esfahbod
260564a1e3
Lazy gvar (#2741)
* [gvar] Load variations lazily

Fixes https://github.com/fonttools/fonttools/issues/2740
2022-08-14 11:54:35 -06:00
Behdad Esfahbod
75ef521fd0 [gvar] Reduce TTFont.__getitem__() calls 2021-04-13 14:45:40 -06:00
Behdad Esfahbod
ea505154df [gvar] Avoid a copy in compileGlyph_() 2021-04-08 15:50:52 -06:00
Behdad Esfahbod
b811c3f3f3 [gvar] Remove use of bytesjoin() 2021-04-08 12:18:58 -06:00
Just van Rossum
5fc65d7168
Misc py23 cleanups (#2243)
* Replaced all from ...py23 import * with explicit name imports, or removed completely when possible.
* Replaced tounicode() with tostr()
* Changed all BytesIO ans StringIO imports to from io import ..., replaced all UnicodeIO with StringIO.
* Replaced all unichr() with chr()
* Misc minor tweaks and fixes
2021-03-29 11:45:58 +02:00
justvanrossum
b4c5b07741 sort XML output by glyph name 2020-04-29 16:31:54 +02:00
Chris Simpkins
791f619029 refactor array.tostring to array.tobytes
the array.tostring method is deprecated
2019-08-29 23:21:22 -04:00
Chris Simpkins
12814aa7b1 refactor array.fromstring to array.frombytes
fromstring is a deprecated array method
2019-08-29 22:58:42 -04:00
Nikolaus Waxweiler
01328213c7 Remove __future__ imports 2019-08-09 12:20:13 +01:00
Cosimo Lupo
fb914c93c4
Merge remote-tracking branch 'origin/master' into partial-instancer 2019-04-04 14:15:14 +01:00
Cosimo Lupo
aef41419f2
gvar: log the glyph name if any exception is caught when decompiling deltas 2019-04-03 10:54:54 +01:00
Cosimo Lupo
742b1d784a gvar: minor whitespace
mixed tab/spaces freak out my vim
2019-03-08 15:56:38 -08:00
Behdad Esfahbod
349cd94d17 [graphite] Fix for big-endian
Make all "if sys.byteorder..." and "byteswap" be on the same line for
earsier grep verification.

Fixes https://github.com/fonttools/fonttools/issues/1311
2018-09-05 21:12:53 -07:00
Behdad Esfahbod
f82128f25d Kill progress argument
Fixes https://github.com/fonttools/fonttools/issues/1008

Doesn't touch xmlReader / xmlWriter modules.
2018-01-25 17:30:23 -08:00
Sascha Brawer
155ec67ae6 [cvar] Implement cvar table 2017-01-10 17:57:04 +01:00
Sascha Brawer
689008a4f5 [gvar/cvar] Rename decompileVariationTuples to decompileVariationTupleStore
For consistency with the terminology of the OpenType 1.8 specification,
and for symetry with the compileVariationTupleStore function.
2017-01-09 19:00:39 +01:00
Sascha Brawer
5d3eae404c [cvar] Compile TupleVariationStores in common library 2017-01-09 17:34:45 +01:00
Sascha Brawer
c3d68a684e [cvar] Move compileSharedTuples() to module TupleVariation 2017-01-09 17:01:43 +01:00
Sascha Brawer
87d854e881 [cvar] Move decompilation of shared tuples to TupleVariation.py 2017-01-09 14:25:16 +01:00
Sascha Brawer
24a02fedd7 [cvar] Refactor decompilation of tuple variation stores 2017-01-09 14:05:52 +01:00
Sascha Brawer
7c082600d3 [cvar] Move decompilation for single TupleVariation out of gvar
Rename local variables to match terminology of OpenType 1.8 specification
2017-01-09 12:14:12 +01:00
Sascha Brawer
980ee57b0e [gvar] Rename gvar.decompileSharedCoords() to decompileSharedTuples()
The new name is consistent with the terminology of the OpenType 1.8
specification, which calls the decoded structure the `SharedTuples`
array.
2017-01-05 14:18:52 +01:00
Sascha Brawer
039cb48927 [gvar] Move gvar.computeMinMaxCoord() to TupleVariation.inferRegion()
Document what this helper function does, using terminology from
the OpenType 1.8 specification.
2017-01-05 13:35:27 +01:00
Sascha Brawer
39c4ef621c [cvar] Change warning message for out-of-range points 2017-01-05 08:55:36 +01:00
Sascha Brawer
01f95fc190 [gvar] Rename header fields to match OpenType specification
The initial implementation had been written with Apple's TrueType
specification, before OpenType supported variations.
2017-01-04 16:24:32 +01:00
Sascha Brawer
271987a89f [gvar] Adjust comment about broken variation fonts on macOS 2017-01-04 14:31:52 +01:00
Sascha Brawer
3420bb116c [gvar] Move TupleVariation to its own source file
The TupleVariation structure is used both for `gvar` and `cvar`.
2017-01-04 14:07:38 +01:00
Sascha Brawer
1d28abdb65 [gvar] Rename GlyphVariation to TupleVariation
In the OpenType 1.8 specification, this is called TupleVariation
so let's be consistent with the spec. (The initial implementation
in fonttools pre-dates OpenType 1.8).
2017-01-04 12:41:55 +01:00
Sascha Brawer
a837a3950f [gvar] Use flag names from OpenType 1.8
FontTools has initially been implemented using the Apple TrueType
specification.  When OpenType adopted variations, some identifier
names were changed.
2017-01-03 17:09:47 +01:00
Behdad Esfahbod
8e46c6a121 [varLib] Err if gvar tuples have unknown location axes 2016-09-27 19:49:41 +02:00
Behdad Esfahbod
9c037fc826 [gvar] Add TODO 2016-07-16 21:22:20 -07:00
Behdad Esfahbod
b1eeaa5151 [gvar] Fix point encoding
Where more than one run is used, it's only the first run's first point
that is absolute, all other values are relative.

Similar fix landing in FreeType soon.  Fixes lizzard glyph (glyphname
"dollar") in Zycon.
2016-07-15 18:15:17 -07:00
Behdad Esfahbod
40198a2dec [gvar] Use array.array to decode deltas 2016-03-21 10:12:26 -07:00
Behdad Esfahbod
9987b7e14e [gvar] Use array.array to decode deltas 2016-03-21 10:12:26 -07:00