120 Commits

Author SHA1 Message Date
Khaled Hosny
40f82a8515 [merge] Support --output-file 2021-11-18 22:09:02 +02:00
Khaled Hosny
10c05b8eed [merge] Remove subroutines debug code
We are not doing anything about subroutines (and there shouldn’t be any
since the tables are desubroutinized), so this code is just making it
look noisy.
2021-11-18 16:39:41 +02:00
Khaled Hosny
d7c3a967cf [merge] Support non-indexed CharStrings 2021-11-18 16:37:09 +02:00
Khaled Hosny
753a841de6 [merge] Minor and comment 2021-11-17 21:03:52 +02:00
Khaled Hosny
6acf76996e [merge] Don’t process CFF before all other tables
I don’t know why this code was there, but my tests make no difference
with or without it.
2021-11-17 21:03:52 +02:00
Khaled Hosny
a53ded3b31 [merge] Don’t create TTFont then throw it away
The font is opened later, so use that.
2021-11-17 21:03:52 +02:00
Khaled Hosny
5299a3cb83 [merge] Simplify renaming CFF CharStrings 2021-11-17 21:03:52 +02:00
Khaled Hosny
8e9ab24c11 [cffLib] Move desubroutinize from subset module to CFFFontSet
This way we can use it from both subset and merge modules.
2021-11-17 21:03:49 +02:00
Cosimo Lupo
e5e69852ed merge: various cleanups (WIP) 2021-11-17 21:03:12 +02:00
Cosimo Lupo
a75e01204d Revert "Revert "Merge pull request #1289 from BlackFoundry/master""
This reverts commit 6deeb70acbe8f75dba29f1ea8c8d2cd6842bcbdc.
2021-11-17 21:03:12 +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
Behdad Esfahbod
26ac716a8d [subset/merge] Fix namespace clash
Fixes https://github.com/fonttools/fonttools/issues/1955
2020-06-02 15:13:30 -07:00
Simon Cozens
f3f2793444
[docs] Document fontTools.merge (#1949)
[docs] Document fontTools.merge
2020-05-14 10:06:13 +01:00
Cosimo Lupo
b6601f61ec
merge: handle OS/2 attributes only present in subsequent versions
Also, implement merging version 5 (by taking the min/max of the optical
point sizes), and rename `usMaxContex` to the correct name `usMaxContext`.
The typo was fixed in the OS/2 table some time ago, but we forgot to
also update the merge module.

Fixes #1865
2020-05-13 13:12:31 +01: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
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