2497 Commits

Author SHA1 Message Date
Sascha Brawer
edb1ed0fcc [feaLib] Synthesize alternate substitutions for feature aalt
After this change, feaLib synthesizes the same lookups as makeotf v2.0.90
for `feature aalt` in the example of section 8.a of the OpenType Feature
File specification.
2016-02-03 15:17:37 +01:00
Sascha Brawer
bf79ceb2f2 [feaLib] Disallow lookup blocks inside feature aalt
The new behavior matches how makeotf v2.0.90 interprets
the OpenType Feature File Specification.
2016-02-03 11:39:50 +01:00
Cosimo Lupo
f998cf1126 [ttLib] use boolean instead of int
I know it's same, but this looks more 'pythonic'
2016-02-02 18:26:50 +00:00
Cosimo Lupo
84d6f076a3 [ttLib] call XMLWriter.close() only if 'fileOrPath' is a path, not when it's a file
This allows to call `TTFont.saveXML` with an already open file/stream (e.g. sys.stdout or a StringIO) without it being abruptly closed at the end.

We do the same elsewhere when we reiceive file handles instead of path names, so we might do it here too.
2016-02-02 18:25:43 +00:00
Sascha Brawer
faeba0c0c0 [feaLib] Support lookups with mixed glyph/class-based kerning
Resolves https://github.com/behdad/fonttools/issues/456
2016-02-02 18:24:48 +01:00
Cosimo Lupo
14e1389d84 Merge pull request #500 from davelab6/patch-1
otBase.py log level adjustment
2016-02-02 15:11:48 +00:00
Dave Crossland
17007a36d6 otBase.py log level adjustment
Change log level of 'Attempting to fix OTLOffsetOverflowError' from warning to debug to close #499
2016-02-02 10:06:10 -05:00
Sascha Brawer
c64019b3c6 [otlLib] Move building of class-based PairPos sutables from feaLib to otlLib 2016-02-02 15:17:01 +01:00
Sascha Brawer
f9e859c213 [otlLib] Move helper for building ClassDef tables from feaLib to otlLib 2016-02-02 10:48:47 +01:00
Sascha Brawer
0f609592bb [otlLib] Build multiple glyph-based PairPos subtables when needed
Before this change, feaLib would group glyph-based pair positionings
by value formats. After this change, this logic happens in otlLib.
But clients can still do their own grouping if they wish, by calling
the buildPairPosGlyphsSubtable() method directly.
2016-02-02 10:30:33 +01:00
Sascha Brawer
5095aa9ecf [otlLib] Move building of glyph-based PairPos subtables from feaLib to otlLib 2016-02-02 09:35:31 +01:00
Behdad Esfahbod
b6a78d5664 Simplify fix for https://github.com/behdad/fonttools/pull/498 2016-02-02 11:52:24 +08:00
Cosimo Lupo
b28c63645c Merge pull request #498 from anthrotype/tofu-cmap
[O_S_2f_2] skip updateFirstAndLastCharIndex if cmap table class is DefaultTable
2016-02-01 22:06:36 +00:00
Cosimo Lupo
ed29a07670 [O_S_2f_2] skip updateFirstAndLastCharIndex if cmap table class is DefaultTable
Fixes https://github.com/behdad/fonttools/issues/497
2016-02-01 18:04:39 +00:00
Sascha Brawer
4ee17824e1 [feaLib] Use global scope for glyph classes; allow re-definitions
Resolves https://github.com/behdad/fonttools/issues/496
2016-02-01 18:29:41 +01:00
Sascha Brawer
befce507a8 [feaLib] Use global scope for lookup names
Resolves https://github.com/behdad/fonttools/issues/461
2016-02-01 14:39:32 +01:00
Cosimo Lupo
c4d2ebca66 remove deprecated use of 'quiet' option in test modules 2016-02-01 13:39:39 +00:00
Cosimo Lupo
f65a6ec346 [loggingTools] remove _StderrHandler and Logger classes (moved to py23) 2016-02-01 13:18:06 +00:00
Cosimo Lupo
52620787d8 [py23] set the lastResort handler and custom logger class only for python 2
move _StderrHandler and _Logger classes here (previously defined in loggingTools)
2016-02-01 13:17:15 +00:00
Cosimo Lupo
c2d0f5fb0a [fontTools.__init__] remove setLoggerClass (will move it to py23 module) 2016-02-01 13:06:29 +00:00
Cosimo Lupo
0afcef8c87 Merge pull request #494 from anthrotype/t2-fixed
[psCharStrings] use fixedToFloat to use the shortest decimal representation
2016-02-01 11:37:52 +00:00
Cosimo Lupo
bfe330e0a6 [psCharStrings] use fixedToFloat to use the shortest decimal reprentation
Fixes https://github.com/behdad/fonttools/issues/492
2016-02-01 10:52:33 +00:00
Cosimo Lupo
e40dffd86d [_c_m_a_p] don't set self.data = headerdata + data inside cmap_format_14.compile
self.data is usually set by decompileHeader as "the data after the header"; while here
it also included `headerdata`. This produced corrupt data if the compile method was called
again, as the header data is added again to self.data.

Moreover, in none of the subtable classes' `compile` methods, the re-compiled data is
stored in self.data, so we shall not do that for format 14 either.

Fixes #389
2016-01-31 21:00:11 +00:00
Cosimo Lupo
e1ce85a463 Merge pull request #493 from anthrotype/zopfli
add --with-zopfli option to pyftsubset and ttx
2016-01-31 14:50:21 +00:00
Cosimo Lupo
7ac65613eb [subset] add --with-zopfli option; set 'canonical_order' to None
'canonical_order' default value was set to False in the subsetter. However,
the meaning of the related 'reorderTables' argument in TTFont.save method has changed
with commit 6ba67ab699d62962690a7a523c286ebf0c8b0ae4.
When the latter is set to False, the original input font's table order is "kept": which
still means doing some sort of reordering. If one wishes to avoid any kind of reordering,
reorderTables needs to be set to None.
2016-01-31 14:50:04 +00:00
Cosimo Lupo
94976c01a1 [ttx] add --with-zopfli option 2016-01-31 14:20:17 +00:00
Cosimo Lupo
7fafe1f9a7 [sfnt] add compress function to optionally use zopfli instead of zlib 2016-01-31 14:20:17 +00:00
Cosimo Lupo
090fd5f5f0 Merge pull request #483 from anthrotype/logging
implement logging
2016-01-29 19:01:14 +00:00
Cosimo Lupo
6eac5d05c0 [fontTools.__init__] use 'lastResort' handler instead of NullHandler
I think it's better to follow the current Python 3 behavior in the situation
where the user doesn't provide any explicit logging configuration.

Before Python 3.2, when no handlers were found when a logging event occurred,
either the events would be silently dropped (if logging.raiseExceptions is
set to False), or it would throw a single "No handlers could be found" warning
(this was the default behavior).

With Python 3.2 and later, the default behavior is that the events are output
using a "handler of last resort". The latter works like StreamHandler
that writes messages (without formatting) to the current value of sys.stderr
(thus respecting any redirections which may be in effect).
2016-01-29 18:44:43 +00:00
Cosimo Lupo
f3116ad4d0 [loggingTools] add Logger class with support for 'lastResort' stderr handler
Both _StderrHandler and Logger.callHandlers included here are taken from Python 3.5's
logging.py source.

I only set logging.lastResort if it's not already set (i.e. for Python < 3.2).
2016-01-29 18:36:21 +00:00
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