Akihiro Sagawa : gdi32: Return ANSI character code as glyph index for bitmap fonts.
Alexandre Julliard
julliard at winehq.org
Wed Dec 11 13:05:46 CST 2013
Module: wine
Branch: master
Commit: 882398b0a9f4bae83a2ca1cdf576289c8938fc79
URL: http://source.winehq.org/git/wine.git/?a=commit;h=882398b0a9f4bae83a2ca1cdf576289c8938fc79
Author: Akihiro Sagawa <sagawa.aki at gmail.com>
Date: Wed Dec 11 21:11:15 2013 +0900
gdi32: Return ANSI character code as glyph index for bitmap fonts.
---
dlls/gdi32/freetype.c | 32 ++++++++++++++++++++++++++++++--
1 files changed, 30 insertions(+), 2 deletions(-)
diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c
index cbaddd2..716c74d 100644
--- a/dlls/gdi32/freetype.c
+++ b/dlls/gdi32/freetype.c
@@ -5998,7 +5998,7 @@ static FT_UInt get_glyph_index(const GdiFont *font, UINT glyph)
}
else
ret = pFT_Get_Char_Index(font->ft_face, (unsigned char)buf);
- TRACE("%04x (%02x) -> ret %d def_used %d\n", glyph, buf, ret, default_used);
+ TRACE("%04x (%02x) -> ret %d def_used %d\n", glyph, (unsigned char)buf, ret, default_used);
return ret;
}
@@ -6015,6 +6015,34 @@ static FT_UInt get_glyph_index(const GdiFont *font, UINT glyph)
return glyphId;
}
+/* helper for freetype_GetGlyphIndices */
+static FT_UInt get_gdi_glyph_index(const GdiFont *font, UINT glyph)
+{
+ WCHAR wc = (WCHAR)glyph;
+ BOOL default_used = FALSE;
+ BOOL *default_used_pointer = NULL;
+ FT_UInt ret;
+ char buf;
+
+ if(font->ft_face->charmap->encoding != FT_ENCODING_NONE)
+ return get_glyph_index(font, glyph);
+
+ 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 = (unsigned char)wc;
+ else
+ ret = 0;
+ }
+ else
+ ret = (unsigned char)buf;
+ TRACE("%04x (%02x) -> ret %d def_used %d\n", glyph, (unsigned char)buf, ret, default_used);
+ return ret;
+}
+
static FT_UInt get_default_char_index(GdiFont *font)
{
FT_UInt default_char;
@@ -6061,7 +6089,7 @@ static DWORD freetype_GetGlyphIndices( PHYSDEV dev, LPCWSTR lpstr, INT count, LP
for(i = 0; i < count; i++)
{
- pgi[i] = get_glyph_index(physdev->font, lpstr[i]);
+ pgi[i] = get_gdi_glyph_index(physdev->font, lpstr[i]);
if (pgi[i] == 0)
{
if (!got_default)
More information about the wine-cvs
mailing list