1178 Commits

Author SHA1 Message Date
Behdad Esfahbod
40198a2dec [gvar] Use array.array to decode deltas 2016-03-21 10:12:26 -07:00
Behdad Esfahbod
9987b7e14e [gvar] Use array.array to decode deltas 2016-03-21 10:12:26 -07:00
justvanrossum
ad386ee477 Keep Format attribute for OT subtables. This value may be ignored by the compiler but is useful for debugging. Part of fixing #92. 2016-03-21 12:12:05 +01:00
schriftgestalt
b09c5baa15 Disable optimisations when decompiling TrueType instructions 2016-03-20 22:26:22 +01:00
Behdad Esfahbod
e2299a16b0 [otBase] Minor
Part of fixing https://github.com/behdad/fonttools/issues/518
2016-03-12 20:42:16 -08:00
Behdad Esfahbod
407c246433 [otBase] Minor renamings
Part of fixing https://github.com/behdad/fonttools/issues/537
2016-03-12 20:42:13 -08:00
Behdad Esfahbod
c02ced3393 [otBase] Minor
Part of fixing https://github.com/behdad/fonttools/issues/537
2016-03-12 20:42:08 -08:00
Behdad Esfahbod
6b46d8e553 [otBase] Move code around
Part of fixing https://github.com/behdad/fonttools/issues/537
2016-03-12 20:42:05 -08:00
Behdad Esfahbod
4b94fd55cb Simplify overflow handling code
The code that is being removed is untested and does not seem to make
fixing an overflow any easier.  The fixer code just needs to know
which subtable caused the overflow and does not care about the item
within.  As such, no point in trying to find a "right" item.

In fact, leaving item as is, is more useful in debugging overflows
as it reflects which item's offset actually overflowed.

Part of fixing https://github.com/behdad/fonttools/issues/537
2016-03-12 20:11:34 -08:00
Behdad Esfahbod
c1080d9796 Implement splitting PairPosFormat2 in case of overflow
Part of fixing https://github.com/behdad/fonttools/issues/537
2016-03-12 18:17:37 -08:00
Cosimo Lupo
d82a31dd57 return NotImplemented from __ne__ if __eq__ returns NotImplemented
otherwise `not NotImplemented` (always False) is returned from __ne__ when `type(self) != type(other)`, leading to illogic results like:

>>> from fontTools.ttLib.tables.DefaultTable import DefaultTable
>>> t = DefaultTable('test')
>>> t == 0
False
>>> t != 0
False

The latter of course should return True.
2016-03-11 15:10:50 +00:00
Cosimo Lupo
35c46aa0e2 [ttProgram] add __eq__ and __ne__ methods to Program class 2016-03-11 15:10:50 +00:00
Behdad Esfahbod
a0d6ab6a07 [ttLib] Fix bug in OTLOffsetOverflowError generation
Part of fixing https://github.com/behdad/fonttools/issues/537

Now on to fixing the actualy overflow.
2016-03-04 06:06:33 -08:00
Behdad Esfahbod
bf28ca10d7 [EBLC] Decompile and release copies of data early
Apparently string slices are not as smart as I was hoping for.
Slicing a looong (say, 1MB) string and holding onto it is not a
good idea if done thousands of times.  So, do fewer slicings and
decompile subtables immediately instead of holding onto data.

This makes me want to rethink the kind of data structures we use
for lazy processing.

Fixes https://github.com/behdad/fonttools/issues/317
2016-03-02 11:31:20 +09:00
Behdad Esfahbod
7aed5c3ca9 GlyphCoordinates: add test for non-integer transform() 2016-02-24 13:01:09 +09:00
Behdad Esfahbod
87b1c0f403 GlyphCoordinates: Fix translating by non-integer 2016-02-24 12:58:32 +09:00
Behdad Esfahbod
d0552c994c GlyphCoordinates: add failing test for translating non-integer 2016-02-24 12:57:18 +09:00
Behdad Esfahbod
26621d548f GlyphCoordinates: return early from _checkFloat(), if already float 2016-02-24 12:52:38 +09:00
Sascha Brawer
655fb4a856 Skip names whose offset+length points outside the string table
Resolves https://github.com/behdad/fonttools/issues/525
2016-02-16 14:39:44 +01:00
Behdad Esfahbod
d87d6aa39e [ot] Make sure GSUB/GPOS top arrays don't share bytes
Fixes https://github.com/behdad/fonttools/issues/518
Fixes https://github.com/behdad/fonttools/issues/372
2016-02-10 18:00:48 +07:00
Behdad Esfahbod
1085d8973d [ot] Minor 2016-02-10 17:28:56 +07:00
Behdad Esfahbod
0baeb5921b [otBase] Shuffle 2016-02-10 17:26:53 +07:00
Behdad Esfahbod
f65fc6f872 [otBase] Simplify _doneWriting() slightly
Should have NO functional change.
2016-02-10 17:03:46 +07:00
Cosimo Lupo
e30ad7e8a7 [woff2_test] import sstruct from fontTool.misc
oops.
2016-02-07 01:19:45 +00:00
Cosimo Lupo
f998cf1126 [ttLib] use boolean instead of int
I know it's same, but this looks more 'pythonic'
2016-02-02 18:26:50 +00:00
Cosimo Lupo
84d6f076a3 [ttLib] call XMLWriter.close() only if 'fileOrPath' is a path, not when it's a file
This allows to call `TTFont.saveXML` with an already open file/stream (e.g. sys.stdout or a StringIO) without it being abruptly closed at the end.

