159 Commits

Author SHA1 Message Date
Behdad Esfahbod
9cbfede2a2 [subset] Minor: move pruning to right place 2015-08-24 12:48:47 +01:00
Behdad Esfahbod
6519752913 [subset] Speedup GSUB/GPOS.prune_pre_subset()
Instead of remapping used lookups, just nuke unused ones, as
subset_glyphs() does a remapping of used lookups already.
2015-08-24 12:45:29 +01:00
Behdad Esfahbod
8cc69ab2ed [subset] Remove no-op Lookup.prune_pre_subset() and deps 2015-08-24 12:08:27 +01:00
Behdad Esfahbod
46840d2d32 [subset] Speed up subsetting of dictionaries
Speeds things up for the tables affected.  But more importantly, allows for
lazy-loading of hdmx using custom data-structure coming in next patch.
2015-08-23 20:39:34 +01:00
Cosimo Lupo
eb266373fd [subset] specify woff2 among supported flavors in __doc__ 2015-08-07 18:23:41 +01:00
Behdad Esfahbod
b94ad38da5 [subset] Whitespace 2015-07-02 15:01:24 -07:00
Behdad Esfahbod
c7b6d1943d Fix decompiling of cmap table
Previously, if a subtable's data was shared amongst two different encodings,
the second one being loaded was getting a cmap member assigned while retaining
its data item.  If we subset the cmap and then save that subtable, the original
unsubset data will be written out.  Fix, but removing data when assigning cmap.

Explains and obviates mystery hack in subsetter.
2015-06-22 19:14:09 -07:00
Behdad Esfahbod
6cfb4f1d4f Revert "[subset] Remove ancient hack that I can't reproduce needing anymore"
This reverts commit 72f72d3c3fff3eea38ae41b86a10a78d8460e09d.

This broken subsetting of cmap, as privately reported by Adam to me.
Investigating some more.  I think I actually know what's going on.
2015-06-22 19:13:50 -07:00
Behdad Esfahbod
72f72d3c3f [subset] Remove ancient hack that I can't reproduce needing anymore 2015-06-12 15:27:47 -07:00
Behdad Esfahbod
e7fe5b4db8 [subset] Minor log 2015-06-12 15:23:10 -07:00
Behdad Esfahbod
6406fcade0 [subset] Fix format 14 subsetting with glyphs_requested 2015-06-12 15:18:43 -07:00
Behdad Esfahbod
d39d231982 [subset] Use frozensets where appropriate
Note that this fixes a bug where a copy was not being made
when glyphs_cmaped was assigned.  Fortunately that value
wasn't used for a lot of things.
2015-06-12 15:11:36 -07:00
Behdad Esfahbod
215a8990d4 [subset] Speed up cmap format 14 closure
Previously, closing cmap glyphs over NotoSansCJKjp-Thin.otf was
taking 24s.  Now it takes under 1s.
2015-06-12 14:54:36 -07:00
Behdad Esfahbod
1135d9b1df [subset] Minor 2015-06-12 14:46:08 -07:00
Behdad Esfahbod
c1b407726d [subset] Speed up NotoNastaliq again
Back to 5s again, by memoizing more broadly.
2015-06-12 14:40:18 -07:00
Behdad Esfahbod
b6aace1c94 [subset] Fix up glyph closure
Followup fix from 13d48da3a91e7ac005f31b0f4dbca01cae7adbd7

When avoiding redoing the same lookup, we should only do that within
each run over all lookups.

Fixes issue where closing glyphs over NotoNastaliq was unreliable and
returning different results (which was caused by items in our frozenset's
being walked over in different orders).

Slows down closing over NotoNastaliq from 5s to 16s.  Speedup fixes coming
soon.
2015-06-12 14:11:03 -07:00
Behdad Esfahbod
a3ab65b184 [subset] Whitespace 2015-06-12 14:05:46 -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
Behdad Esfahbod
e6f5ba6e9c Whitespace 2015-05-27 17:04:37 -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
Sascha Brawer
49ce1681cd Change whitespace in subset.py to conform with Python style guide
The Python style (outside of Google) is four spaces for indentation.
After this change, pylint still has complaints about this file,
but these formatting changes will probably improve the health
metrics of landscape.io. Personally, I couldn't care less about
whitespace, but it is hard to spot actual problems in a sea
of lint warnings.
2015-05-07 10:40:29 +02:00
Sascha Brawer
5cda3d4e72 Minor fixes to reduce the number of code smells 2015-05-06 19:17:08 +02:00
Behdad Esfahbod
f5cbeea491 [subset] Fix after c4d04000047b4284341f58a28a70e821c1129d6b
Fixes https://github.com/behdad/fonttools/pull/254
2015-04-30 18:39:04 -04:00
Behdad Esfahbod
bd67253118 Some more whitespace fixes from pep8 tool 2015-04-26 01:59:01 -04:00
Behdad Esfahbod
cc072eca9f Use utf_16_be instead of utf_16be
That's the canonical name.

