2517 Commits

Author SHA1 Message Date
Cosimo Lupo
141cc7b6c2 [loggingTools] typo 2016-01-29 17:28:53 +00:00
Cosimo Lupo
3664462a63 [loggingTools] use ellipsis for elapsed time in doctestes to fix AppVeyor build
https://ci.appveyor.com/project/anthrotype/fonttools/build/1.0.53/job/2p08d9sbcfelvwx6
2016-01-27 19:05:05 +00:00
Cosimo Lupo
e8edfad59a [loggingTools] on Windows, warnings.warn doesn't like category=None, set it to UserWarning (which is the default) 2016-01-27 19:05:05 +00:00
Cosimo Lupo
6544482d92 [merge] remove custom Logger and use logging instead
this follows the same changes applied to subset.py module in d03ce32
2016-01-27 19:05:05 +00:00
Cosimo Lupo
c5febaf1a5 [subset] remove custom Logger and use logging instead
The Subsetter class now uses a module-level 'log', and no longer uses
its own custom Logger. This has been removed, and its features replaced
by equivalents.

log.lapse() are replaced with Timer context manager/decorator (these should make clearer where the elapsed time starts/stops);

log.glyphs() is kept for convenience: it is bound dynamically to the logger instance instead of subclassing logging.Logger, as it's only
useful in here.

log.font() is replaced by `font.saveXML(sys.stdout)`.

A distinct sub-logger is configured for timing messages, to allow --timing option to be enabled independently from --verbose
2016-01-27 19:05:05 +00:00
Cosimo Lupo
3d8b498ad1 [Snippets/interpolate] replace warnings with logging
Here I use logging.basicConfig to configure the root logger, and hence all the other loggers,
including fontTools'.

