937 Commits

Author SHA1 Message Date
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
Cosimo Lupo
e386a1a408 update table's list through MetaTools/buildTableList.py 2014-08-13 19:51:47 +01:00
Cosimo Lupo
d9c0d38115 a VDMX table converter 2014-08-13 19:51:13 +01:00
Behdad Esfahbod
5ba7d98a41 [glyf] Only pad glyphs that are odd-lengthed
Ouch!  Thinko.
2014-07-23 16:36:31 -04:00
Behdad Esfahbod
5ed7d154a9 Turn assert into warning 2014-07-23 16:28:34 -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
3a10a6546c [glyf] Don't pad when removing hinting instructions
Finishes recent changes.
2014-07-22 21:48:19 -04:00
Behdad Esfahbod
9ab98b2d65 Adjust previous commit 2014-07-22 17:39:17 -04:00
Behdad Esfahbod
eef4daeeaa Add padding to glyphs only if it makes it possible to use short loca
Otherwise don't add padding.  This is against the spec, but "should"
work everywhere.  The spec only says offsets "should" be padded:

"""Note that the local offsets should be long-aligned, i.e., multiples
of 4. Offsets which are not long-aligned may seriously degrade
performance of some processors."""

We don't add any padded that we absolutely don't have to.  Should save
an average of one byte per glyph on large fonts.
2014-07-22 16:00:24 -04:00
Behdad Esfahbod
c6b031d661 Only use two-byte offsets in loca table if all offsets are even
Otherwise it will mess up.
2014-07-22 15:49:04 -04:00
Behdad Esfahbod
30ff4ab869 Minor debug output improvement 2014-07-22 15:37:17 -04:00
Behdad Esfahbod
4af65b0f3d [py23] Minor refactoring 2014-07-21 13:19:53 -04:00
Behdad Esfahbod
e6adebdc4a Make glyf-table glyph loading lazy by default
When I added the font.lazy setting, I made glyf table non-lazy
by default.  This is helpful to users who typically access glyphs
like:

	glyf_table.glyphs[glyfname]

instead of the correct way:

	glyf_table[glyfname]

and also forget to call expand() on the glyph.  However, this
significantly slows down most scripts that load the font without
lazy=True...  As such, add a third mode to laziness.  By default
lazy=None and does NOT expand glyphs.  If lazy=False is passed
in, all glyphs are loaded.

I hope this is an acceptable middle ground and not too confusing.
2014-07-14 20:02:37 -04:00
Behdad Esfahbod
9bd685a3ec [cmap] Remove bogus use of font.lazy
Ouch!
2014-07-14 20:01:04 -04:00
Behdad Esfahbod
671bca785d [glyf] Align glyphs at word boundaries, not long
Saves two bytes per glyph on average.  Or as Roozbeh reports,
70kb in DroidSansFallbackFull.ttf.
2014-07-14 19:53:42 -04:00
Behdad Esfahbod
68921c97ea [merge] Fails if 'GSUB' table not present
Fixes https://github.com/behdad/fonttools/issues/135

Or does it?
2014-07-09 17:13:16 -04:00
Behdad Esfahbod
bc7cf1fd5d [cffLib] Packing charset with only .notdef glyph fails
Fixes https://github.com/behdad/fonttools/issues/136
2014-07-09 14:30:06 -04:00
Behdad Esfahbod
d04dc9df11 [merge] Add preliminary support for BASE table 2014-07-03 14:01:44 -04:00
Behdad Esfahbod
6cc8bc3dbd [merge] Support Extension lookups 2014-07-03 13:46:23 -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
Roozbeh Pournader
365b0bfce1 Add support for dumping XMLs to the standard output. 2014-06-27 15:03:32 -04:00
Behdad Esfahbod
83a89c123f Fix isComposite with empty glyphs
Was broken in 626107c8.
2014-06-25 19:02:04 -06:00
Behdad Esfahbod
d897eb0486 Micro optimization 2014-06-16 20:35:12 -04:00
Behdad Esfahbod
d06ecc6b25 Use basestring instead of str 2014-06-16 20:30:17 -04:00
Behdad Esfahbod
5598d1de5a [cff] Speed up operand handling
I get ~7% speedup just avoiding a redirection.
2014-06-16 20:23:12 -04:00
Behdad Esfahbod
8d44d79ee2 Minor simplification 2014-06-16 20:23:12 -04:00
Behdad Esfahbod
e0a45cdb84 Fixup for f1d5c85c3f8a3500048c8a3ef59a25f836e2bcb4
Really fix https://github.com/behdad/fonttools/issues/124
this time.
2014-06-16 18:39:22 -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
f1d5c85c3f Ignore "reserved" post table format 2.0 indices
Fixes https://github.com/behdad/fonttools/issues/124
2014-06-13 13:18:22 -04:00
Behdad Esfahbod
3c89b298c3 Disallow empty glyph name decoded from post table
But preserve it...