https://github.com/behdad/fonttools/issues/236
2015-04-24 12:48:37 -07:00
Behdad Esfahbod
ffd2e35371 [subset] Add note re --desubroutinize resulting in smaller WOFF/WOFF2 2015-04-22 16:02:59 -07:00
Behdad Esfahbod
aa74114f1d Use cannonical encoding ids 2015-04-20 18:21:46 -07:00
Behdad Esfahbod
f419f572db Add TODO 2015-04-16 16:35:51 -07:00
Behdad Esfahbod
24264cb7f8 [subset] Fix chaos handling to be more inclusive
If a contextual lookup recurses twice on the same index, that index
most be marked chaotic for the second recursion.

Also, when a non-1-to-1 recursion happens, only mark glyph locations
after current to be chaotic, not everything.

I believe this fixes a bug that before we were not inclusive enough.
Now we might have introduced more false positives, but we are at least
correct.
2015-04-01 18:51:52 -07:00
Behdad Esfahbod
2a7007df7b [subset] Indent 2015-04-01 18:22:51 -07:00
Behdad Esfahbod
9ab1d2f968 [subset] Minor 2015-04-01 18:18:56 -07:00
Behdad Esfahbod
13d48da3a9 [subset] Avoid duplicate recursions in closure_glyphs() for contextuals
Speeds up NotoNastaliqUrdu from 50s to 1.8s.
2015-04-01 18:15:01 -07:00
Behdad Esfahbod
4a3dcd589e [subset] Whitespace 2015-04-01 17:51:54 -07:00
Behdad Esfahbod
22ffbba4b7 [subset] Further narrow down cur_glyphs in recursive contextuals
Improves NotoNastaliqDraft closure_glyphs() time from 60s to 50s.

This was originally introduced in 1d4fa13b4.  I'm fairly confident
new code is correct.
2015-04-01 17:45:55 -07:00
Behdad Esfahbod
c4d0400004 [subset] Speed up closure_glyphs() a bit
Was taking nine minutes on NotoNastaliqUrdu font.
With these changes it takes only(1) one minute now.

More coming.
2015-04-01 17:34:38 -07:00
Sam Fishman
de66a6466c [subset] Add --desubroutinize
This seems to both make the font smaller for small subsets, and works
around a bug in our CFF hint stripping logic.

So, if you are passing --no-hinting, do pass --desubroutinize.
2015-01-05 15:53:56 -08:00
Behdad Esfahbod
4447a76c33 [subset] If DSIG is to be retained, drop all signatures
Now DSIG can be retained by passing --drop-tables-=DSIG.
The embedded signatures will be dropped but empty table
retained.

Fixes https://github.com/behdad/fonttools/issues/145
2014-12-09 19:02:39 -08:00
Behdad Esfahbod
3560ee4c43 [subset] Update maxp values when dropping hinting
Fixes https://github.com/behdad/fonttools/issues/201
2014-12-09 18:53:37 -08:00
Behdad Esfahbod
da6497ea1f [subset] Fix example
Fixes https://github.com/behdad/fonttools/issues/192
2014-10-15 14:15:49 -07:00
Cosimo Lupo
a4aa9f2532 [subset] drop nameIDs 16, 17 and 18 if obfuscate_name 2014-10-08 11:42:36 +01: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
Cosimo Lupo
d5660cdd0c also obfuscate name-IDs 16, 17 and 18 2014-10-07 13:36:10 +01:00
Cosimo Lupo
8b081fed0b added --legacy-kern option to drop TrueType kern if GPOS is available 2014-09-30 19:29:53 +01:00
Cosimo Lupo
450f8d42bb updated __doc__ 2014-09-25 15:42:13 +01:00
Cosimo Lupo
a73530aa79 added --obfuscate-names to make webfont unusable as a system font 2014-09-25 15:19:38 +01:00
Behdad Esfahbod
1f5b00bbbf [subset] Add --unicodes='*' and --glyphs='*' 2014-09-22 23:32:23 +02:00
Behdad Esfahbod
de9d1a6e47 [subset] Always remove 'glyf' Glyph padding
Before we were only doing this, partially, if --no-hinting was requested.
Always remove padding.  More savings.
2014-08-15 14:34:28 -04:00
Behdad Esfahbod
30852ad3b3 [subset] Add --gids-file 2014-08-14 11:37:35 -04:00
Behdad Esfahbod
946528fa25 [subset] Remove special handling of gidNNN, uniXXXX
We now have --gids and --unicodes, so only accept glyph names
on cmdline.  Cleans up a few things.

Sorry about the breakage in advance everyone. :)
2014-08-13 21:30:25 -04:00
Behdad Esfahbod
590c8777a6 [subset] Add --ignore-missing-glyphs and --no-ignore-missing-unicodes
Move glyph checking into the subsetter.  Also fix --gids.  Previous
patch's implementation was wrong as it was picking up glyphs from
sorted glyph-name list, NOT the glyph order!

Fixes https://github.com/behdad/fonttools/issues/34
2014-08-13 21:18:24 -04:00