I could have used fontTools.configLogger as well (and get predefined formatter, etc.), but wanted
to show that one can also configure the fontTools logger using the built-in logging configuration
functions (e.g. basicConfig, config.dictConfig and config.fileConfig).
2016-01-27 19:02:48 +00:00
Cosimo Lupo
b62f550952 [mtiLib] replace print with logger
inside main(), I just do a basic config for the library logger, but keep
the debug messages from mtiLib turned off.
2016-01-27 19:02:48 +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
Cosimo Lupo
b6145de7cb [psLib] replace print with logger 2016-01-27 19:02:48 +00:00
Cosimo Lupo
e4f0f3ec30 [psCharStrings] replace print with logger 2016-01-27 19:02:48 +00:00
Cosimo Lupo
e68e7332a4 [cffLib] replace print with logger (but keep debug messages off)
All these debug messages were disabled, and I don't wish to re-enable them
while running TTX in verbose mode. So here I use a custom level less than
logging.DEBUGm to make sure they will be muted even when the logger's level
is equal to logging.DEBUG.
2016-01-27 19:02:48 +00:00
Cosimo Lupo
48db539c44 [ttProgram] replace print with logger 2016-01-27 19:02:48 +00:00
Cosimo Lupo
af91f9e791 [otTables] replace warnings with logger 2016-01-27 19:02:48 +00:00
Cosimo Lupo
6f8e1502ff [otConverters] replace print with logger 2016-01-27 19:02:48 +00:00
Cosimo Lupo
10bf8ecd85 [otBase] replace print with logger 2016-01-27 19:02:48 +00:00
Cosimo Lupo
2b30dc2134 [_n_a_m_e] replace print with logger 2016-01-27 19:02:48 +00:00
Cosimo Lupo
0ce31f7b0a [_l_o_c_a] replace warnings with logger 2016-01-27 19:02:48 +00:00
Cosimo Lupo
7d36de99ef [_k_e_r_n] replace warnings with logger 2016-01-27 19:02:48 +00:00
Cosimo Lupo
abe3202412 [_h_m_t_x] replace warnings with logger 2016-01-27 19:02:48 +00:00
Cosimo Lupo
f85e2f295d [_h_e_a_d] replace warnings with logger 2016-01-27 19:02:48 +00:00
Cosimo Lupo
dff078ed51 [_g_l_y_f] replace print and warnings with logger 2016-01-27 19:02:48 +00:00
Cosimo Lupo
ff853c38b8 [_c_m_a_p] replace print with logger 2016-01-27 19:02:48 +00:00
Cosimo Lupo
77658c952f [_a_v_a_r_test] use StringIO to capture logger's output in test case 2016-01-27 19:02:48 +00:00
Cosimo Lupo
9b21ea6a09 [_a_v_a_r] replace warnings with logger 2016-01-27 19:02:48 +00:00
Cosimo Lupo
c5659b28a2 [S_V_G_] replace print with logger 2016-01-27 19:02:48 +00:00
Cosimo Lupo
e46be4d7d6 [O_S_2f_2] replace print with logger 2016-01-27 19:02:48 +00:00
Cosimo Lupo
7d67e9c257 [E_B_L_C_] replace print with logger 2016-01-27 19:01:12 +00:00
Cosimo Lupo
74cb889f4e [E_B_D_T_] replace print with logger 2016-01-27 19:01:12 +00:00
Cosimo Lupo
85f9f442ea [BitmapGlyphMetrics] replace print with logger 2016-01-27 19:01:12 +00:00
Cosimo Lupo
6a92ae085b [woff2] replace print with logger 2016-01-27 19:01:12 +00:00
Cosimo Lupo
967b994449 [sfnt] replace print with logger 2016-01-27 19:01:12 +00:00
Cosimo Lupo
de5dca010b [xmlReader] replace print with logger; deprecate 'quiet' argument 2016-01-27 19:01:12 +00:00
Cosimo Lupo
769efc3d0d [ttLib] replace print statements with logger; deprecate 'quiet' and 'verbose' arguments; deprecate 'debugmsg' func
Previously, when TTX was run in verbose mode, the messages printed to the console would also show the time
each one was logged -- e.g. "blah blah  (15:23:24)" -- using the 'debugmsg' function which is defined here.
Even though the logging package would allow to do the same thing (via 'datefmt' and "%(asctime)s"), I decided
drop this, as I think it's not very interesting...
I'll replace it with the overall elapsed time in seconds, in a follow-up commit.
2016-01-27 19:01:12 +00:00
Cosimo Lupo
0c313bc1d2 [fontTools.__init__] export 'configLogger' in the top-level module to make it easier for clients to import 2016-01-27 19:01:12 +00:00
Cosimo Lupo
1034699a21 [fontTools.__init__] add NullHandler to avoid "no handlers could be found" error. 2016-01-27 19:01:12 +00:00
Cosimo Lupo
317d653125 [loggingTools] module containing tools for adapting the Python logging package to fontTools (and viceversa) 2016-01-27 19:01:12 +00:00
Cosimo Lupo
58601f2218 Merge pull request #267 from anthrotype/uniranges3_merge
[subset] add option to prune unused ulUnicodeRange bits
2016-01-27 19:00:35 +00:00
Cosimo Lupo
ce5d230eef [subset] add --prune-unicode-ranges option (enabled by default) 2016-01-27 18:38:32 +00:00
Cosimo Lupo
328c72f2d8 [OS/2 test] add tests for getUnicodeRanges, setUnicodeRanges and recalcUnicodeRanges 2016-01-27 18:38:32 +00:00
Cosimo Lupo
20d7849697 [OS/2] add Unicode ranges data from OT spec, plus methods to get/set bits manually, or recalc/prune automatically 2016-01-27 18:37:29 +00:00
Cosimo Lupo
e042824b83 Merge pull request #489 from anthrotype/use-open
replace codecs.open with py23.open
2016-01-26 16:22:47 +00:00
Cosimo Lupo
f99a09fdbe [mtiLib] import unicode_literals; use py23.open with utf-8 encoding 2016-01-26 15:45:32 +00:00
Cosimo Lupo
ac56990aad replace all uses of codecs.open with py23.open 2016-01-26 15:45:27 +00:00
Cosimo Lupo
ce15331f6d Merge pull request #488 from anthrotype/io-open
[py23] add wrapper for io.open
2016-01-26 14:44:44 +00:00
Cosimo Lupo
6832b56385 Merge pull request #486 from anthrotype/lazy-file-load
[ttLib] don't load whole input file in memory if 'lazy' is True
2016-01-26 14:39:28 +00:00
Sascha Brawer
ab8f9ee785 [feaLib] Add test case for bug 463
https://github.com/behdad/fonttools/issues/463
2016-01-26 12:45:56 +01:00
Sascha Brawer
6dcddd9e36 [feaLib] Compile test files to binary tables in addition to XML
https://github.com/behdad/fonttools/issues/463
2016-01-26 12:39:41 +01:00
Sascha Brawer
b2e663a1fc [feaLib] Compile lookups after assigning lookup indices
Before this change, feaLib had assigned a lookup index at the same
time as compiling each lookup. For chains, the implicit assumption was
that the chain's targets would always come before the contexual chain.
Normally this was indeed the case, but feaLib (and also makeotf)
sometimes merge several chain targets into one single lookup,
and then this assumption was not true anymore.

In the new version, the lookups get compiled in a separate pass,
after assigning lookup indices.

https://github.com/behdad/fonttools/issues/463
2016-01-26 12:09:52 +01:00
Sascha Brawer
f5af1cf682 [feaLib] Minor: Remove obsolete import statement 2016-01-25 19:46:02 +01:00
Cosimo Lupo
3a537be111 [run-test.sh] fix an issue when calling sys.executable with subprocess in py23_test.py 2016-01-25 18:25:07 +00:00