192 Commits

Author SHA1 Message Date
Behdad Esfahbod
3a9fd30180 2to3 equivalent to --fix=tuple_params
I hope I got this all right...
2013-11-27 03:30:21 -05:00
Behdad Esfahbod
cd5aad92f2 2to3 --fix=raise 2013-11-27 02:42:28 -05:00
Behdad Esfahbod
180ace6a5f 2to3 --fix=ne 2013-11-27 02:40:30 -05:00
Behdad Esfahbod
2b06aaa2a6 2to3 --fix=import 2013-11-27 02:34:11 -05:00
Behdad Esfahbod
bc5e1cb195 2to3 --fix=has_key 2013-11-27 02:33:03 -05:00
Behdad Esfahbod
3ac9e63fce Load / save FeatureParamSize decipoints values as float 2013-11-26 19:42:55 -05:00
Behdad Esfahbod
9e1bd2d0b4 Implement FeatureParams
All types of FeatureParams are correctly handled now.

The only thing not handled is broken fonts generated with the
old AFDKO that have their FeatureParams offset computed wrong.
I don't currently plan on handling those.

Fixes https://github.com/behdad/fonttools/issues/38
2013-11-26 19:23:08 -05:00
Behdad Esfahbod
cb4adf6828 Fix XML->ttf for fonts that have some missing anchors, etc
Eg. EBGaramond12-Regular.ttf.  It has a base anchor missing.
Dropping the empty table from XML changes the size of the base
anchor array, which will then result in an assertion because
all bases should have the same array length.

Fixes many other broken fonts too.
2013-11-26 18:55:23 -05:00
Behdad Esfahbod
2f2fd9ca7c Minor 2013-11-26 18:43:43 -05:00
Behdad Esfahbod
f4e61ae637 Undo making subReader lazy
Need this for upcoming FeatureParams implementation.
2013-11-26 17:37:03 -05:00
Behdad Esfahbod
79f734414c Further simplify OTTableReader/Writer 2013-11-26 17:07:37 -05:00
Behdad Esfahbod
e0c2e8e2af Fixup extension / longoffset 2013-11-25 05:32:17 -05:00
Behdad Esfahbod
6b6e9fae23 Rename repeatOffset to aux
To be used for other purposes soon.
2013-11-24 22:11:41 -05:00
Behdad Esfahbod
d58c38dc36 Seprate longOffset from ExtSubTable 2013-11-24 21:58:53 -05:00
Behdad Esfahbod
fe67e3121e Simplify ExtSubTable 2013-11-24 21:35:56 -05:00
Behdad Esfahbod
58acba2d02 Remove "optimization" re Extension lookups
Historically, Extension lookups were only decompiled upon access,
and decompiled Extension lookups were possibly copied verbatim to
output when compiling.  This discrepancy with all other table types
is confusing and undeed.  The possible time saving is not worth the
loss in possible optimization of table data.  Remove.
2013-11-24 20:08:05 -05:00
Behdad Esfahbod
7ef23a85ae Add font.lazy 2013-11-24 19:03:18 -05:00
Behdad Esfahbod
c491f45eff Create subReaders lazily
Should improve memory usage
2013-11-24 18:28:20 -05:00
Behdad Esfahbod
0fac7fe320 Remove unused parameter 2013-11-24 18:15:47 -05:00
Behdad Esfahbod
ee27eb8517 Only propagate counts that are used in sub-tables 2013-11-24 18:15:47 -05:00
Behdad Esfahbod
2edc2da303 Use tableDict for DeltaValue lookbacks
Was abusing the set/getCount machinery before.
2013-11-24 17:10:55 -05:00
Behdad Esfahbod
078b36325d Instead of countVars, pass down tableDict
This is the tableDict of current struct being loaded.  This does NOT
get propagated down.

Currently unused.
2013-11-24 17:08:06 -05:00
Behdad Esfahbod
7981704a0a Move countVars into reader/writer objects
The countVars arguments are all unused now.  Cleanup coming.
2013-11-24 16:59:42 -05:00
Behdad Esfahbod
7d130307e6 Simplify converter mapping for DeltaValue 2013-11-24 16:13:00 -05:00
Behdad Esfahbod
6f9b64f296 Fixup 41caf2d for DeltaValue tables
Not that I can find any fonts having these... Had to construct one
to test.
2013-11-24 16:09:57 -05:00
Behdad Esfahbod
ffc3cfeed1 Allow using binary / octal / hex numbers in XML
In OpenType Layout tables that is.  Most (all) of the other
tables already use safeEval() which accepts these kinds of
things.
2013-11-23 20:18:24 -05:00
Behdad Esfahbod
a221a57ccd Improve Version handling
Version is really just a major.minor, NOT a Fixed.  But it has
been implemented as Fixed.  We now:

  1. Check that major is 1,
  2. If minor is not 0 (only defined for GDEF so far), then
     print the whole thing as hex in XML,
  3. When reading the XML, accept hex,
  4. In all four methods dealing with Version, support both
     fixed version (ie. 1.0), and long version (ie. 0x00010000).
