In fact, even if/when the synthesizing of the Unicode charmap for ZapfDingbats is corrected, so that FT gives you
0: platform 3, encoding 1, language 0 (active) 0x0020 => 1 0x00a0 => 1 0x25bc => 2 you will only get two glyphs (but three characters) with the loop. David %^> -----Original Message----- From: freetype-devel-bounces+david.bevan=pb....@nongnu.org [mailto:freetype-devel-bounces+david.bevan=pb....@nongnu.org] On Behalf Of David Bevan Sent: 26 September 2011 09:13 To: Nicolas Rougier Cc: Freetype-devel@nongnu.org Subject: Re: [ft-devel] FT_Get_Char, FT_Get_Next_Char Nicolas, My response was perhaps too hasty. It wasn't clear what character/glyph you believed you weren't getting. I (possibly incorrectly) assumed that what you wanted was access to the .notdef character (which is what is returned with gindex == 0). As Werner has pointed out, the Unicode charmap (charmap 0) is incorrectly synthesised, so the a77 glyph is not associated with any character. I'm still not sure whether this fact really answers your question. Note the difference between glyphs and characters. The example code returns the glyphs for all the characters defined in the charmap. If you want the .notdef (to use for characters not defined in the charmap), then you need my suggestion. If you want all the glyphs (as opposed to all the characters) in the font, then you can just increment gindex up to face->num_glyphs - 1. Perhaps you already understood all that though. However, you did say: > The actual question was related to the number of glyphs (3) and the > use of first/next char. Am I not supposed to be able to get all > glyphs using them? Obviously I only get 2 of them while I would have > expect 3. The simple answer is "no"; you only get glyphs associated with characters using first/next char. If you had selected charmap 1 (which is correctly handled by FT): 1: platform 7, encoding 2, language 0 0x0020 => 1 0x0074 => 2 then you would (still) get only two characters/glyphs with your loop / the example code. Hth a bit. David %^> -----Original Message----- From: Nicolas Rougier [mailto:nicolas.roug...@inria.fr] Sent: 26 September 2011 08:47 To: David Bevan Cc: Freetype-devel@nongnu.org Subject: Re: [ft-devel] FT_Get_Char, FT_Get_Next_Char 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: freetype-devel-bounces+david.bevan=pb....@nongnu.org > [mailto:freetype-devel-bounces+david.bevan=pb....@nongnu.org] On Behalf Of > Nicolas Rougier > Sent: 23 September 2011 16:52 > To: Freetype-devel@nongnu.org > 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 _______________________________________________ Freetype-devel mailing list Freetype-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/freetype-devel _______________________________________________ Freetype-devel mailing list Freetype-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/freetype-devel