1198 Commits

Author SHA1 Message Date
Behdad Esfahbod
3fa26d783f py23 Use fixedToFloat() for fixed version numbers 2013-11-28 18:53:30 -05:00
Behdad Esfahbod
1336105c31 py23 Use fixedToFloat() in glyf table
Sample output:

Before: <component ... scale="0.599975585938" flags="0x1004"/>
After:  <component ... scale="0.6" flags="0x1004"/>

Now the Python 2 and 3 outputs agree on these.
2013-11-28 18:53:30 -05:00
Behdad Esfahbod
2d67a188b1 py23 Add fixedTools: Smart fixedToFloat() and floatToFixed()
Apparently Python 2 and Python 3 have different default
print precisions for floats.  Or at least with my build it
is the case.   As such, for example with amiri-regular.ttf
I see these annoying differences in the ttx output of the
two versions:

77203c77203
<       <component ... scale="0.5999755859375" flags="0x1004"/>
---
>       <component ... scale="0.599975585938" flags="0x1004"/>

That's just gross.  Specially when these numbers are show to
humans, while we know that's just 0.6.  The fixedToFloat()
routine in this module is smart enough to do that.

Not used yet.
2013-11-28 18:53:30 -05:00
Behdad Esfahbod
4069b39047 Simplify caselessSort() 2013-11-28 18:53:30 -05:00
Behdad Esfahbod
fd68c9d251 py23 Fixup SING/META tables
They have been totally broken for years.
2013-11-28 18:53:30 -05:00
Behdad Esfahbod
e388db566b py23 Use new-style classes
Such that we get the same semantics in both Python 2 and 3.
2013-11-28 18:53:30 -05:00
Behdad Esfahbod
b475c03b4d [inspect] py23 Use new-style classes 2013-11-28 18:53:30 -05:00
Behdad Esfahbod
1f26289013 [subset] py23 Use new-style classes 2013-11-28 18:53:30 -05:00
Behdad Esfahbod
1edfe57656 Strip name table records before writing to XML
They will be stripped reading back anyone, so any surrounding
whitespace will be lost.  At least this way diffs of ttx files
are cleaner.
2013-11-28 18:53:30 -05:00
Behdad Esfahbod
ca80208a15 Revert XML name table format changes
For the sake of separating py23 effort from feature changes,
I'm reverting the name table XML dump format back to what it
was.  I will clean it up after py23 is merged.
2013-11-28 17:33:23 -05:00
Behdad Esfahbod
1a3909756d Pad DSIG table to even length
Looks like other font generators do.
2013-11-28 17:32:44 -05:00
Behdad Esfahbod
714b2a6141 Remove __getslice__
Not needed.  __getitem__ handles it just fine.
2013-11-28 17:32:44 -05:00
Behdad Esfahbod
d1ba7b53a4 ps23 Fix CFF glyphname encodings 2013-11-28 17:32:44 -05:00
Behdad Esfahbod
278c88c0af py23 Fix psCharStrings bytes issues 2013-11-28 17:32:44 -05:00
Behdad Esfahbod
024d15317f py23 Fix CFF string encodings 2013-11-28 17:32:44 -05:00
Behdad Esfahbod
c076261598 s/latin-1/latin1/g 2013-11-28 17:32:44 -05:00
Behdad Esfahbod
5e1e8f6890 py23 More bytes fixes 2013-11-28 17:32:44 -05:00
Behdad Esfahbod
c0a9d697f6 Simplify read/writeUint24() 2013-11-28 17:32:44 -05:00
Behdad Esfahbod
2242b26742 Fix cmap UVS encode/decode on big-endian systems
Previous code didn't make any sense.
2013-11-28 17:32:43 -05:00
Behdad Esfahbod
43e4b3d256 py23 cmap bytes fix 2013-11-28 17:32:43 -05:00
Behdad Esfahbod
816df48e03 py23 Fix DSIG encoding/decoding 2013-11-28 17:32:43 -05:00
Behdad Esfahbod
faaca764a1 py23 Fixup isinstance(..., str) issues 2013-11-28 17:32:43 -05:00
Behdad Esfahbod
4be8db031d Fix up EBLC/EBDT non-lazy decompile
Fallout from 3d8d5cd10d2d30ba9997b7cc43336e504111be9a.
2013-11-28 17:32:43 -05:00
Behdad Esfahbod
6962f0cfb2 py23 XML encoding fixes
Name table entries that are Unicode are written out as native Unicode
now text in the XML now.
2013-11-28 17:32:43 -05:00
Behdad Esfahbod
5f6418d9e1 py23 Turn Unicode XML parsing on; more bytes fixes 2013-11-28 17:32:43 -05:00
Behdad Esfahbod
18316aa769 ps23 More bytes fixes. All ''join()'s fixed 2013-11-28 17:32:43 -05:00
Behdad Esfahbod
d3689390a6 py23 Fix up byteord() implementation 2013-11-28 17:32:43 -05:00
Behdad Esfahbod
3e8795d99a py23 Use io.BytesIO to replace StringIO.StringIO 2013-11-28 17:32:43 -05:00
Behdad Esfahbod
821572c9a9 py23 Add bytesjoin() 2013-11-28 17:32:43 -05:00
Behdad Esfahbod
1fcd04db70 py23 Fix sstruct exception format 2013-11-28 17:32:43 -05:00
Behdad Esfahbod
a0cd41ddf0 py23 Automatically convert str/bytes types in sstruct.pack/unpack 2013-11-28 17:32:43 -05:00
Behdad Esfahbod
5cf4008336 py23 tostr()/tobytes() and using them
ttf->xml seems to be mostly working now.
2013-11-28 17:32:43 -05:00
Behdad Esfahbod
b7fd2e1913 py23 Remove uses of __cmp__ and cmp() 2013-11-28 17:32:42 -05:00
Behdad Esfahbod
960280bbd6 py23 Use more Tag() 2013-11-28 17:32:42 -05:00
Behdad Esfahbod
319c5fd10e py23 introduce byteord() and use it 2013-11-28 17:32:42 -05:00
Behdad Esfahbod
b21c9d36ee [subset] py23 fix str usage 2013-11-28 17:32:42 -05:00
Behdad Esfahbod
d2f5d2f8b4 py23 use Tag in ttLib/__init__ 2013-11-28 17:32:42 -05:00
Behdad Esfahbod
32c10eecff py23 from __future__ import division and adjust divisions 2013-11-28 17:32:42 -05:00
Behdad Esfahbod
a030a0d25f [subset] py23 from __future__ import division and adjust divisions 2013-11-27 17:46:15 -05:00
Behdad Esfahbod
aa9cc89b29 [inspect] py23 from __future__ import division and adjust divisions 2013-11-27 17:46:06 -05:00
Behdad Esfahbod
30e691edd0 py23 from __future__ import print_function 2013-11-27 17:27:45 -05:00
Behdad Esfahbod
cfeafd79cd [subset] py23 from __future__ import print_function 2013-11-27 17:27:35 -05:00
Behdad Esfahbod
b21c903fa3 [inspect] py23 from __future__ import print_function 2013-11-27 17:27:22 -05:00
Behdad Esfahbod
ac4672e451 py23 Introduce Tag to autoconvert tag types 2013-11-27 16:44:53 -05:00
Behdad Esfahbod
b7a2d797a4 py23 Use bytechr() instead of chr() 2013-11-27 15:25:00 -05:00
Behdad Esfahbod
7ed91eca1e py23 import in all nontrivial source files and unused import cleanup 2013-11-27 15:25:00 -05:00
Behdad Esfahbod
36e20ff473 [subset] py23 import 2013-11-27 15:25:00 -05:00
Behdad Esfahbod
bb0beb7385 2to3 Use py23 to close some of the bytes/str/unicode gaps 2013-11-27 15:25:00 -05:00
Behdad Esfahbod
4a818a2b98 [inspect] Use py23 2013-11-27 15:25:00 -05:00
Behdad Esfahbod
503179f2ed Add py23 compat layer 2013-11-27 15:24:57 -05:00