freetype-devel
[Top][All Lists]
Advanced

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

[ft-devel] FreeType and Windows WingDing font...


From: Cork, Ste
Subject: [ft-devel] FreeType and Windows WingDing font...
Date: Thu, 1 Feb 2018 21:56:53 +0000

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, &index );

                                         while ( index != 0 )

                                         {

                                                // [ do stuff here ]

                          

                                                charcode = FT_Get_Next_Char( g_FT_face, charcode, &index );

                                         }

 

.. 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, &gindex );

    }

 

    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

 


reply via email to

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