freetype-devel
[Top][All Lists]
Advanced

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

Re: [Devel] Re: FT_Outline-Contours


From: Jimmy verma
Subject: Re: [Devel] Re: FT_Outline-Contours
Date: Fri, 06 Jun 2003 23:09:20 +0530

Thanks for the explainations. You example makes the picture much more clearer to me. Now if i come back to my previous question. And if i take the points which you have mentioned below.

Quoting from the program:

http://www.atomised.org/docs/XFree86-4.2.1/ftoutln_8c-source.html

starting with line no 80 given along side. Can you tell me what value should i expect in the variable `last' and `limit'


            for ( n = 0; n < outline->n_contours; n++ )
00081     {
00082       FT_Int  last;  /* index of last point in contour */
00083
00084
00085       last  = outline->contours[n];
00086       limit = outline->points + last;
00087
00088       v_start = outline->points[first];
00089       v_last  = outline->points[last];
00090
00091 v_start.x = SCALED( v_start.x ); v_start.y = SCALED( v_start.y );
00092       v_last.x  = SCALED( v_last.x );  v_last.y  = SCALED( v_last.y );
00093
00094       v_control = v_start;
00095
00096       point = outline->points + first;
00097       tags  = outline->tags  + first;
00098       tag   = FT_CURVE_TAG( tags[0] );
00099
00100       /* A contour cannot start with a cubic control point! */
00101       if ( tag == FT_Curve_Tag_Cubic )
00102         goto Invalid_Outline;
00103
00104       /* check first point to determine origin */
00105       if ( tag == FT_Curve_Tag_Conic )
00106       {
00107         /* first point is conic control.  Yes, this happens. */
00108         if ( FT_CURVE_TAG( outline->tags[last] ) == FT_Curve_Tag_On )
00109         {
00110           /* start at last point if it is on the curve */
00111           v_start = v_last;
00112           limit--;
00113         }

From: "|Ron|" <address@hidden>
Reply-To: address@hidden
To: address@hidden
Subject: [Devel] Re: FT_Outline-Contours
Date: Fri,  6 Jun 2003 18:23:44 +0200 (CEST)

> I am having problem with FT_Outline struct of freetype.
> I am not able to visualize this. Can someone explain what is written for
> the explaination.

A contour is a set of points that make up one part of a glyph. Most glyphs
consist of several countours. E.g. the quote char " (ASCII 34) has two
contours (two boxes) and the uppercase B (ASCII 66) has three contours
(one counter-clockwise outside and two clockwise holes inside).

Looking at the contents of FT_Outline for different glyphs certainly helps.
A simple program to dump the structure is attached.

Compile with: cc -o ftoutline ftoutline.c `freetype-config --cflags --libs`
Run with: ./ftoutline <fontfile> <charnum>

The quote char looks like:

$ ./ftoutline /usr/lib/X11/fonts/truetype/verdana.ttf 34
8 points, 2 contours

 0:   772  1556 *
 1:   729   977 *
 2:   597   977 *
 3:   554  1556 *

 4:   386  1556 *
 5:   343   977 *
 6:   211   977 *
 7:   168  1556 *

Try this with different fonts (outline fonts only of course) and different
characters and see what you get.

Note: '*', '+' and '#' mark on-curve points, off-curve 2nd order control
points and off-curve 3rd order control points. Since TrueType fonts use
only 2nd order and Type1 PostScript fonts use only 3rd order control points
you will only get one kind at a time.


_________________________________________________________________
They're big & powerful. The macho mean machines! http://server1.msn.co.in/features/suv/index.asp SUVs are here to stay!




reply via email to

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