In the end, for windows symbol fonts I did this, it seems to work:
const FT_ULong uGlyphLimit = ( m_FontRenderInfo.m_bDebugDrawFontOver64K ) ?
0x10 : 0x1;
for ( FT_ULong uGlyph = 0;
uGlyph < uGlyphLimit; uGlyph++ )
{
FT_Error ftError =
FT_Load_Char( g_FT_face, uGlyph, FT_LOAD_BITMAP_METRICS_ONLY );
if ( !ftError )
{
// [do
stuff ]
}
}
}
Even at over 1.1 million iterations when doing >64k mode, it still takes less
than 1 second even in debug mode, so nice work on the libraries, gents ;-)
-Ste.
From: Cork, Ste
Sent: Thursday, February 1, 2018 3:57 PM
To: 'freetype-devel@nongnu.org'
Subject: FreeType and Windows WingDing font...
I have a font viewer that uses your freetype library. It displays all Windows
fonts correctly except the WebDings/Wingdings ones.
Your suggested iteration code is this:
FT_UInt index;
FT_ULong charcode = FT_Get_First_Char(
g_FT_face, );
while ( index != 0 )
{
// [ do stuff here ]
charcode = FT_Get_Next_Char(
g_FT_face, charcode, );
}
.. which works on all fonts except the ones mentioned above. On those, the
first call fails immediately because face->charmap == NULL
FT_Get_First_Char( FT_Face face,
FT_UInt *agindex )
{
FT_ULong result = 0;
FT_UInt gindex = 0;
/* only do something if we have a charmap, and we have glyphs at all */
if ( face && face->charmap && face->num_glyphs )
{
gindex = FT_Get_Char_Index( face, 0 );
if ( gindex == 0 )
result = FT_Get_Next_Char( face, 0, );
}
if ( agindex )
*agindex = gindex;
return result;
}
... but in that same viewer, if I tell it to use the Wingdings font and display
an ordinary string ( e.g. "Hello World" ) it works fine. So the chars are there
when asked for, but your iteration code is failing. What gives?
i.e. normal view-string mode ( not view-font ) calls this:
FT_Error m_FT_error = FT_Load_Char( g_FT_face, letterToLoad,
FT_LOAD_RENDER );
.. which works on WingDings because if face->charmap doesn't exist you simply
carry on...
FT_Load_Char( FT_Face face,
FT_ULong char_code,
FT_Int32 load_flags )
{
FT_UInt glyph_index;
if ( !face )
return FT_THROW( Invalid_Face_Handle );
glyph_index = (FT_UInt)char_code;
if ( face->charmap )
glyph_index = FT_Get_Char_Index( face, char_code );
return FT_Load_Glyph( face, glyph_index, load_flags );
}
... so how do I ask WingDings what glyphs are in the font if your recommended
iteration loop doesn't work?
Regards,
Ste Cork
Tech Programmer
Raven Software
___
Freetype-devel mailing list
Freetype-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/freetype-devel