28 Commits

Author SHA1 Message Date
Cosimo Lupo
d1a27bd671 subset: add --recalc-average-width command-line option (on by default); log message if xAvgCharWidth changed 2016-07-19 22:54:05 +01:00
Khaled Hosny
efb32d5402 [subset] Recalculate OS/2.xAvgCharWidth 2016-07-18 01:35:18 +02:00
Behdad Esfahbod
5cd1fbaff6 [subset] Clear CFF Encoding vector
Fixes https://github.com/behdad/fonttools/issues/620
2016-07-13 00:33:41 -07:00
Khaled Hosny
f88c43d105 Check for file attribute before deleting it
I don’t know why this is happening, but I’m getting attribute error when
I build https://github.com/khaledhosny/mada with compreffor
optimisations on.
2016-05-19 20:50:10 +02:00
Cosimo Lupo
ca8e49b6f5 subset: fix typo
Ouch.
2016-05-16 17:05:46 +01:00
Cosimo Lupo
920c6a8249 subset: set maxp.maxStorage to 0 when --no-hinting option is passed
'maxStorage' is the maximum number of Storage Area locations used.
If there's no hinting, it should be 0.
2016-05-16 15:57:17 +01:00
Behdad Esfahbod
26bb99e1c3 [subset] Whitespace 2016-05-12 13:40:14 +02:00
Behdad Esfahbod
cd914c9575 [subset] Protect against some more prematurely-short arrays 2016-05-12 13:40:14 +02:00
Behdad Esfahbod
85750a864a [subset] Protect against prematurely-short arrays GPOS 2016-05-12 13:40:14 +02:00
Behdad Esfahbod
a61b31a917 [subset] Mark avar and fvar tables as no-need-subsetting 2016-04-08 18:41:31 -07:00
Sascha Brawer
0fad6e66ec Support subsetting of variation fonts 2016-03-31 16:23:24 +02:00
Behdad Esfahbod
74e629e600 [subset] Retain GSUB ScriptRecords, even if they are empty
This slightly bloats subset fonts, but fixes:
https://bugzilla.mozilla.org/show_bug.cgi?id=1080739#c15
https://github.com/behdad/fonttools/issues/518

At some point we might want to do something smarter based
on Unicode script of retained characters.
2016-02-10 16:22:24 +07:00
Cosimo Lupo
f6b8445515 [subset] catch OptionError exception, print usage + error and throw exit code 2 2016-02-04 12:17:01 +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
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
ce5d230eef [subset] add --prune-unicode-ranges option (enabled by default) 2016-01-27 18:38:32 +00:00
Khaled Hosny
0e1cc9fb73 [subset] Add support for MATH table 2016-01-23 23:00:30 +04:00
Behdad Esfahbod
0ec2911c47 [subset] Fix for f0eb7e98ca0642f17ac82433db8c957fffd6a9d3 2016-01-13 17:00:29 +00:00
Rod Sheeter
9927a91653 Remove change to _dict_subset (meant to be local/test only). Add a cmap fmt 0 to color font test file. 2015-12-09 13:32:35 -08:00
Rod Sheeter
905eb831b9 Add Google-style color font test and make _dict_subset more forgiving. 2015-12-09 13:05:16 -08:00
Cosimo Lupo
812609e90c [subset] fix logic of EBLC subsetting; avoid KeyError in EBDT subsetting 2015-12-09 09:42:15 -08:00
Rod Sheeter
9189d1a1f0 Experimental support for Google-style color bitmap fonts 2015-12-09 09:42:15 -08:00
Behdad Esfahbod
8128b509a4 [subset] Augment ContextHelper
As needed in my Monotype OpenType format parser.  I'm not using the object
directly from subset module, but pushing back my changes here, in the hope
that we move this object to ttLib proper soon.
2015-12-08 20:40:42 +01:00
Behdad Esfahbod
f129f658c9 [subset] Fix Options parsing
Fixes https://github.com/behdad/fonttools/issues/413
Test passes now.
2015-12-07 11:14:04 +01:00
Khaled Hosny
301d2db812 [subset] Support subsetting MS color tables
Add support for subsetting COLR table.

The CPAL table does not need subsetting, but unused palettes should be
pruned, this is not implemented however as it depends on COLR table,
which in turn will not be updated after pruning CPAL.
2015-12-01 11:59:52 +04:00
Miguel Sousa
6db7d30ed9 [subset] Preserve the .notdef glyph width when removing its outlines 2015-11-13 17:43:22 -08:00
Miguel Sousa
51bd7e00b5 white space 2015-11-13 17:36:13 -08:00
Miguel Sousa
29d7edf76f [subset] mv subset.py subset/__init__.py 2015-11-13 17:36:02 -08:00