105 Commits

Author SHA1 Message Date
Simon Cozens
46c8f90da8 Use _ to denoted unused loop variable 2020-05-07 21:00:28 +01:00
Khaled Hosny
af42fc24b7 [merge] Handle duplicate glyph names better
Instead of appending font index to all glyph names and still potentially
have duplicates, use similar code like we use and “post” and “CFF”
tables to handle duplicate glyph names.
2019-09-19 09:51:08 +02:00
Nikolaus Waxweiler
01328213c7 Remove __future__ imports 2019-08-09 12:20:13 +01:00
Cosimo Lupo
242ad6279d [merge] don't drop platformID=0 Unicode cmap subtables
instead treat them as equivalent to platformID=3 Windows Unicode subtables
2019-03-12 13:13:15 +00:00
Cosimo Lupo
2c3c74f108 [merge] support merging vhea table (same as hhea) 2019-03-12 12:26:54 +00:00
Cosimo Lupo
135a4a1914
[merge] Fix AssertionError when all DefaultLangSys offsets are NULL
Fixes https://github.com/fonttools/fonttools/issues/1408#issuecomment-447316250
2018-12-17 13:30:47 +00:00
Cosimo Lupo
6deeb70acb
Revert "Merge pull request #1289 from BlackFoundry/master"
This reverts commit 492c8cef106dbcc0b8154bcc969b77777906b009, reversing
changes made to 4bf522abe3b2c65f54699b748336f31a9ce8a3ea.
2018-09-18 14:24:44 +01:00
Jeremie Hornus
35ec0cf0f3 some fixes 2018-09-14 12:41:16 +02:00
Jeremie Hornus
b72c9b9724 test private subr simpler 2018-07-09 15:07:08 +02:00
Jeremie Hornus
d95c09f272 <head> indexToLocFormat : first 2018-07-09 15:03:47 +02:00
Jeremie Hornus
11b004e172 improvements to CFF merge after Cosimo’s comments 2018-07-09 14:55:08 +02:00
Jeremie Hornus
8410c0c070 bug fix with CFF charSet order and make better use of Subsetter 2018-07-08 13:13:03 +02:00
Jeremie Hornus
4966804d9d [merge] desubroutinizing with _DesubroutinizingT2Decompiler
No final compression (may happen after, outside merge)
2018-07-07 15:35:39 +02:00
Jeremie Hornus
660a057fb3 merges CFF tables 2018-07-07 14:41:46 +02:00
Cosimo Lupo
3dbb7f763f
[merge] LookupList may be None 2018-03-26 15:32:13 +01:00
Behdad Esfahbod
e5f9674da6 Fixup for previous commit to make tests happy 2018-02-18 15:37:07 -08:00
Behdad Esfahbod
fde3cf6560 [merge] Ignore duplicate glyphs if they render the same
Fixes https://github.com/fonttools/fonttools/issues/1057
2018-02-18 14:44:10 -08:00
Denis Moyogo Jacquerye
fff01237de [merge] Support merging LangSysRecords 2018-02-14 16:12:12 -08:00
Behdad Esfahbod
2d57c87a67 [merge] Minor 2018-02-14 01:11:31 -08:00
Behdad Esfahbod
b9d4795be4 [merge] Comment 2017-10-20 20:13:14 -04:00
Behdad Esfahbod
a34749cc16 [merge] Print out duplicate glyphs in failure message 2017-10-20 20:13:14 -04:00
Behdad Esfahbod
7e34ce6082 Whitespace 2017-10-19 09:54:32 -07:00
Behdad Esfahbod
a302000023 [merge] Remove debug asserts
Fixes https://github.com/fonttools/fonttools/issues/1056
2017-09-18 13:10:03 -04:00
Behdad Esfahbod
556508b0e9 [merge] Remove unused features & lookups 2017-09-15 00:58:42 -04:00
Behdad Esfahbod
d802580cee [merge] Merge Script records, almost properly
Right now only merges DefaultLangSys.  Also, does not remove unused Feature's after merge.
Moreover, does not merge kind Lookups of the same Feature.

But it works!
2017-09-15 00:58:42 -04:00
Behdad Esfahbod
d76d6c1a5f [merge] Remove lookup_id() / feature_id(), use custom dict
I added the id() trick because normal objects are not hashable in Python3.
Remove that hack and use a custom dict subclass that allows us to use
objects as keys as long as they don't change.

