freetype-devel
[Top][All Lists]
Advanced

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

Re: [ft-devel] Implementation error of the FreeType2 function FT_Get_MM_


From: James Cloos
Subject: Re: [ft-devel] Implementation error of the FreeType2 function FT_Get_MM_Var()
Date: Fri, 28 Nov 2008 16:38:08 -0500
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.0.60 (gnu/linux)

>>>>> "JHC" == James Cloos <address@hidden> writes:

JHC> When it does report a false value, it is always the case that:

JHC>      (master->axis[i].def)<<16 == master->axis[i].minimum

Or, put another way, for every error I saw it was the case that:

  master->axis[i].minimum == FT_INT_TO_FIXED(master->axis[i].def)

t1load.c:T1_Get_MM_Var() does:

      mmvar->axis[i].minimum = FT_INT_TO_FIXED( mmaster.axis[i].minimum);
      mmvar->axis[i].maximum = FT_INT_TO_FIXED( mmaster.axis[i].maximum);
      mmvar->axis[i].def     = ( mmvar->axis[i].minimum +
                                   mmvar->axis[i].maximum ) / 2;

and then later updated .def with:

        mmvar->axis[i].def = mm_axis_unmap( &blend->design_map[i],
                                            axiscoords[i] );

but only if ( blend->num_designs == 1U << blend->num_axis ).

mm_axis_unmap() looks like:

  FT_LOCAL_DEF( FT_Fixed )
  mm_axis_unmap( PS_DesignMap  axismap,
                 FT_Fixed      ncv )
  {
    int  j;

    if ( ncv <= axismap->blend_points[0] )
      return axismap->design_points[0];

    for ( j = 1; j < axismap->num_points; ++j )
    {
      if ( ncv <= axismap->blend_points[j] )
      {
        FT_Fixed  t = FT_MulDiv( ncv - axismap->blend_points[j - 1],
                                 0x10000L,
                                 axismap->blend_points[j] -
                                   axismap->blend_points[j - 1] );

        return FT_INT_TO_FIXED( axismap->design_points[j - 1] ) +
                 FT_MulDiv( t,
                            axismap->design_points[j] -
                              axismap->design_points[j - 1],
                            1L );
      }
    }

    return axismap->design_points[axismap->num_points - 1];
  }

The design_points and blend_points are created by:

        map->design_points[p] = T1_ToInt( parser );
        map->blend_points [p] = T1_ToFixed( parser, 0 );

That means that mm_axis_unmap returns Int values if ncv is out of range
and Fixed values if it is in range.

I'll post a proposed patch momentarily.

-JimC
-- 
James Cloos <address@hidden>         OpenPGP: 1024D/ED7DAEA6




reply via email to

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