119 Commits

Author SHA1 Message Date
Cosimo Lupo
6c6373a0a4
error if no -o option provided when reading input from stdin
since we can't make up an output filename in that case
2023-03-03 16:51:33 +00:00
Cosimo Lupo
15b450e4a6
[ttx] support reading font/xml file from standard input as '-'
Fixes https://github.com/fonttools/fonttools/issues/3019
2023-03-03 14:13:06 +00:00
Nikolaus Waxweiler
d584daa8fd Blacken code 2022-12-13 11:26:36 +00:00
Cosimo Lupo
7c38f3d393 remove waitForKeyPress on windows
One should just use 'pause' command in a batch script wait to for key press, no need for ttx to do anything.

Fixes #2507
2022-01-19 16:40:03 +00:00
Simon Cozens
0f03e6529a
[docs] Fix sphinx warnings (#2453)
* Add default auto doc options

* Ensure all references are unique

* Use anonymous links to avoid duplicate references

* Remove default options, fix wrong module name

* Don’t index repeated class

* Remove repeated classes included through automodule

* Fix warnings

* We don’t use our own static directory

* Correctly format XML in docs

* Fix indentation

* Fix overline

* Bring TOC to top

* Fix definition list

* Offset definition lists and examples

* Fix erroneous markup

* Fix markup

* Already included in automodule

* Fix args markup

* Correct markup for example

* Don’t reindex repeated module

* Correct XML code block markup

* Fix markup errors, change example to doctest

* Correct list markup

* Make ttx docstring both valid RST and valid help output

* Various other boring markup fixes

* Fix example indenting

* Make docstring valid RST and valid help output

* Mock import for reportlab

* It’s ok if manual links don’t appear in toctrees

* Oops typo, I guess doctests are useful
2021-12-02 15:31:49 +00:00
Behdad Esfahbod
d867397532 Remove residual allowVID stuff
Part of https://github.com/fonttools/fonttools/pull/2398
2021-08-25 15:55:17 -06: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
Cosimo Lupo
01b0180ce1 Revert "Deprecate and ignore ttx’s --newline option"
This reverts commit 3042f129fc6012bd96668831b18d0926c634f7df.
2021-08-03 10:00:01 +02:00
Khaled Hosny
3042f129fc Deprecate and ignore ttx’s --newline option 2021-07-30 04:48:11 +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
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
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
01328213c7 Remove __future__ imports 2019-08-09 12:20:13 +01:00
Cosimo Lupo
7a2fea9843
[ttx] should also white-list 'no-recalc-timestamp' for getopt to work
aargh..

Follow up from #1455
2019-01-17 15:02:01 +00:00
Cosimo Lupo
0e47ea1fac
[ttx] add --no-recalc-timestamp option to keep original head.modified
Fixes #46
2019-01-17 13:26:59 +00:00
Mickaël Schoentgen
52e855e4a4 Use the 'with' context manager when dealing with files 2018-10-01 08:42:45 +02:00
Chris Simpkins
267d314233 [ttx] remove unreachable code 2018-05-21 23:50:26 -04:00
Bill Amidei
abed27fd8c
Update for UFO naming of glyph files and make -g ttx parameter force -s 2018-02-28 11:29:33 +00:00
Cosimo Lupo
232e2b8467
Revert "Merge pull request #1130 from anthrotype/temp-revert-split-glyphs"
This reverts commit 060f856f92e0fb2d8e60f6be080c89c08528bacb, reversing
changes made to 1e42224af741fac73e20f7193d8115cfda7d3594.
2018-02-28 11:24:19 +00:00
justvanrossum
ce639f0064 increase the width of the length and offset fields by one, to accommodate sizes and offsets in the 10s of megabytes. 2018-02-13 11:21:16 -08:00
Cosimo Lupo
56a84ae905 Temporarily revert PR #1035 bamidei/split_g_l_y_f_to_one_per_file
The split-glyf-to-one-glyph-per-file feature is only partially implemented,
as it was discussed here:

https://github.com/fonttools/fonttools/issues/153#issuecomment-346677171

I need to cut a bugfix release today, but I don't want to ship this as is.
I prefer to temporarily rever, tag a release from master branch, then
revert it again to its present state so that bamidei can complete his
work.

---

Revert "[glyf] make splitGlyphs output more compact"

This reverts commit d08d635a93289982b028aacd3b9039fbe742f3e8.

Revert "more whitespace"

This reverts commit bd030f61c6b360fd360632bbc6c19abb057c9a24.

Revert "minor whitespace"

This reverts commit f2a8c787b13b92ae0e0f61477e584316144747c7.

Revert "Merge pull request #1035 from bamidei/split_g_l_y_f_to_one_per_file"

This reverts commit 17b89d9dde7691dbbb6815efba92eff446af62ac, reversing
changes made to b8482d9666f08d3603ee93d3ca52931550f715fc.
2017-12-18 12:00:43 +00:00
Cosimo Lupo
f2a8c787b1 minor whitespace 2017-11-23 18:39:11 +01:00
Bill Amidei
feb4c0d2ed Another white-space update to align 2017-11-23 07:53:07 -08:00
Bill Amidei
818a4a2d1e Review comment update: Updated white-space and removed unused test data 2017-11-23 07:51:05 -08:00
Bill Amidei
b5edc7e9f5 Add ability to split glyphs to 1 glyph per ttx file. Addresses Issue #153 2017-08-23 12:33:25 -07:00
Cosimo Lupo
ae89c0d5ca [ttx] drop the 'n' from "an TTX" 2017-07-25 20:35:55 +01:00
Cosimo Lupo
2d9ca0b2bd [ttx] remove mention to otf2ttf.py Snippet from help message
https://github.com/fonttools/fonttools/pull/1016#issuecomment-317847536
2017-07-25 20:33:41 +01:00
Dave Crossland
32fa8bc86b ttx.py Clarify help text
Confusion reported at https://groups.google.com/forum/#!topic/fonttools/7ocZWHbsCLw
2017-07-25 11:16:47 -04:00
justvanrossum
a785f72367 Applying the super useful padding of short table tags such as 'CFF' to the '-x' option, too. 2017-06-07 11:47:11 +02:00
Miguel Sousa
ddf9f2334b [ttx] unnecessary lower()
Valid XML files always start with a lowercase declaration
187b886fde (commitcomment-21508520)
2017-03-28 03:43:01 -07:00
Miguel Sousa
fefe5d5c46 [ttx] Strip the BOM only in XML files 2017-03-28 03:43:01 -07:00
Miguel Sousa
076e2ba33a [ttx] Close file before returning, to prevent ResourceWarnings in py3 2017-03-28 03:43:01 -07:00
Miguel Sousa
4fce7a0b7b [ttx] Strip BOM from beginning of file
Fixes #896
2017-03-28 03:43:01 -07:00
Cosimo Lupo
46d487c728
the Zopfli bindings are finally available from PyPI, change url in the docstring 2017-03-01 14:01:15 +00:00
Cosimo Lupo
ee4f4695e6
[ttx] ignore missing 'head' if no --recalc-timestamp option is passed 2017-02-28 22:54:30 +00:00
Cosimo Lupo
8af488a1b3
Revert "explicitly require 'head' table in TTFont.save()"
This reverts commit b39f3b613c861539f9ae6e18f5064979f7ad6365.

Requiring 'head' makes it hard to build partial fonts

See https://github.com/fonttools/fonttools/pull/854#issuecomment-283177719
2017-02-28 22:48:28 +00:00
Cosimo Lupo
b39f3b613c
explicitly require 'head' table in TTFont.save()
it's implicitly required anyway, e.g. by ttx's ttCompile, maxp's recalc, OS/2 compile, etc.
2017-02-21 12:57:34 +00:00
Cosimo Lupo
ff247f9be4
[ttx] fix typo in --help 2017-01-18 12:01:32 +00:00
Cosimo Lupo
a0e74f7e69
move ttx.makeOutputFileName to new misc.cliTools module
so it can be reused for other console scripts
2017-01-13 11:16:01 +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
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