rem: FT_Pos   cur_pos1, cur_pos2, delta1, delta2;
add: FT_Pos   cur_pos1, cur_pos2, delta1, delta2, u_off, d_off;
context:   ah_hint_edges_3( AH_Hinter  hinter )  {    AH_Edge     edges;    AH_Edge     edge_limit;    AH_Outline  outline = hinter->glyph;    FT_Int      dimension;    edges      = outline->horz_edges;    edge_limit = edges + outline->num_hedges;    for ( dimension = 1; dimension >= 0; dimension-- )    {      AH_Edge  edge;      AH_Edge  anchor = 0;      int      has_serifs = 0;      if ( !hinter->do_horz_hints && !dimension )        goto Next_Dimension;      if ( !hinter->do_vert_hints && dimension )        goto Next_Dimension;      /* we begin by aligning all stems relative to the blue zone */      /* if needed -- that's only for horizontal edges            */      if ( dimension )      {        for ( edge = edges; edge < edge_limit; edge++ )        {          FT_Pos*      blue;          AH_EdgeRec  *edge1, *edge2;          if ( edge->flags & AH_EDGE_DONE )            continue;          blue  = edge->blue_edge;          edge1 = 0;          edge2 = edge->link;          if ( blue )          {            edge1 = edge;          }          else if (edge2 && edge2->blue_edge)          {            blue  = edge2->blue_edge;            edge1 = edge2;            edge2 = edge;          }          if ( !edge1 )            continue;          edge1->pos    = blue[0];          edge1->flags |= AH_EDGE_DONE;          if ( edge2 && !edge2->blue_edge )          {            ah_align_linked_edge( hinter, edge1, edge2, dimension );            edge2->flags |= AH_EDGE_DONE;          }          if ( !anchor )            anchor = edge;        }      }      /* now, we will align all stem edges, trying to maintain the */      /* relative order of stems in the glyph..                    */      for ( edge = edges; edge < edge_limit; edge++ )      {        AH_EdgeRec*  edge2;        if ( edge->flags & AH_EDGE_DONE )          continue;        /* skip all non-stem edges */        edge2 = edge->link;        if ( !edge2 )        {          has_serifs++;          continue;        }        /* now, align the stem */        /* this should not happen, but it's better to be safe. */        if ( edge2->blue_edge || edge2 < edge )        {          ah_align_linked_edge( hinter, edge2, edge, dimension );          edge->flags |= AH_EDGE_DONE;          continue;        }        if ( !anchor )        {          edge->pos = ( edge->opos + 32 ) & -64;          anchor    = edge;          edge->flags |= AH_EDGE_DONE;          ah_align_linked_edge( hinter, edge, edge2, dimension );        }        else        {          FT_Pos   org_pos, org_len, org_center, cur_len;          FT_Pos   cur_pos1, cur_pos2, delta1, delta2;          org_pos    = anchor->pos + (edge->opos - anchor->opos);          org_len    = edge2->opos - edge->opos;          org_center = org_pos + ( org_len >> 1 );          cur_len    = ah_compute_stem_width( hinter, dimension, org_len );          cur_pos1   = ( org_pos + 32 ) & -64;          delta1     = ( cur_pos1 + ( cur_len >> 1 ) - org_center );          if ( delta1 < 0 )            delta1 = -delta1;          cur_pos2   = ( ( org_pos + org_len + 32 ) & -64 ) - cur_len;          delta2     = ( cur_pos2 + ( cur_len >> 1 ) - org_center );          if ( delta2 < 0 )            delta2 = -delta2;          edge->pos  = ( delta1 <= delta2 ) ? cur_pos1 : cur_pos2;          edge2->pos = edge->pos + cur_len;          edge->flags  |= AH_EDGE_DONE;          edge2->flags |= AH_EDGE_DONE;          if ( edge > edges && edge->pos < edge[-1].pos )            edge->pos = edge[-1].pos;        }      }      if ( !has_serifs )        goto Next_Dimension;      /* now, hint the remaining edges (serifs and single) in order */      /* to complete our processing                                 */      for ( edge = edges; edge < edge_limit; edge++ )      {        if ( edge->flags & AH_EDGE_DONE )          continue;        if ( edge->serif )          ah_align_serif_edge( hinter, edge->serif, edge, dimension );        else if ( !anchor )        {          edge->pos = ( edge->opos + 32 ) & -64;          anchor    = edge;        }        else          edge->pos = anchor->pos +                      ( ( edge->opos-anchor->opos + 32 ) & -64 );        edge->flags |= AH_EDGE_DONE;        if ( edge > edges && edge->pos < edge[-1].pos )          edge->pos = edge[-1].pos;        if ( edge + 1 < edge_limit        &&             edge[1].flags & AH_EDGE_DONE &&             edge->pos > edge[1].pos      )          edge->pos = edge[1].pos;      }    Next_Dimension:      edges      = outline->vert_edges;      edge_limit = edges + outline->num_vedges;    }  }