Commit f667c06a authored by Jeff Latimer's avatar Jeff Latimer Committed by Alexandre Julliard

gdi: Add missing glyph code to GetGlyphIndices and tests.

parent e5d9b2f1
...@@ -2898,11 +2898,25 @@ static FT_UInt get_glyph_index(GdiFont font, UINT glyph) ...@@ -2898,11 +2898,25 @@ static FT_UInt get_glyph_index(GdiFont font, UINT glyph)
DWORD WineEngGetGlyphIndices(GdiFont font, LPCWSTR lpstr, INT count, DWORD WineEngGetGlyphIndices(GdiFont font, LPCWSTR lpstr, INT count,
LPWORD pgi, DWORD flags) LPWORD pgi, DWORD flags)
{ {
INT i; int i;
WCHAR default_char = 0;
TEXTMETRICW textm;
if (flags & GGI_MARK_NONEXISTING_GLYPHS) default_char = 0x001f; /* Indicate non existence */
for(i = 0; i < count; i++) for(i = 0; i < count; i++)
{
pgi[i] = get_glyph_index(font, lpstr[i]); pgi[i] = get_glyph_index(font, lpstr[i]);
if (pgi[i] == 0)
{
if (!default_char)
{
WineEngGetTextMetrics(font, &textm);
default_char = textm.tmDefaultChar;
}
pgi[i] = default_char;
}
}
return count; return count;
} }
......
...@@ -391,6 +391,36 @@ static void test_text_extents(void) ...@@ -391,6 +391,36 @@ static void test_text_extents(void)
ReleaseDC(NULL, hdc); ReleaseDC(NULL, hdc);
} }
static void test_GetGlyphIndices()
{
HDC hdc;
HFONT hfont;
DWORD charcount;
LOGFONTA lf;
DWORD flags = 0;
WCHAR testtext[] = {'T','e','s','t',0xffff,0};
WORD glyphs[(sizeof(testtext)/2)-1];
TEXTMETRIC textm;
memset(&lf, 0, sizeof(lf));
strcpy(lf.lfFaceName, "Symbol");
lf.lfHeight = 20;
hfont = CreateFontIndirectA(&lf);
hdc = GetDC(0);
ok(GetTextMetrics(hdc, &textm), "GetTextMetric failed\n");
flags |= GGI_MARK_NONEXISTING_GLYPHS;
charcount = GetGlyphIndicesW(hdc, testtext, (sizeof(testtext)/2)-1, glyphs, flags);
ok(charcount == 5, "GetGlyphIndices count of glyphs should = 5 not %ld\n", charcount);
ok(glyphs[4] == 0x001f, "GetGlyphIndices should have returned a non existant char not %04x\n", glyphs[4]);
flags = 0;
charcount = GetGlyphIndicesW(hdc, testtext, (sizeof(testtext)/2)-1, glyphs, flags);
ok(charcount == 5, "GetGlyphIndices count of glyphs should = 5 not %ld\n", charcount);
ok(glyphs[4] == textm.tmDefaultChar, "GetGlyphIndices should have returned a %04x not %04x\n",
textm.tmDefaultChar, glyphs[4]);
}
START_TEST(font) START_TEST(font)
{ {
test_logfont(); test_logfont();
...@@ -399,4 +429,5 @@ START_TEST(font) ...@@ -399,4 +429,5 @@ START_TEST(font)
test_GdiGetCharDimensions(); test_GdiGetCharDimensions();
test_GetCharABCWidthsW(); test_GetCharABCWidthsW();
test_text_extents(); test_text_extents();
test_GetGlyphIndices();
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment