162 Commits

Author SHA1 Message Date
ftCLI
1fbc897f9f Run black 2024-09-29 11:44:16 +02:00
ftCLI
94cb4f9733 Refactor ttf2otf
Replaced Click with argparse.

Updated docstring with usage examples.

Modified logging to use warnings for conversion failures.
2024-09-28 08:15:31 +02:00
ftCLI
42716d5038 Add 'ttf2otf.py' snippet 2024-04-12 12:59:46 +02:00
Cosimo Lupo
335a1e56ec re-run black v23.10 on all .py files 2023-11-03 10:25:15 +00:00
Behdad Esfahbod
cb2f4c1a61 [Snippets/statShape] Pass glyphset to StatisticPen
Such that components can be resolved.
2023-10-19 12:28:09 -06:00
Nikolaus Waxweiler
d584daa8fd Blacken code 2022-12-13 11:26:36 +00:00
Behdad Esfahbod
d5a08b3b96 [Snippets/statShape] Handle empty shapes 2022-08-24 17:08:07 -06:00
Behdad Esfahbod
1500e35b1c [Snippets/statShape] Draw slant line 2022-08-24 16:32:09 -06:00
Behdad Esfahbod
baecd8850b [Snippets] Add statShape 2022-08-24 16:13:16 -06:00
Behdad Esfahbod
46be8fd9b7 [scale-upem] Move into fontTools.scaleUpem module 2022-08-17 14:54:40 -06:00
Behdad Esfahbod
adf6a67a7a [scale-upem] Add docstring 2022-08-17 14:16:45 -06:00
Behdad Esfahbod
033e811c8f [scale-upem] Add output message 2022-08-15 22:03:37 -06:00
Behdad Esfahbod
380ea83191 [print-json] Print GlyphOrder 2022-08-15 21:59:33 -06:00
Behdad Esfahbod
82b894c497 [print-json] Actually valid json now! 2022-08-15 21:44:13 -06:00
Behdad Esfahbod
f8e5ea4f95 [print-json] Towards valid json syntax 2022-08-15 21:37:23 -06:00
Behdad Esfahbod
dcff7a2d8b [Snippets/print-json.py] Add using the visitor module 2022-08-15 21:17:05 -06:00
Behdad Esfahbod
e2850886d9 [scale-upem] Err on CFF fonts 2022-08-15 14:30:04 -06:00
Behdad Esfahbod
4b472cbc3a [scale-upem] Implement vmtx 2022-08-15 14:27:15 -06:00
Behdad Esfahbod
6bac64ff9f [scale-upem] Implement vhea 2022-08-15 14:25:15 -06:00
Behdad Esfahbod
ec2919cc34 [scale-upem] Implement GDEF 2022-08-15 14:21:31 -06:00
Behdad Esfahbod
c588b2d5b3 [scale-upem] Scale GPOS using register_attrs as well 2022-08-15 14:19:26 -06:00
Behdad Esfahbod
3a6fa9812d [scale-upem] Implement ItemVariationStore 2022-08-15 14:09:13 -06:00
Behdad Esfahbod
f360cf92ec [Snippets/scale-upem] Implement gvar scaling 2022-08-15 14:03:42 -06:00
Behdad Esfahbod
ef1a009bea [visitor] Fix up attrs visiting 2022-08-15 13:59:05 -06:00
Behdad Esfahbod
24d63d068e [scale-upem] Take scale-factor from command-line 2022-08-15 13:36:28 -06:00
Behdad Esfahbod
f582469cb8 [visitor] Split TTVisitor into its own module 2022-08-15 13:01:46 -06:00
Behdad Esfahbod
61d651e387 [scale-upem] Implement kern table 2022-08-15 12:56:38 -06:00
Behdad Esfahbod
d9338ea539 [Snippets] Rename scale-font.py to scale-upem.py 2022-08-15 12:52:08 -06:00
Behdad Esfahbod
fcc4a875dd Rename visitor_test to Snippets/scale-font.py 2022-08-15 12:51:07 -06:00
Dave Crossland
1904041dc3
Update Snippets/README.md 2022-01-06 16:24:46 -05: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
Khaled Hosny
000bf81700 Default to "\n" for newlinestr instead of None
If newlinestr is None, os.linesep is used, bu it is the third millennium
and we don’t need or want different line endings per-platform.
2021-07-30 04:12:33 +02:00
Jany Belluz
016aa4cccc Add docstring to snippet 2021-07-05 17:28:44 +01:00
Jany Belluz
bba5e8b213 Add optional compaction of GPOS PairPos subtables in otlLib.optimize.gpos
See pull request: https://github.com/fonttools/fonttools/pull/2326