We do the same elsewhere when we reiceive file handles instead of path names, so we might do it here too.
2016-02-02 18:25:43 +00:00
Dave Crossland
17007a36d6 otBase.py log level adjustment
Change log level of 'Attempting to fix OTLOffsetOverflowError' from warning to debug to close #499
2016-02-02 10:06:10 -05:00
Behdad Esfahbod
b6a78d5664 Simplify fix for https://github.com/behdad/fonttools/pull/498 2016-02-02 11:52:24 +08:00
Cosimo Lupo
ed29a07670 [O_S_2f_2] skip updateFirstAndLastCharIndex if cmap table class is DefaultTable
Fixes https://github.com/behdad/fonttools/issues/497
2016-02-01 18:04:39 +00:00
Cosimo Lupo
c4d2ebca66 remove deprecated use of 'quiet' option in test modules 2016-02-01 13:39:39 +00:00
Cosimo Lupo
e40dffd86d [_c_m_a_p] don't set self.data = headerdata + data inside cmap_format_14.compile
self.data is usually set by decompileHeader as "the data after the header"; while here
it also included `headerdata`. This produced corrupt data if the compile method was called
again, as the header data is added again to self.data.

Moreover, in none of the subtable classes' `compile` methods, the re-compiled data is
stored in self.data, so we shall not do that for format 14 either.

Fixes #389
2016-01-31 21:00:11 +00:00
Cosimo Lupo
7fafe1f9a7 [sfnt] add compress function to optionally use zopfli instead of zlib 2016-01-31 14:20:17 +00:00
Cosimo Lupo
48db539c44 [ttProgram] replace print with logger 2016-01-27 19:02:48 +00:00
Cosimo Lupo
af91f9e791 [otTables] replace warnings with logger 2016-01-27 19:02:48 +00:00
Cosimo Lupo
6f8e1502ff [otConverters] replace print with logger 2016-01-27 19:02:48 +00:00
Cosimo Lupo
10bf8ecd85 [otBase] replace print with logger 2016-01-27 19:02:48 +00:00
Cosimo Lupo
2b30dc2134 [_n_a_m_e] replace print with logger 2016-01-27 19:02:48 +00:00
Cosimo Lupo
0ce31f7b0a [_l_o_c_a] replace warnings with logger 2016-01-27 19:02:48 +00:00
Cosimo Lupo
7d36de99ef [_k_e_r_n] replace warnings with logger 2016-01-27 19:02:48 +00:00
Cosimo Lupo
abe3202412 [_h_m_t_x] replace warnings with logger 2016-01-27 19:02:48 +00:00
Cosimo Lupo
f85e2f295d [_h_e_a_d] replace warnings with logger 2016-01-27 19:02:48 +00:00
Cosimo Lupo
dff078ed51 [_g_l_y_f] replace print and warnings with logger 2016-01-27 19:02:48 +00:00
Cosimo Lupo
ff853c38b8 [_c_m_a_p] replace print with logger 2016-01-27 19:02:48 +00:00
Cosimo Lupo
77658c952f [_a_v_a_r_test] use StringIO to capture logger's output in test case 2016-01-27 19:02:48 +00:00
Cosimo Lupo
9b21ea6a09 [_a_v_a_r] replace warnings with logger 2016-01-27 19:02:48 +00:00
Cosimo Lupo
c5659b28a2 [S_V_G_] replace print with logger 2016-01-27 19:02:48 +00:00
Cosimo Lupo
e46be4d7d6 [O_S_2f_2] replace print with logger 2016-01-27 19:02:48 +00:00
Cosimo Lupo
7d67e9c257 [E_B_L_C_] replace print with logger 2016-01-27 19:01:12 +00:00
Cosimo Lupo
74cb889f4e [E_B_D_T_] replace print with logger 2016-01-27 19:01:12 +00:00
Cosimo Lupo
85f9f442ea [BitmapGlyphMetrics] replace print with logger 2016-01-27 19:01:12 +00:00