/* You can use this function to map the 16.16 signed values to any format required. Do note that the output buffer is 8-bit, so only use an 8-bit format for  */
map_fixed_to_sdf(FT_16D16 dist, FT_16D16 max_value)
/* You can use this function to map the 16.16 signed values to any format required. Do note that the output buffer is 8-bit, so only use an 8-bit format for  */
map_fixed_to_sdf(FT_16D16 dist, FT_16D16 max_value)
{
    FT_SDFFormat  out;
    FT_16D16      udist;
    dist = FT_DivFix( dist, max_value );
    udist = dist < 0 ? -dist : dist;
    udist >>= 9;
    if ( dist > 0 && udist > 127 )
      udist = 127;
    if ( dist < 0 && udist > 128 )
      udist = 128;
    out = dist < 0 ? 128 - (FT_SDFFormat)udist
                   : (FT_SDFFormat)udist + 128;
    return out;
  }