freetype-devel
[Top][All Lists]
Advanced

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

Re: [ft-devel] FT_Get_Char, FT_Get_Next_Char


From: Nicolas Rougier
Subject: Re: [ft-devel] FT_Get_Char, FT_Get_Next_Char
Date: Mon, 26 Sep 2011 09:46:48 +0200


I used the example code from the documentation:
http://freetype.sourceforge.net/freetype2/docs/reference/ft2-base_interface.html#FT_Get_First_Char

I'm not sure the do{} while() your proposed would change anything (I'm getting 
0 as a charcode after the loop).


Nicolas



On Sep 26, 2011, at 9:38 , David Bevan wrote:

> Nicolas,
> 
> It looks to me like you terminate the loop too early. gindex == 0 is the last 
> glyph; you could use do {} while (); rather than while () {}.
> 
> David %^>
> 
> ________________________________________
> From: address@hidden [mailto:address@hidden On Behalf Of Nicolas Rougier
> Sent: 23 September 2011 16:52
> To: address@hidden
> Subject: [ft-devel] FT_Get_Char, FT_Get_Next_Char
> 
> 
> 
> Hi folks,
> 
> 
> Using the following code with the attached (very small) font:
> 
> #include <stdio.h>
> #include <ft2build.h>
> #include FT_FREETYPE_H
> 
> int main(int argc, char **argv)
> {
>    FT_Face face;
>    FT_UInt gindex;
>    FT_ULong charcode;                                              
>    FT_Library library;
> 
>    FT_Init_FreeType( &library );
>    FT_New_Face( library, "./zapf.cff", 0, &face );
> 
>    fprintf( stderr, "Num glyphs: %ld\n", face->num_glyphs );
> 
>    charcode = FT_Get_First_Char( face, &gindex );
>    while ( gindex != 0 )
>    {
>        fprintf( stderr, "char: %ld (index = %d)\n", charcode, gindex );
>        charcode = FT_Get_Next_Char( face, charcode, &gindex );
>    };
> 
>    FT_Done_Face( face );
>    FT_Done_FreeType( library );
> }
> 
> I'm getting the following output:
> 
> Num glyphs: 3
> char: 32 (index = 1)
> char: 160 (index = 1)
> How do I get the last char ? (or did I do something wrong ?)
> Nicolas




reply via email to

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