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
Cosimo Lupo
ae05b2a583
[logging] for runnable modules, spell out module name instead of using __name__
...
If a module is run as script, as in `python module.py` or when using
`runpy.run_module()`, then __name__ == "__main__".
So when we instantiate modules' loggers with `logging.getLogger(__name__)`,
those loggers' name may become "__main__" when run as scripts, and hence
fall outside of the "fontTools" logging namespace.
fontTools.configureLogger() by default only configures the "fontTools"
library loggers, anything outside of it (e.g. logger called "__main__")
is not attached a handler.
So here I name loggers explicitly instead of relying on __name__, but
only for modules which can be run as "__main__".
Fixes #801
2017-01-11 11:58:17 +00:00
Cosimo Lupo
ce609addd0
[ttx] add --newline option to explicitly control line endings
2016-10-20 17:22:12 +01:00
Cosimo Lupo
b1fae3fe32
ttx/ttLib: use from fontTools import version
as before
2016-10-10 15:26:04 +01:00
Cosimo Lupo
33fb81a282
[ttx] add --version option that prints fontTools.version.__version__
2016-09-27 00:40:33 +01:00
Cosimo Lupo
3c187c590a
[ttx] minor: don't suppress SystemExit on win32 platform
2016-03-30 14:56:40 +01:00
Cosimo Lupo
d8004de04c
[ttx] remove redundant continue
in parseOptions loop
...
`git blame` says that was my fault:
e5b6be00a0 (diff-fce6b83de86f2e83411202adc745ffb2R316)
Ouch.
2016-03-28 18:07:59 +02:00
Cosimo Lupo
94976c01a1
[ttx] add --with-zopfli option
2016-01-31 14:20:17 +00:00
Cosimo Lupo
e5b6be00a0
[ttx] replace print with logger; make -v and -q mutually exclusive; don't use deprecated 'verbose' and 'quiet' arguments
...
The default logger level for TTX is set to logging.INFO. Anything equal or above that level
will be logged. Anything below that will not.
If the -v option is passed, the threshold is lowered to logging.DEBUG.
If the -q option is passed, the threshold is increased to logging.WARNING.
2016-01-27 19:02:48 +00:00
Miguel Sousa
d1a1f1dc69
[ttx] minor addition to options' info
2016-01-24 18:42:41 -08:00
Miguel Sousa
a45a149b21
[ttx] don't print error when command is 'ttx -h'
2016-01-24 18:39:53 -08:00
Cosimo Lupo
e12aec52ed
ttx: use ljust to pad tags with space (more Pythonic)
...
as suggested by @adrientetar
2015-12-08 12:45:22 +00:00
Cosimo Lupo
79c2b8cbc1
ttx: pad tags with space if length is less than 4
...
so that you don't need to do `-t "CFF "` anymore.
Fixes https://github.com/behdad/fonttools/issues/265
2015-12-08 10:11:26 +00:00
Cosimo Lupo
e5b67b2451
[ttx] raise GetoptError and print messages to sys.stderr
2015-09-09 13:13:17 +01:00
Cosimo Lupo
27e31e7e22
[ttx] add --flavor option for compiling to 'woff' or 'woff2'
2015-09-09 13:00:35 +01:00
Cosimo Lupo
867ad325bf
[ttx] add support for dumping WOFF2 fonts to TTX
2015-08-07 18:23:41 +01:00
Cosimo Lupo
7fffdb8815
[ttx] don't create output file if action is 'ttList'
2015-06-23 11:15:56 +01:00
Behdad Esfahbod
a7e1524d2a
Merge pull request #278 from anthrotype/timestamp
...
[ttx] use TTX mtime for 'modified' (default), optionally "--recalc-timestamp"
2015-06-16 15:12:12 -07:00
Cosimo Lupo
eae49fd67c
[ttx] use TTX file modification time for the font 'modified' (default)
2015-06-16 22:44:57 +01:00
Behdad Esfahbod
82b19a0d08
Merge pull request #279 from anthrotype/racecondition
...
[ttx] 'touch' output file to avoid race condition in choosing file names
2015-06-15 15:36:30 -07:00
Cosimo Lupo
1d510c61a2
[ttx] 'touch' output file to avoid race condition in choosing file names
...
Fixes https://github.com/behdad/fonttools/issues/45
2015-06-13 22:42:10 +01:00
Cosimo Lupo
291b41a13c
[ttx] add option to provide custom UnicodeData.txt
...
Fixes https://github.com/behdad/fonttools/issues/82
2015-05-23 18:56:33 +01:00
Cosimo Lupo
175a16209c
[setup.py] use setuptools if available, or fall back to distutils
...
modify scripts to work as setuptools 'console_scripts', where the main
function takes no arguments;
add empty identifier "" in 'packages' argument of setup, to install the
standalone sstruct.py and xmlWriter.py for legacy support;
remove py2exe since it is made redundant by setuptools 'console_scripts';
remove custom 'build_ext' command since the eexecOpmodule.c is no longer
present.
2015-05-20 11:02:43 +01:00
Behdad Esfahbod
b30e12ae00
More whitespace
2015-04-26 02:01:01 -04:00
Behdad Esfahbod
9d37988235
Make makeOutputFilename's overwrite argument optional
...
6d7f3bf840 (commitcomment-10807720)
2015-04-20 11:50:37 -07:00
schriftgestalt
6d7f3bf840
[ttx] Add -f option to overwrite output file(s)
...
Fixes https://github.com/behdad/fonttools/pull/208
2015-04-16 17:55:22 -07:00
Behdad Esfahbod
bfe99090ba
Fix reading XML for CBLC with external image files
2014-08-19 12:40:12 -04:00
Roozbeh Pournader
365b0bfce1
Add support for dumping XMLs to the standard output.
2014-06-27 15:03:32 -04:00
Behdad Esfahbod
1ae29591ef
from __future__ import absolute_import
...
Such that our Python 2 is closer to Python 3.
Part of https://github.com/behdad/fonttools/issues/77
2014-01-14 15:07:50 +08:00
Behdad Esfahbod
95f795f40a
Move offset overflow fixing logic where it belongs
2013-12-20 21:52:28 -05:00
Behdad Esfahbod
283fb26820
By default, don't load fonts lazily
...
Lazy loading has implications on how people use objects.
So, by default, don't load lazily. This only affects
GSUB/GDEF/GPOS/etc and is closer to what fonttools used
to do traditionally.
Turn lazy loading on in subset and inspect.
2013-12-16 00:52:29 -05:00
Behdad Esfahbod
9e6ef94b55
Use "is None" instead of "== None"
...
The latter hits the __eq__ method and can fail because we now
do not allow comparing objects of different types.
For example, was failing subsetting Andika-R.ttf.
2013-12-04 16:35:10 -05:00
Behdad Esfahbod
153ec40209
Fix a few pychecker warnings
...
Fixes https://github.com/behdad/fonttools/issues/58
2013-12-04 01:15:46 -05:00
Behdad Esfahbod
e388db566b
py23 Use new-style classes
...
Such that we get the same semantics in both Python 2 and 3.
2013-11-28 18:53:30 -05:00
Behdad Esfahbod
c076261598
s/latin-1/latin1/g
2013-11-28 17:32:44 -05:00
Behdad Esfahbod
5f6418d9e1
py23 Turn Unicode XML parsing on; more bytes fixes
2013-11-28 17:32:43 -05:00
Behdad Esfahbod
32c10eecff
py23 from __future__ import division and adjust divisions
2013-11-28 17:32:42 -05:00
Behdad Esfahbod
30e691edd0
py23 from __future__ import print_function
2013-11-27 17:27:45 -05:00
Behdad Esfahbod
ac4672e451
py23 Introduce Tag to autoconvert tag types
2013-11-27 16:44:53 -05:00
Behdad Esfahbod
7ed91eca1e
py23 import in all nontrivial source files and unused import cleanup
2013-11-27 15:25:00 -05:00
Behdad Esfahbod
14fb031125
Remove most uses of module string
2013-11-27 14:01:44 -05:00
Behdad Esfahbod
223273f792
2to3 --fix=except
2013-11-27 14:01:37 -05:00
Behdad Esfahbod
3ec6a25823
2to3 --fix=print with manual fixup
2013-11-27 04:57:33 -05:00
Behdad Esfahbod
ac1b435946
2to3 --fix=idioms
2013-11-27 04:15:34 -05:00
Behdad Esfahbod
7cc6d271ac
2to3 --fix=long with manual cleanup
2013-11-27 04:00:15 -05:00
Behdad Esfahbod
ecbe4c87b5
2to3 --fix=numliterals with manual cleanup
2013-11-27 03:37:29 -05:00
Behdad Esfahbod
8c35239853
Support ./ttx'ing woff files
...
Doesn't dump woff metadata/private sections yet.
2013-11-26 12:58:28 -05:00
Behdad Esfahbod
5f875e76d6
Merge pull request #28 from olivierberten/ttc
...
Catch TTLibError raised when missing (or wrong) -y argument on a ttc file
2013-11-25 04:44:04 -08:00
Behdad Esfahbod
188f2a398a
Default to non-lazy for ttx
2013-11-24 19:04:25 -05:00
Behdad Esfahbod
38fdae6342
Use True/False instead of 1/0
2013-11-24 18:49:35 -05:00