Hi, what is your intention to "load all characters"? Do you want to cache glyph bitmaps for faster rendering? Freetype Cache Sub-system is not sufficient for you needs? Gernot
2010/11/21 Werner LEMBERG <[email protected]> > > > Is there any way to detect all the available characters in a loaded > > font? > > It depends on how you define `character'. If you mean `I have an > input character code, and I want to know whether the font has a glyph > for it', then the answer is yes. > > > It would be convenient if I had some way to do this: > > > > for (i=0; i<FT_Font_CountChars(font); i++ ) > > { > > c = FT_Font_GetChar( i ); > > //Proceed to load character 'c'... > > } > > Well, just use > > { > FT_ULong charcode; > FT_UInt gindex; > > > charcode = FT_Get_First_Char( face, &gindex ); > while ( gindex != 0 ) > { > ... do something with (charcode,gindex) pair ... > > charcode = FT_Get_Next_Char( face, charcode, &gindex ); > } > } > > to iterate over all characters contained in a given cmap. This is the > example from the documentation of FT_Get_First_Char. > > Note, however, that this is a very naive approach which certainly > fails for non-latin scripts. For example, to properly render > Devanagari scripts, it's not sufficient to use the above code since > there are 112 glyphs defined in the block U+0900 - U+097F but you need > a few hundred glyphs to be accessed via input character code > reordering and heavy use of ligatures. > > You can avoid such hassles if you try one of the various high-level > libraries like Qt, Pango, ICU, or, to a certain extent, libotf. > > > Werner > > _______________________________________________ > Freetype-devel mailing list > [email protected] > http://lists.nongnu.org/mailman/listinfo/freetype-devel >
_______________________________________________ Freetype-devel mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/freetype-devel
