static FT_UInt get_glyph_index(const GdiFont *font, UINT glyph) { FT_UInt glyphId; if(font->ft_face->charmap->encoding == FT_ENCODING_NONE) { WCHAR wc = (WCHAR)glyph; BOOL default_used; BOOL *default_used_pointer; FT_UInt ret; char buf; default_used_pointer = NULL; default_used = FALSE; if (codepage_sets_default_used(font->codepage)) default_used_pointer = &default_used; if(!WideCharToMultiByte(font->codepage, 0, &wc, 1, &buf, sizeof(buf), NULL, default_used_pointer) || default_used) { if (font->codepage == CP_SYMBOL && wc < 0x100) ret = pFT_Get_Char_Index(font->ft_face, (unsigned char)wc); else ret = 0; } else ret = pFT_Get_Char_Index(font->ft_face, (unsigned char)buf); TRACE("%04x (%02x) -> ret %d def_used %d\n", glyph, (unsigned char)buf, ret, default_used); return ret; } if(font->ft_face->charmap->encoding == FT_ENCODING_MS_SYMBOL) { if (glyph < 0x100) glyph += 0xf000; /* there is a number of old pre-Unicode "broken" TTFs, which do have symbols at U+00XX instead of U+f0XX */ if (!(glyphId = pFT_Get_Char_Index(font->ft_face, glyph))) glyphId = pFT_Get_Char_Index(font->ft_face, glyph-0xf000); } else glyphId = pFT_Get_Char_Index(font->ft_face, glyph); return glyphId; }