The custom dict has a different, desirable, property as well: upon seeing
keys it does not know, it just adds them to the end of the list.  Will use
this feature in next commits to merge ScriptList properly.
2017-09-15 00:58:42 -04:00
Behdad Esfahbod
93763eec0b Minor 2017-09-15 00:58:42 -04:00
Behdad Esfahbod
9d5a468781 [merge] Define lookup_id() and feature_id()
Prepare to merge ScriptRecords properly
2017-09-15 00:58:42 -04:00
Cosimo Lupo
a4861a16cc
use logging.warning() instead of deprecated logging.warn()
functionality is identical, the latter is deprecated:
https://docs.python.org/3/library/logging.html#logging.Logger.warning
2017-05-24 09:49:37 +01:00
Behdad Esfahbod
1f372cc8ed [merge] Add TODO item re merging duplicate items 2017-03-22 15:03:52 -07:00
Behdad Esfahbod
b73c61a3ab Revert "Revert "[merge] Fix for ClassDef.Format and Coverage.Format""
This reverts commit 7406e06aae34300cc2a17f990af5f33abc579afc.

Ouch. The revert of revert was not what I meant. :|
2017-03-08 12:49:56 -08:00
Behdad Esfahbod
7406e06aae Revert "[merge] Fix for ClassDef.Format and Coverage.Format"
This reverts commit 53d78d9956dbbfe50395bf8002b0308b375c02a9.

Now that Format is back in, merge it.

Should fix https://github.com/fonttools/fonttools/pull/878
2017-03-08 12:12:55 -08:00
Bo Song
b45fcf0fd6 Change gasp merge logic to 'first' (#862)
* change gasp merge logic to first

* fix typo

* add comment

* fix typo
2017-02-27 19:34:48 +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
Behdad Esfahbod
a11bc5655d [merge] Ignore LangSys if None
Fixes https://github.com/fonttools/fonttools/issues/739
for now, though proper fix is more complicated.

This was hit now because the subsetter was changed a while back
to retain script systems even if empty...  I don't like that.
2016-11-08 14:06:50 -08:00
Michael Yin
18b905b06d [ttLib/pyftmerge] Handle cmap merge better (#635)
Changed the merge algorithm to properly handle cmap subtables
of type 4 and 12 with platform id and encoding ids of 3/1 and 3/10
respectively. All other subtables are not merged and ignored.
The resulting merged cmap table includes a subtable of format 4/3/1
and a format 12 subtable iff there are mappings outside of the BMP.

If one font has two codepoints that point to the same glyph,
and another font has the same code points pointing to two other glyphs,
keep the behavior where the first replacement glyph is stored in 'locl'
and output the third glpyh (or more) to let the user know that they were
dropped, instead of failing to merge the font.

Fixes #444
Fixes #322
2016-07-13 14:00:36 -07:00
Behdad Esfahbod
3b8387fa45 [merge] Sort FeatureList by feature tag
Fixes https://github.com/behdad/fonttools/issues/444
2016-07-11 17:02:26 -07:00
Behdad Esfahbod
53d78d9956 [merge] Fix for ClassDef.Format and Coverage.Format
Part of https://github.com/behdad/fonttools/issues/444
2016-07-11 16:30:14 -07: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
Behdad Esfahbod
02b0169a8a [merge] Fix for f0eb7e98ca0642f17ac82433db8c957fffd6a9d3 2016-01-13 17:03:31 +00:00
Miguel Sousa
a7aef47695 fix "indentation contains mixed spaces and tabs" errors reported by Landscape 2015-08-09 00:33:50 -07:00
Cosimo Lupo
72481f5050 [merge] fix TabError: inconsistent use of tabs and spaces in indentation 2015-06-14 19:45:20 +01:00
Behdad Esfahbod
6df41da4ff Use timestampNow() in merge.py 2015-06-12 16:11:31 -07:00
Behdad Esfahbod
37e6e6a380 Use dict comprehension now that we don't support Python 2.6 2015-06-11 17:05:15 -07: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
df2906b0ad Fix a few issues found by landscape.io 2015-04-26 02:17:13 -04:00
Behdad Esfahbod
b30e12ae00 More whitespace 2015-04-26 02:01:01 -04:00
Behdad Esfahbod
bd67253118 Some more whitespace fixes from pep8 tool 2015-04-26 01:59:01 -04:00
Behdad Esfahbod
19dadb37d6 One can't import fontTools.subset and fontTools.merge together
Fixes https://github.com/behdad/fonttools/issues/177
2014-10-07 17:37:29 -07:00