131 Commits

Author SHA1 Message Date
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
Behdad Esfahbod
28270fd6fe [subset] Add --gids that takes list of glyph ids or ranges
Fixes https://github.com/behdad/fonttools/issues/113
2014-08-13 20:16:30 -04:00
Behdad Esfahbod
70723291bf [subset] Fix --unicodes doc 2014-08-13 20:02:08 -04:00
Behdad Esfahbod
387d317dbe [subset] "Support" VDMX
VDMX doesn't have glyph-specific data, so pass it through if requested.
We can actually load the table now, but it needs no subsetting anyway.
2014-08-13 19:56:11 -04:00
Behdad Esfahbod
bdaa75f9e7 [subset] Accept unicode ranges
Eg --unicodes=41-5a,61-7a to choose ASCII letters.  Note that with
this, --unicodes-file accepts fontconfig .orth files that do not
include other files.
2014-08-13 19:44:04 -04:00
Behdad Esfahbod
702729a076 [subset] Add --unicodes and --unicodes-file
Fixes https://github.com/behdad/fonttools/pull/79
2014-08-13 19:30:17 -04:00
Behdad Esfahbod
175c54a9d1 [subset] allow for unicode-based name with suffixes in the subset list
Fixes https://github.com/behdad/fonttools/issues/133

That part of the code is becoming really messy, but I want to get
all the features in first, then clean up.
2014-08-13 18:29:11 -04:00
Behdad Esfahbod
4b0facbc68 [subset] Minor 2014-08-13 18:10:42 -04:00
Behdad Esfahbod
40198c9b4d [subset] Accept separate on whitespace as well as comma
For all options, including the newly added --glyphs.
2014-08-13 18:08:16 -04:00
Behdad Esfahbod
315329845f [subset] Add --glyphs 2014-08-13 18:06:31 -04:00
Behdad Esfahbod
f290394747 [subset] Rename --glyph-file to --glyphs-file 2014-08-13 17:48:46 -04:00
Behdad Esfahbod
015908415a [subset] Add --output-file
As requested many many times:

Fixes https://github.com/behdad/fonttools/pull/79
Fixes https://github.com/behdad/fonttools/pull/15
Fixes https://github.com/behdad/fonttools/issues/44
2014-08-13 17:35:23 -04:00
Behdad Esfahbod
8e51079212 [subset] Minor 2014-08-13 17:32:33 -04:00
Behdad Esfahbod
eac1ee5373 [subset] Add --glyph-file
It only accepts PS glyph names, not gidNNN, U+XXXX, etc, as per
discussion here: https://github.com/behdad/fonttools/issues/113

Requested many times:
https://github.com/behdad/fonttools/pull/15
https://github.com/behdad/fonttools/pull/79
2014-08-13 17:32:33 -04:00
Behdad Esfahbod
3b34ea301a [subset] Add --text-file 2014-08-13 16:55:47 -04:00
Behdad Esfahbod
1633d8e917 [subset] Allow pyftsubset --layout-features? etc
To see the current value of an option, pass a value of '?' to it, with
or without a '='.
Examples:
  $ pyftsubset --glyph-names?
  Current setting for 'glyph-names' is: False
  $ ./pyftsubset --name-IDs=?
  Current setting for 'name-IDs' is: [1, 2]
  $ ./pyftsubset --hinting? --no-hinting --hinting?
  Current setting for 'hinting' is: True
  Current setting for 'hinting' is: False

Fixes https://github.com/behdad/fonttools/issues/142
2014-08-13 16:33:57 -04:00
Behdad Esfahbod
1e7cb631a8 [subset] Err if options are not provided for list values 2014-08-13 16:20:06 -04:00
Behdad Esfahbod
bce7ef7ede [subset] Add looooooooonger usage
Based on text from Adam Twardoch.

Fixes https://github.com/behdad/fonttools/pull/15
2014-08-13 16:06:49 -04:00
Behdad Esfahbod
3c4b5e0a09 [subset] Work around OTS bug with FDSelect format 0
a049b98c88
https://github.com/khaledhosny/ots/pull/31

Fixes https://github.com/behdad/fonttools/issues/138
2014-07-23 00:04:32 -04:00
Behdad Esfahbod
88d4decc5f [subset] Handle None ChainContext
Fixes https://github.com/behdad/fonttools/issues/134
2014-07-02 17:09:22 -04:00
Behdad Esfahbod
dff3346ead [subset] Handle case of None ChainContext class with non-zero chain
It would be a font bug, but handle regardless.
2014-07-02 17:09:18 -04:00
Behdad Esfahbod
56a9c4cb42 [subset] Fix order of chain for consistency
I'm confident I haven't broken anything.
2014-07-02 16:57:26 -04:00
Behdad Esfahbod
ade1972557 Remove CFF Index.count member
Clean up.  len(index) should be used instead.
2014-06-16 15:35:15 -04:00
Behdad Esfahbod
149a6700a1 [subset] Minor 2014-06-16 15:33:53 -04:00
Behdad Esfahbod
cf2f85e4e2 [subset] Add TODO 2014-06-05 20:39:38 -04:00
Behdad Esfahbod
d15afe9231 [subset] Fix pruning of empty rulesets in (Chain)ContextFormat1
Similar to 98b60757ab9bb0aaa3c1f136e5a837a1b73d22ed and the
recent commits for Format2.
2014-06-05 20:19:38 -04:00
Behdad Esfahbod
a7cd151e14 [subset] Actually prune empty subrulesets in (Chain)ContextFormat2 2014-06-05 18:28:21 -04:00
Behdad Esfahbod
26cb08062d [subset] More fixing of (Chain)ContextFormat2
This is follow up to 98b60757ab9bb0aaa3c1f136e5a837a1b73d22ed
Looks like this lookup type is a curse to stay with us.  Sigh...
2014-06-05 18:24:53 -04:00
Behdad Esfahbod
3e19354bf5 [subset] Unbreak after e898881ed12d7ce96948f2905d725847c76bc9e8 2014-05-13 21:08:51 -04:00