freetype-devel
[Top][All Lists]
Advanced

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

Re: [Devel] underlining in freetype2


From: Leonard Rosenthol
Subject: Re: [Devel] underlining in freetype2
Date: Mon, 5 Aug 2002 16:00:29 -0400

At 11:03 AM -0400 8/5/02, Stephen C. North wrote:
We'd like to add this feature to graphviz (www.graphviz.org).

        Excellent!


Do you recommend that we just try to figure out how to do this
by reading ImageMagick or librsvg source, or do you have a
separate patch?  Any advice?

        I don't have a specific patch, but it's pretty easy to do.  You just need to read a couple of fields from the font metrics and then use them to position and draw the line.

From the metrics.
  metrics->underline_position=face->underline_position/64.0;
  metrics->underline_thickness=face->underline_thickness/64.0;
And here is the code from ImageMagick to do position and draw:

    clone_info->affine.tx=offset.x;
    clone_info->affine.ty=offset.y;
    FormatString(primitive,"stroke-width %g line 0,0 %g,0",
      metrics.underline_thickness,metrics.width);
    if (annotate->decorate == OverlineDecoration)
      {
        clone_info->affine.ty-=draw_info->affine.sy*
          (metrics.ascent+metrics.descent)-metrics.underline_position;
        (void) CloneString(&clone_info->primitive,primitive);
        (void) DrawImage(image,clone_info);
      }
    else
      if (annotate->decorate == UnderlineDecoration)
        {
          clone_info->affine.ty-=metrics.underline_position;
          (void) CloneString(&clone_info->primitive,primitive);
          (void) DrawImage(image,clone_info);
        }

Leonard
-- 
---------------------------------------------------------------------------
Leonard Rosenthol                            <mailto:address@hidden>
                                              <http://www.lazerware.com>

reply via email to

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