A couple of modules were relying on the fact that the 'sys' module was being implicitly imported by 'from py23 import *'.
The 'py23.__all__' does not include 'sys'. I think it's better to always import 'sys' explicitly when needed.
The previous 'allXMaxIsLsb' name was misleading.
The 'allXMinIsLsb' boolean variable cooresponds to the head table's Bit 1.
This is set whenever all glyphs have the bbox.xMin equal to the respective
left sidebearing (and therefore "left sidebearing point at x=0").
Today, Apple has kindly fixed a bug in the [specification of the
meta table](https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6meta.html). The existing fonttools implementation matches the
revised specification. Therefore, the comments about fonttools
intentionally deviating from Apple's spec can be removed.
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
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.
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
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.
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