diff --git a/win32ss/gdi/ntgdi/freetype.c b/win32ss/gdi/ntgdi/freetype.c index e172c5c537..f9d8980e6a 100644 --- a/win32ss/gdi/ntgdi/freetype.c +++ b/win32ss/gdi/ntgdi/freetype.c @@ -1545,8 +1545,7 @@ static BOOL face_has_symbol_charmap(FT_Face ft_face) for(i = 0; i < ft_face->num_charmaps; i++) { - if (ft_face->charmaps[i]->platform_id == TT_PLATFORM_MICROSOFT && - ft_face->charmaps[i]->encoding == FT_ENCODING_MS_SYMBOL) + if(ft_face->charmaps[i]->encoding == FT_ENCODING_MS_SYMBOL) { return TRUE; } @@ -3165,31 +3164,19 @@ TextIntUpdateSize(PDC dc, for (n = 0; n < face->num_charmaps; n++) { charmap = face->charmaps[n]; - if (charmap->encoding == FT_ENCODING_UNICODE) + DPRINT("Found charmap encoding: %i\n", charmap->encoding); + if (charmap->encoding != 0) { found = charmap; break; } } if (!found) - { - for (n = 0; n < face->num_charmaps; n++) - { - charmap = face->charmaps[n]; - if (charmap->encoding == FT_ENCODING_MS_SYMBOL) - { - found = charmap; - break; - } - } - } - if (!found) { DPRINT1("WARNING: Could not find desired charmap!\n"); } else { - DPRINT("Found charmap encoding: %i\n", found->encoding); error = FT_Set_Charmap(face, found); if (error) { @@ -3214,50 +3201,6 @@ TextIntUpdateSize(PDC dc, return TRUE; } -static inline FT_UInt FASTCALL -get_glyph_index_symbol(FT_Face ft_face, UINT glyph) -{ - FT_UInt ret; - - if (glyph < 0x100) glyph += 0xf000; - /* there are a number of old pre-Unicode "broken" TTFs, which - do have symbols at U+00XX instead of U+f0XX */ - if (!(ret = FT_Get_Char_Index(ft_face, glyph))) - ret = FT_Get_Char_Index(ft_face, glyph - 0xf000); - - return ret; -} - -static inline FT_UInt FASTCALL -get_glyph_index(FT_Face ft_face, UINT glyph) -{ - FT_UInt ret; - - if (face_has_symbol_charmap(ft_face)) - { - ret = get_glyph_index_symbol(ft_face, glyph); - if (ret != 0) - return ret; - } - - return FT_Get_Char_Index(ft_face, glyph); -} - -static inline FT_UInt FASTCALL -get_glyph_index_flagged(FT_Face face, FT_ULong code, DWORD indexed_flag, DWORD flags) -{ - FT_UInt glyph_index; - if (flags & indexed_flag) - { - glyph_index = code; - } - else - { - glyph_index = get_glyph_index(face, code); - } - return glyph_index; -} - /* * Based on WineEngGetGlyphOutline * @@ -3345,8 +3288,12 @@ ftGdiGetGlyphOutline( TEXTOBJ_UnlockText(TextObj); - glyph_index = get_glyph_index_flagged(ft_face, wch, GGO_GLYPH_INDEX, iFormat); - iFormat &= ~GGO_GLYPH_INDEX; + if (iFormat & GGO_GLYPH_INDEX) + { + glyph_index = wch; + iFormat &= ~GGO_GLYPH_INDEX; + } + else glyph_index = FT_Get_Char_Index(ft_face, wch); if (orientation || (iFormat != GGO_METRICS && iFormat != GGO_BITMAP) || aveWidth || pmat2) load_flags |= FT_LOAD_NO_BITMAP; @@ -3788,7 +3735,10 @@ TextIntGetTextExtentPoint(PDC dc, for (i = 0; i < Count; i++) { - glyph_index = get_glyph_index_flagged(face, *String, GTEF_INDICES, fl); + if (fl & GTEF_INDICES) + glyph_index = *String; + else + glyph_index = FT_Get_Char_Index(face, *String); if (EmuBold || EmuItalic) realglyph = NULL; @@ -5616,7 +5566,10 @@ GreExtTextOutW( for (i = iStart; i < Count; i++) { - glyph_index = get_glyph_index_flagged(face, *TempText, ETO_GLYPH_INDEX, fuOptions); + if (fuOptions & ETO_GLYPH_INDEX) + glyph_index = *TempText; + else + glyph_index = FT_Get_Char_Index(face, *TempText); if (EmuBold || EmuItalic) realglyph = NULL; @@ -5718,7 +5671,10 @@ GreExtTextOutW( BackgroundLeft = (RealXStart + 32) >> 6; for (i = 0; i < Count; ++i) { - glyph_index = get_glyph_index_flagged(face, String[i], ETO_GLYPH_INDEX, fuOptions); + if (fuOptions & ETO_GLYPH_INDEX) + glyph_index = String[i]; + else + glyph_index = FT_Get_Char_Index(face, String[i]); error = FT_Load_Glyph(face, glyph_index, FT_LOAD_DEFAULT); if (error) @@ -5833,7 +5789,10 @@ GreExtTextOutW( BackgroundLeft = (RealXStart + 32) >> 6; for (i = 0; i < Count; ++i) { - glyph_index = get_glyph_index_flagged(face, String[i], ETO_GLYPH_INDEX, fuOptions); + if (fuOptions & ETO_GLYPH_INDEX) + glyph_index = String[i]; + else + glyph_index = FT_Get_Char_Index(face, String[i]); if (EmuBold || EmuItalic) realglyph = NULL; @@ -6375,11 +6334,17 @@ NtGdiGetCharABCWidthsW( if (Safepwch) { - glyph_index = get_glyph_index_flagged(face, Safepwch[i - FirstChar], GCABCW_INDICES, fl); + if (fl & GCABCW_INDICES) + glyph_index = Safepwch[i - FirstChar]; + else + glyph_index = FT_Get_Char_Index(face, Safepwch[i - FirstChar]); } else { - glyph_index = get_glyph_index_flagged(face, i, GCABCW_INDICES, fl); + if (fl & GCABCW_INDICES) + glyph_index = i; + else + glyph_index = FT_Get_Char_Index(face, i); } FT_Load_Glyph(face, glyph_index, FT_LOAD_DEFAULT); @@ -6563,11 +6528,17 @@ NtGdiGetCharWidthW( { if (Safepwc) { - glyph_index = get_glyph_index_flagged(face, Safepwc[i - FirstChar], GCW_INDICES, fl); + if (fl & GCW_INDICES) + glyph_index = Safepwc[i - FirstChar]; + else + glyph_index = FT_Get_Char_Index(face, Safepwc[i - FirstChar]); } else { - glyph_index = get_glyph_index_flagged(face, i, GCW_INDICES, fl); + if (fl & GCW_INDICES) + glyph_index = i; + else + glyph_index = FT_Get_Char_Index(face, i); } FT_Load_Glyph(face, glyph_index, FT_LOAD_DEFAULT); if (!fl) @@ -6679,7 +6650,7 @@ NtGdiGetGlyphIndicesW( if (FT_IS_SFNT(Face)) { TT_OS2 *pOS2 = FT_Get_Sfnt_Table(Face, ft_sfnt_os2); - DefChar = (pOS2->usDefaultChar ? get_glyph_index(Face, pOS2->usDefaultChar) : 0); + DefChar = (pOS2->usDefaultChar ? FT_Get_Char_Index(Face, pOS2->usDefaultChar) : 0); } else { @@ -6723,7 +6694,7 @@ NtGdiGetGlyphIndicesW( for (i = 0; i < cwc; i++) { - Buffer[i] = get_glyph_index(FontGDI->SharedFace->Face, Safepwc[i]); + Buffer[i] = FT_Get_Char_Index(FontGDI->SharedFace->Face, Safepwc[i]); if (Buffer[i] == 0) { Buffer[i] = DefChar;