freetype
[Top][All Lists]
Advanced

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

[Freetype] glyph-outlines


From: Daniel Bisig
Subject: [Freetype] glyph-outlines
Date: 2 Jun 2004 21:26:17 +0200

Hi all,

I'm having troubles in correctly reading the outline of a glyph. When looking at the points that define the outline I get a list of points which are highly redundant and don't make sense at all. A typical output of a glyph outline my program produces looks like this:

index 67 glyph_index: 60
outline 0 from point 0 to point 27
point 0 on curve x 0 y 128
point 1 on curve x 0 y 128
point 2 off conic x 0 y 128
point 3 on curve x 0 y 128
point 4 off conic x 0 y 128
point 5 on curve x 0 y 128
etc.....

The code fragment which produces this output looks like this (some error checking code has been removed for the sake of brevity):


CharToSplineConverter :: getCharacterOutline(
* p_fontFileName, p_charIndex, FT_Outline& p_outline)
{
FT_Face face;
FT_OutlineGlyph outlineGlyph;
glyph_index;

error = FT_New_Face(s_ftLibrary, p_fontFileName,
, &face);
glyph_index = FT_Get_Char_Index(face, p_charIndex);

printf(
"index %d glyph_index: %d\n", p_charIndex, glyph_index);

error = FT_Load_Glyph(face, glyph_index, FT_LOAD_DEFAULT );
p_outline = face->glyph->outline;


outlineEndIndex, outlineStartIndex;
point_tag;


outlineEndIndex =
;
outlineStartIndex =
;


i=; i<p_outline.n_contours; i++)
{
outlineEndIndex = p_outline.contours[i];


printf(
" outline %d from point %d to point %d\n", i, outlineStartIndex, outlineEndIndex);


j=outlineStartIndex; j <= outlineEndIndex; j++)
{
point_tag = p_outline.tags[j];
printf(
" point %d ", j);


(point_tag == FT_Curve_Tag_On) printf("on curve ");
(point_tag == FT_Curve_Tag_Conic) printf("off conic ");
(point_tag == FT_Curve_Tag_Cubic) printf("off cubic ");
printf(
" x %d y %d\n", p_outline.points[j].x, p_outline.points[j].y);
}


outlineStartIndex = outlineEndIndex +
;
}


;
}

I have tested a bunch of different true type fonts and different characters but always end up with these highly reduntant list of points which lie on top of each other. What the heck am I doing wrong?

Any advice will be highly appreciated!

Thanks and best regards

Daniel
reply via email to

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