2013-11-23 19:45:29 -05:00
Behdad Esfahbod
0b18ef6111 Remove Fixed vs fixed32 inconsistency 2013-11-23 19:21:24 -05:00
Behdad Esfahbod
ea017bd66f Remove USHORT vs uint16 inconsistency 2013-11-23 19:19:48 -05:00
Behdad Esfahbod
5962268b79 Remove unused "LONG" converter
LONG was replaced by Fixed long time ago.
2013-11-23 19:18:53 -05:00
Behdad Esfahbod
41caf2dea1 Remove tableStack in favor of countVars
We only needed tableStack to look back for counts.  So, just store
counts.  Gives ~8 speedup for large fonts I tested.  We are not
faster than not loading fonts lazily without this patch, so the
laziness patch combined with this doesn't have a net negative
performance impact anymore.
2013-11-22 19:13:14 -05:00
Behdad Esfahbod
0585b64f70 Minor 2013-11-22 16:46:03 -05:00
Behdad Esfahbod
d01c44a59b When lazy-loading tables, copy ValueFormat
Otherwise it may be overwritten before we use it.
2013-11-22 15:21:41 -05:00
Behdad Esfahbod
fc10b20c25 Minor 2013-11-20 21:50:16 -05:00
Behdad Esfahbod
f50d0dff86 Load all OpenType sub-structures lazily
Huge win for subsetter and anyone else who doesn't need the entire
tables.  Subsetting a huge font (eg. NotoSans-Regular.ttf) to a
small set (say, main Cyrillic characters) is something like six
times faster now.  Bulk of time was being spent in blowing up the
GPOS kerning pairs and attach points.  Now we don't load those if
they won't be in the final subset.

Slight slowdown for usecases that need the entire table.
2013-11-20 19:07:08 -05:00
pabs3
3ac875aa1d Fix consistency of space/tab usage.
Reference: http://docs.python.org/reference/lexical_analysis.html#indentation

git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@613 4cde692c-a291-49d1-8350-778aa11640f8
2013-06-12 05:04:24 +00:00
jvr
823f8cd15f Misc patches from rroberts:
fontTools/ttx.py
  # support virtual GIDs, support handling some GSUB offset overflows.

fontTools/ttlib/__init__.py
# 1) make getReverseGlyphMap  a public function; I find a reverse map
to often be useful
# 2) support virtual glyphs, e.g. references to GID's that are not in the font.
# Added the TTFont argument allowVID (default 0) to turn this off and on;
# added the arg requireReal ( default 0) so as to get the obvious
default behaviour when
# allowVID is 0 or 1, but to allow requiring a true GID when allowVID is 1.

fontTools/ttlib/tables/otBase.py
fontTools/ttlib/tables/otConverters.py
fontTools/ttlib/tables/otData.py
fontTools/ttlib/tables/otTables.py
# 1) speed optimization
# - collapse for loops
# - do not decompile extension lookups until a record is requested
from within the lookup.
# 2) handling offset overflows
# 3) support of extension lookups
# 4) Fixed FetauresParam converter class def so as to survive a font
that has this offset non-NULL.
# This fixes a stack dump.
# The data will now just get ignored


git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@511 4cde692c-a291-49d1-8350-778aa11640f8
2006-10-21 14:12:38 +00:00
jvr
52966bb144 minor refactoring
git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@340 4cde692c-a291-49d1-8350-778aa11640f8
2002-09-12 16:45:48 +00:00
jvr
7007a08545 whoops, compile was broken due to Fixed 'fix'
git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@238 4cde692c-a291-49d1-8350-778aa11640f8
2002-05-16 18:12:11 +00:00
jvr
b776a882ee added Fixed type
git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@228 4cde692c-a291-49d1-8350-778aa11640f8
2002-05-13 18:10:05 +00:00
jvr
64b5c80e80 results of morning-after code review, added some doc strings, etc.
git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@210 4cde692c-a291-49d1-8350-778aa11640f8
2002-05-11 10:21:36 +00:00
jvr
d4d151390d Completely revamped OT support; this time it works and is complete. XML output is not yet as pretty as can be.
git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@208 4cde692c-a291-49d1-8350-778aa11640f8
2002-05-11 00:59:27 +00:00