Tal,

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.

Andrew


On 23 November 2013 06:50, Denis Jacquerye <moyogo@gmail.com> wrote:
Hi,

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 https://github.com/moyogo/fonttools/tree/py2and3

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

Cheers

On Fri, Nov 22, 2013 at 10:39 AM, Andrew Miller <A.J.Miller@bcs.org.uk> wrote:
> Hi Behdad,
>
> I applied the following 2to3 fixes to make the code compliant:
>
> http://docs.python.org/2/library/2to3.html#2to3fixer-dict
> http://docs.python.org/2/library/2to3.html#2to3fixer-map
>
> 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 <behdad@behdad.org> 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
>> > https://bitbucket.org/Milla/fonttools.
>>
>> 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 (github.com/behdad/fonttools) soon.
>>
>> Cheers,
>>
>> --
>> behdad
>> http://behdad.org/
>
>
>
> ------------------------------------------------------------------------------
> 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.
> http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk
> _______________________________________________
> FontTools-discussion mailing list
> FontTools-discussion@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/fonttools-discussion
>



--
Denis Moyogo Jacquerye
African Network for Localisation http://www.africanlocalisation.net/
Nkótá ya Kongó míbalé --- http://info-langues-congo.1sd.org/
DejaVu fonts --- http://www.dejavu-fonts.org/