35 Commits

Author SHA1 Message Date
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
Cosimo Lupo
335a1e56ec re-run black v23.10 on all .py files 2023-11-03 10:25:15 +00:00
Behdad Esfahbod
9e40409094 [woff2] Support cubic curves as untransformed glyph table 2023-02-21 13:01:49 -07:00
Behdad Esfahbod
6755acceee [woff2] Add fvar to glyf dependencies
Since the VarComposites added fvar to glyf dependencies in ttLib.

Add test for VarComposite to woff2 tests.
2023-01-31 12:46:17 -07:00
Behdad Esfahbod
be4450dcda [woff2] Support VarComposites 2023-01-30 11:26:20 -07:00
Nikolaus Waxweiler
d584daa8fd Blacken code 2022-12-13 11:26:36 +00:00
Cosimo Lupo
b4e664da21
[woff2] Add support for encoding/decoding OVERLAP_SIMPLE glyf flags in WOFF2
Fixes #2576

This updates our woff2 encoder/decoder to support retaining the OVERLAP_SIMPLE glyf flag following the updated WOFF 2.0 specification and official google/woff2 implementation.

https://www.w3.org/TR/WOFF2/#glyf_table_format
2022-11-09 13:56:46 +00:00
Khaled Hosny
232b2ccbc4 Move the rest of py23 module to textTools
Change all imports to use textTools module, except the test_py23.py test
which is kept until we decide to remove the module (if ever).
2021-08-20 01:29:45 +02: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
Nikolaus Waxweiler
52e3e03ed9 An off-curve should stay off even with flags 2021-01-28 16:30:23 +00:00
Seth Michael Larson
d5353a4085
Switch from brotlipy to brotlicffi for PyPy support 2020-12-01 19:37:02 -06:00
Caleb Maclennan
221fa07c3b
Default checkChecksums to off for WOFF2 Reader 2020-09-10 16:41:30 +03: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
Simon Cozens
253de13377 Use inheritance to avoid repeated code in WOFF2FlavorData initializer 2020-05-07 21:04:52 +01:00
Cosimo Lupo
be147e965d
woff2: don't attempt to normalize glyf/loca if missing (e.g. CBDT/CBLC fonts like NotoColorEmoji.ttf) 2020-02-26 18:14:31 +00:00
Chris Simpkins
791f619029 refactor array.tostring to array.tobytes
the array.tostring method is deprecated
2019-08-29 23:21:22 -04:00
Nikolaus Waxweiler
01328213c7 Remove __future__ imports 2019-08-09 12:20:13 +01:00
Cosimo Lupo
84e9ea167a
woff2: allow to recompress woff2 while keeping flavorData
optionally modifying the list of transformed tables
2019-06-19 12:13:14 +01:00
Cosimo Lupo
1c369da8c9
woff2: fix typo 2019-06-19 11:47:32 +01:00
Cosimo Lupo
6ba7c3c9e2
woff2: initialize WOFF2FlavorData from existing WOFFFlavorData
Fixes #1650

A regression was introduced with 3.43.0 when doing pyftsubset --flavor=woff2
and the input font is WOFF 1.0, thus it has a non-None flavorData already
but doesn't define the transformTables attribute.
2019-06-19 11:44:40 +01:00
Cosimo Lupo
a96d2dba73
woff2: add main() to call 'compress' and 'decompress' subcommands
$ fonttools ttLib.woff2 --help
2019-06-14 18:18:21 +01:00
Cosimo Lupo
deaeb909a7
woff2: add support for hmtx transformation
no tests yet

fixup
2019-06-13 18:07:14 +01: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
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
Cosimo Lupo
6a92ae085b [woff2] replace print with logger 2016-01-27 19:01:12 +00:00
Sascha Brawer
5f5b07b8d7 Merge pull request #349 from brawer/glyphnames-beyond-bmp
Support non-BMP characters for synthetic glyph names
2015-09-09 15:03:06 +02:00
Cosimo Lupo
f8e59445c1 [woff2] minor 2015-09-09 12:16:49 +01:00
Cosimo Lupo
ed03d57170 [woff2] make dummy glyphOrder based on gids when decompiling glyf table
Using TTFont.getGlyphOrder() would also require to decompile post and cmap tables.
But we don't need the actual glyph names in order to apply the WOFF2 glyf transform.
2015-09-08 17:01:59 +01:00
Cosimo Lupo
ef71757a42 [woff2] cache reconstructed glyf data if requested to reconstruct loca before glyf 2015-08-19 22:58:17 +01:00
Cosimo Lupo
3142e3319e add reordersTables() method to SFNTWriter and WOFF2Writer (return True for the latter) 2015-08-19 17:56:46 +01:00
Cosimo Lupo
f083209590 [woff2] use OrderedDict like sfnt module 2015-08-19 16:36:03 +01:00
Cosimo Lupo
2a713bfd79 [woff2/woff2_test] replace 'StringIO' with 'BytesIO' 2015-08-07 18:23:55 +01:00
Cosimo Lupo
b6ce7ae668 [woff2] add woff2 module with support for reading/writing single WOFF2 fonts (no font collections yet) 2015-08-07 18:23:41 +01:00