30 Commits

Author SHA1 Message Date
Khaled Hosny
cf08265cd5 Black 2024-02-06 15:47:35 +02:00
Nikolaus Waxweiler
d584daa8fd Blacken code 2022-12-13 11:26:36 +00: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
Nikolaus Waxweiler
68a5ceac6d varLib: Remove py23 imports 2019-08-10 15:39:02 +01:00
Nikolaus Waxweiler
01328213c7 Remove __future__ imports 2019-08-09 12:20:13 +01:00
Cosimo Lupo
4001ded199
override SFNTReader __deepcopy__ for 'file' isn't copyable; use it in varLib 2018-12-20 14:18:59 +00:00
Cosimo Lupo
9b4509496f
interpolate_layout: allow to pass DesignSpaceDocument as input, like varLib.build 2018-12-20 13:00:45 +00:00
Behdad Esfahbod
bba0dfc769 [varLib] TODO 2018-11-08 23:35:21 -05:00
Cosimo Lupo
26ddbcfe46
varLib: return a namedtuple from load_designspace
so we can also return the list of parsed rule elements
2018-09-12 19:16:13 +02:00
Cosimo Lupo
8080690c74
interpolate_layout: use DesignSpaceDocument instead of varLib.designspace 2018-09-11 18:33:07 +02:00
Behdad Esfahbod
c96f83cc30 [varLib.interpolate_layout] Allow disabling avar mapping
See https://github.com/fonttools/fonttools/issues/950#issuecomment-303641054
2017-05-24 00:26:35 -07:00
Behdad Esfahbod
0ed2df3f22 [varLib.interpolate_layout] Import designspace-loading logic from varLib
When varLib was updated for avar table, this was not.  Share code such
that they don't get out of sync again.  All of this to be made into
proper API some time...
2017-05-22 19:40:20 -07:00
Behdad Esfahbod
245d457fe6 [varLib.interpolate_layout] Change finder to master_finder
To be in line with varLib.build().
2017-05-22 18:46:41 -07:00
Miguel Sousa
3dc8e4fa95 minor change 2017-02-28 05:16:15 -08:00
Cosimo Lupo
ca95a07f24
[interpolate_layout] handle optional 'axes' item; require 'sources'
remove 'instances' as it's not used
2017-02-27 19:44:54 +00:00
Miguel Sousa
f061231049 [varLib] Make designspace.load() return a dictionary instead of a tuple 2017-02-26 07:49:44 -08:00
Miguel Sousa
43efa63732 [varLib] Build axes according to ’axes’ element in designspace file 2017-02-25 20:53:48 -08:00
ReadRoberts
33177bf65b If the design space file uses an <axes> element, use this to define the axis map, and preserve the axis order. 2017-02-22 21:22:34 -08:00
Cosimo Lupo
3717dc6549
[varLib.merger] set initializer for reduce() to handle empty sequences; import reduce from functools for py3
When reduce() receives an empty sequence, it raises TypeError, unless it is given a third 'initializer' argument

ValueFormat values should default to 0, so we shall use that as initializer.

Also, the reduce() built-in is no longer available on Python 3.
It's still accessible for both py2 and py3 from functools.

Fixes https://github.com/googlei18n/fontmake/issues/241
2017-01-30 16:51:41 +00:00
Behdad Esfahbod
5e1be9e5e7 [varLib] Move code around 2017-01-25 20:11:35 -08:00
Behdad Esfahbod
1631c5c941 [varLib.interpolate_layout] Implement flattening of multiple PairPosFormat1 subtables
Also fixes issues with merging of PairPos.

Trying on Noto Sans Thai still fails, now because of issues in class differences in
PairPosFormat2. :(  Investigating.

This is part of fixing https://github.com/fonttools/fonttools/issues/719
though, the changes are currently in interpolate_layout, and need to be ported /
merged with varLib.__init__ variation-font-builder.
2017-01-18 18:42:45 -08:00
Behdad Esfahbod
d38ecf02ec [varLib] Minor 2017-01-18 18:42:45 -08:00
Cosimo Lupo
2e2125f173
[minor] remove redundant sys import 2017-01-11 12:24:04 +00:00
Cosimo Lupo
b7bb391033
don't use sys.exit(...) inside main(), but only under if __name__ == "__main__"
The convention is that sys.exit(...) is called only if a module is run as a script,
and that main() entry points use return statements to report exit codes: 0 (or None)
for successful execution, or any non-zero integer for errors.

E.g. see the console scripts generated when installing with pip.
2017-01-11 12:10:58 +00:00
Behdad Esfahbod
ea958e72e4 [varLib] Implement effective-kern-pair from PairPosFormat2 2016-10-23 14:09:49 +02:00
Behdad Esfahbod
b563e6673c [varLib] Implement GPOS binary interpolation for PairPosFormat1 2016-10-22 22:47:18 +02:00
Behdad Esfahbod
b39772b256 [varLib] Fix interpolate_layout for non-similar SinglePos
Has to be ported to varfont merger as well.
2016-10-12 16:11:20 -07:00
James Godfrey-Kittle
1e8e17e753 [varLib] Define an interpolate_layout method 2016-10-06 17:33:07 -07:00
James Godfrey-Kittle
6f6106ef6c [varLib] Rename interpolate-layout to be loadable 2016-10-06 17:32:37 -07:00