The new module `otlLib.optimize.gpos` provides `compact` functions that
can reduce the file size of GPOS PairPos lookups by splitting subtables
in a smart way to avoid storing zero-valued pairs.

The compaction methods are called from `otlLib.builder` and
`varLib.merger` so that static and variable fonts can benefit from the
optimization at compile time.

The new module `otlLib.optimize` is also executable, to allow running
the optimization on existing fonts.

The optimization is a trade-off because on the one hand it can reduce
significantly the byte size of the GPOS table (up to 50% in random
Google Fonts) but on the other hand it adds to the compilation time and
may make fonts very slightly bigger once compressed to WOFF2 (because
WOFF2 doesn't mind about zero values and compresses them very well).

As such, the optimization is off by default, and you can activate it by
providing the environment variable `FONTTOOLS_GPOS_COMPACT_MODE=5` for
example (values from 0 = off to 9 = max file size savings, but many more
subtables).
2021-07-05 17:28:43 +01: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
Cosimo Lupo
3ad201cbe5
Snippets/decompose-ttf: remove overlaps with skia-pathops 2020-07-23 11:19:45 +02:00
justvanrossum
39301b235a whitespace 2020-07-23 07:12:34 +02:00
justvanrossum
2bc53e75ad add hashbang and comment; add +x mode 2020-07-23 07:11:11 +02:00
justvanrossum
a95aace05e add snippet that shows how to decompose glyphs in a TTF 2020-07-23 07:07:01 +02:00
Zachary Scheuren
c88be61b1f In otf2ttf conversion update LSB in hmtx to match xMin 2020-04-06 09:46:20 -07:00
Cosimo Lupo
7d59ccbed6
Snippets/otf2ttf: use fontTools.pens.cu2quPen 2020-03-31 17:26:53 +01:00
ln_north
9a49b01ec1 fix requirements in svg2glif.py
- Remove unused `ufoLib` package
- FontTools => fontTools
2019-12-10 09:39:53 +09:00
Cosimo Lupo
cfc5b44c65
change all scripts' shebangs to use python3 2019-12-05 15:28:19 +00:00
Nikolaus Waxweiler
01328213c7 Remove __future__ imports 2019-08-09 12:20:13 +01:00
Cosimo Lupo
b324839eeb
Snippets: remove woff2_{,de}compress.py; superseded by fonttools ttLib.woff2 2019-06-14 18:30:33 +01:00
Cosimo Lupo
ba41877d10
Snippets/woff2_compress: add --hmtx-trasform option; use argparse 2019-06-13 18:07:14 +01:00
Cosimo Lupo
5d7e750b69
Snippets/woff2_compress: add --disable-transforms option 2019-06-11 15:13:09 +01:00
Cosimo Lupo
67fe931f15 Snippets/svg2glif: import internal copy of glifLib and pointPen modules 2019-02-22 11:08:40 +00:00
Chris Simpkins
1c0a55905b [Snippets] added usage documentation as a Markdown block in the notebook 2019-01-29 23:55:51 -05:00
Chris Simpkins
33b03e3edd [Snippets] add name-viewer.ipynb jupyter notebook 2019-01-29 23:30:49 -05:00