For example, with this font:

https://code.google.com/p/googlefontdirectory/source/browse/ofl/phetsarath/Phetsarath-Regular.ttf

we now get:

    ...
    <GlyphID id="136" name="uni0EDD.am"/>
    <GlyphID id="137" name="uni0EB3.right"/>
    <GlyphID id="138" name="glyph00138"/>
    <GlyphID id="139" name="glyph00139"/>
    <GlyphID id="140" name="glyph00140"/>
    ...
    <GlyphID id="161" name="glyph00161"/>
  </GlyphOrder>

...

  <post>
    <formatType value="2.0"/>
    <italicAngle value="0.0"/>
    <underlinePosition value="-217"/>
    <underlineThickness value="150"/>
    <isFixedPitch value="0"/>
    <minMemType42 value="0"/>
    <maxMemType42 value="0"/>
    <minMemType1 value="0"/>
    <maxMemType1 value="0"/>
    <psNames>
      <!-- This file uses unique glyph names based on the information
           found in the 'post' table. Since these names might not be unique,
           we have to invent artificial names in case of clashes. In order to
           be able to retain the original information, we need a name to
           ps name mapping for those cases where they differ. That's what
           you see below.
            -->
      <psName name="glyph00107" psName=""/>
      <psName name="glyph00138" psName=""/>
      <psName name="glyph00139" psName=""/>
      ...
      <psName name="glyph00161" psName=""/>
    </psNames>

Part of https://github.com/behdad/fonttools/issues/124
2014-06-13 13:10:16 -04:00
Behdad Esfahbod
4d6be6b7d2 Don't use has_key in post table; that's gone in python3
Raised here: https://github.com/behdad/fonttools/issues/124
2014-06-13 12:47:58 -04:00
Behdad Esfahbod
b7367012e4 Add __contains__ to cffLib 2014-06-13 12:47:55 -04:00
Behdad Esfahbod
69ef79b5da Err if post table format 2 indices get to the reserved range 2014-06-13 12:47:50 -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
d65b587708 Minor 2014-06-05 17:58:15 -04:00
Behdad Esfahbod
ced737e249 Allow ligatures with one component only 2014-06-05 17:03:31 -04:00
Behdad Esfahbod
a47d226662 Apply fixes from 'hhea' to 'vhea'
Maybe they should be merged...
2014-06-02 18:31:52 -04:00
Behdad Esfahbod
9f23ee4cc8 Change cmap-based duplicate-name resolution from n^2 to linear time
Similar to 85be2e0a9773acec3c6d14c345b1fd94ab3aa5c3, though much
harder to hit.
2014-06-02 18:09:47 -04:00
Behdad Esfahbod
4ff0d4b192 Fix post table glyph name dedup logic for edge case
This is a followup fix to 85be2e0a9773acec3c6d14c345b1fd94ab3aa5c3
Before this change, if some glyph names had a "#-number" suffix in
the post table, we could generate duplicate glyph names.  Fix that,
even though "#" is NOT a valid character in PS glyph names.
2014-06-02 18:03:35 -04:00