Dear Dmitry, Following is a function whose API is similar to FT_Select_Charmap() but ignores non-Microsoft cmap subtables. Does it serve your purpose?
#include <ft2build.h> #include FT_FREETYPE_H #include FT_TRUETYPE_IDS_H /* getting the first cmap subtable for Microsoft platform * matching specified encoding. If encoding is FT_ENCODING_UNICODE, * UCS4 is prioritized than UCS2. */ FT_Error FT_Select_Charmap_Microsoft( FT_Face face, FT_Encoding encoding ) { FT_Int i, chosen_cmap_idx; chosen_cmap_idx = -1; /* -1 means not found */ for ( i = 0; i < face->num_charmaps; i ++ ) { if ( face->charmaps[ i ]->platform_id != TT_PLATFORM_MICROSOFT ) continue; else if ( encoding != FT_ENCODING_UNICODE && face->charmaps[ i ]->encoding == encoding ) { chosen_cmap_idx = i; break; } else if ( face->charmaps[ i ]->encoding_id == TT_MS_ID_UCS_4 ) { chosen_cmap_idx = i; break; } else if ( face->charmaps[ i ]->encoding_id == TT_MS_ID_UNICODE_CS ) { if ( chosen_cmap_idx < 0 ) chosen_cmap_idx = i; } } if ( chosen_cmap_idx < 0 ) return FT_Err_Invalid_CharMap_Handle; return FT_Set_Charmap( face, face->charmaps[ chosen_cmap_idx ] ); } _______________________________________________ Freetype-devel mailing list Freetype-devel@nongnu.org http://lists.nongnu.org/mailman/listinfo/freetype-devel