freetype-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Devel] bug in FT_Div64by32, Arial font does not work


From: David Turner
Subject: Re: [Devel] bug in FT_Div64by32, Arial font does not work
Date: Mon, 27 Aug 2001 10:39:57 +0200

Hello Martin,

Martin Muskens a écrit :
> 
> Hi all,
> 
> I found out that many fonts don't work (including the Arial) with the new
> library because of the new routine "FT_Div64by32" in ftcalc.c.
> I replaced that routine with the old one, and now everything works great.
> 
> I did not have the time yet to see what's going on, but I think in some
> cases the routine continues to make recursive calls. ( unfortunately my
> Codewarrior on Macintosh does not support "break execution" so someone
> working on Visual C++ should be able to pinpoint the bug much faster. Well,
> if I have time to spare I will port it to my NT and submit any fix I find.
> 

Strange.. I'm experiencing something different here with the current
snapshot:

   - the TrueType bytecode interpreter seems to work well, except that
     a few monochrome glyphs render a bit incorrectly (mainly the diagonal
     of "K" in Arial, and some latin accents characters..)

   - the auto-hinter produces weird output. It seems there is something
     going wrong in the blue zone alignment currently..

   - when I perform the change you described (and ensuring that the
     64-bits routines are not used), nothing changes at all ??

I'll try to make more tests. Could you describe what you meant with
"fonts don't work ??"

Cheers,

- David Turner

 
> #ifdef OLDROUTINE
>   FT_EXPORT_DEF( FT_Int32 )  FT_Div64by32( FT_Int64*  x,
>                                            FT_Int32   y )
>   {
>     FT_Int32   s;
>     FT_UInt32  q, r, i, lo;
> 
>     s  = x->hi;
>     if ( s < 0 )
>     {
>       x->lo = (FT_UInt32)-(FT_Int32)x->lo;
>       x->hi = ~x->hi + !( x->lo );
>     }
>     s ^= y;  y = ABS( y );
> 
>     /* Shortcut */
>     if ( x->hi == 0 )
>     {
>       if ( y > 0 )
>         q = x->lo / y;
>       else
>         q = 0x7FFFFFFFL;
> 
>       return ( s < 0 ? -(FT_Int32)q : (FT_Int32)q );
>     }
> 
>     r  = x->hi;
>     lo = x->lo;
> 
>     if ( r >= (FT_UInt32)y ) /* we know y is to be treated as unsigned here
> */
>       return ( s < 0 ? 0x80000001UL : 0x7FFFFFFFUL );
>                              /* Return Max/Min Int32 if division overflow.
> */
>                              /* This includes division by zero!
> */
>     q = 0;
>     for ( i = 0; i < 32; i++ )
>     {
>       r <<= 1;
>       q <<= 1;
>       r  |= lo >> 31;
> 
>       if ( r >= (FT_UInt32)y )
>       {
>         r -= y;
>         q |= 1;
>       }
>       lo <<= 1;
>     }
> 
>     return ( s < 0 ? -(FT_Int32)q : (FT_Int32)q );
>   }
> #else
>   FT_EXPORT_DEF( FT_Int32 )
>   FT_Div64by32( FT_Int64*  x,
>                 FT_Int32   y )
>   {
>     FT_Int32   s;
>     FT_UInt32  q;
> 
>     s  = x->hi;
>     if ( s < 0 )
>     {
>       x->lo = (FT_UInt32)-(FT_Int32)x->lo;
>       x->hi = ~x->hi + !( x->lo );
>     }
>     s ^= y;  y = ABS( y );
> 
>     /* Shortcut */
>     if ( x->hi == 0 )
>     {
>       if ( y > 0 )
>         q = ( x->lo + ( y >> 1 ) ) / y;
>       else
>         q = 0x7FFFFFFFL;
> 
>       return ( s < 0 ? -(FT_Int32)q : (FT_Int32)q );
>     }
> 
>     q = ft_div64by32( x->hi, x->lo, y );
> 
>     return ( s < 0 ? -(FT_Int32)q : (FT_Int32)q );
>   }
> #endif
> 
> _______________________________________________
> Devel mailing list
> address@hidden
> http://www.freetype.org/mailman/listinfo/devel



reply via email to

[Prev in Thread] Current Thread [Next in Thread]