freetype
[Top][All Lists]
Advanced

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

[ft] Outline questions


From: Michele Petrazzo
Subject: [ft] Outline questions
Date: Thu, 11 Aug 2005 09:21:27 +0200
User-agent: Mozilla Thunderbird 1.0 (X11/20041206)

Hello list,
with some code that I found on this list :), I retrieve a character
glyph outline's (for now a simple "I" into Arial font).
All work well, but I have two questions:

with this code [1], I see that freetype say me:

 outline 0 from point 0 to point 3
 point 0  x 384 y 0
 point 1  x 832 y 0
 point 2  x 832 y 2296
 point 3  x 384 y 2296
 outline 1 from point 4 to point 0
 outline 2 from point 1 to point 0
 outline 3 from point 1 to point 0

so, what outline 1,2,3 are saying me? what is the point 4 (outline 1)?
What is the right method for read those informations? (is this are the
right method for read and talk to outlines :) )

--
With the fontforge program, I modify my font ("I" character transformed
into an "I" with two straight lines and the other two oblique) to see
what freetype say me, an with a big surprise, I see this output:

 outline 0 from point 0 to point 3
 point 0  x 384 y 0
 point 1  x 832 y 0
 point 2 on curve  x 951 y 2257
 point 3  x 384 y 2298
 outline 1 from point 4 to point 0
 outline 2 from point 1 to point 0
 outline 3 from point 1 to point 0

So it say me that there are a curve on my glyph?

Thanks a lot,
Michele
Italy


[1]

slot = face->glyph;

for ( int n = 0; n < num_chars; n++ ) {
 error = FT_Load_Char( face, text[n], FT_LOAD_DEFAULT);
 outline = slot->outline;
 points = outline.points;
 for ( int p = 0; p < outline.n_points; p++ ) {
  outlineEndIndex = outline.contours[p];
printf(" outline %d from point %d to point %d\n", p, outlineStartIndex, outlineEndIndex);
  for ( int j=outlineStartIndex; j <= outlineEndIndex; j++) {
    point_tag = outline.tags[j];
    printf(" point %d ", j);
    if (point_tag == FT_Curve_Tag_On) { printf("on curve ");  }
    if (point_tag == FT_Curve_Tag_Conic) { printf("off conic "); }
    if (point_tag == FT_Curve_Tag_Cubic) { printf("off cubic "); }
    printf(" x %d y %d\n", outline.points[j].x, outline.points[j].y);
  }
  outlineStartIndex = outlineEndIndex + 1;
 }
}




reply via email to

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