I haven't had a chance to look at your repo yet, but if we can remove most of the list commands wrapping map and dict that would be great.

I have started looking at the str, unicode and bytes issue.  The only way I've been able to do this is by importing unicode_literals and then running TTX and fixing each error as it appears.  It's going to be hard to verify that all of the strings have been updated correctly.


On 25 November 2013 17:06, Andrew Miller <> wrote:

I've been testing using individual fonts. but hadn't run a test against a large number of fonts.  I've now written a script to batch convert a directory of fonts from ttf into ttx, and then back into ttf.

I ran it against a directory containing 34 fonts using the original version of TTX and the version with my revisions, then compared the results.

The time taken was almost identical (408.74 seconds versus 409.39 seconds).  This was on a Windows machine so I'm not sure if cStringIO is being used.

The *.ttx files were identical.  The *.ttf files were almost identical, apart from 6 bytes which I presume are timestamps (bytes 0x102 - 0x103, 0x196 - 0x197, 0x1AE - 0x1AF).

These were all Windows fonts - does anyone have any AAT fonts, fonts with unusual tables or CMAP formats etc?

Regarding the division operator, I've tried to work out which are integer and which are real division operators.  I think I caught them all, but I may have missed a few.  psCharStrings had a strange "if" condition (line 842) that I couldn't quite understand the purpose of.

Python 2.7 has dict comprehensions (PEP 274) that could be used to replace wrapping dict with list.  It would mean losing compatibility with 2.6.

Tuple parameter unpacking has been removed from 3.x - see PEP 3113.


On 23 November 2013 06:50, Denis Jacquerye <> wrote:

I have been working on making fonttools work on both Python 2 and 3 as well.
Sorry I hadn't shared my code before.
There’s quite a few cases where there is no need to wrap in list as
iterators are fine and only used for loops.
There’s only a few cases where they need to be as lists, sometimes
sorted or reversed.
I’ve updated my code at

I haven't been able to work on the str, unicode and bytes issue yet.


On Fri, Nov 22, 2013 at 10:39 AM, Andrew Miller <> wrote:
> Hi Behdad,
> I applied the following 2to3 fixes to make the code compliant:
> Replacing map with list comprehensions is probably better.  I'm not that
> familiar with either map or list comprehensions so I've left them as they
> are for now.
> Thanks,
> Andrew
> On 22 November 2013 00:32, Behdad Esfahbod <> wrote:
>> On 13-11-21 11:04 AM, Andrew Miller wrote:
>> > I have been working on a number of fixes to make FontTools compatible
>> > with
>> > Python 3.x.  I am having trouble creating a fork in Sourceforge (getting
>> > a
>> > HTTP 500 error), so for now I have hosted a git repository on BitBucket
>> > at
>> >
>> Hi Andrew,
>> I took a quick look.  Looks good.  A few comments:
>>   - Instead of "Wrapped map methods with calls to list()", perhaps just
>> replace them with list comprehension?  Ie. instead of
>> list(map(string.atoi,
>> things)), do [string.atoi(x) for x in things]?
>>   - Re "Wrapped dict methods with calls to list()", is there not a better
>> way
>> recommended to do this?  I don't know.  Just asking.
>> I plan to pick these up in my tree ( soon.
>> Cheers,
>> --
>> behdad
> ------------------------------------------------------------------------------
> Shape the Mobile Experience: Free Subscription
> Software experts and developers: Be at the forefront of tech innovation.
> Intel(R) Software Adrenaline delivers strategic insight and game-changing
> conversations that shape the rapidly evolving mobile landscape. Sign up now.
> _______________________________________________
> FontTools-discussion mailing list

Denis Moyogo Jacquerye
African Network for Localisation
Nkótá ya Kongó míbalé ---
DejaVu fonts ---