gdi32: GetGlyphIndices doesn't substitute glyph.

This commit is contained in:
Kusanagi Kouichi 2012-01-10 19:08:03 +09:00 committed by Alexandre Julliard
parent 2dda47fe6f
commit fecb1d8b6f
2 changed files with 18 additions and 7 deletions

View file

@ -4988,7 +4988,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);
return get_GSUB_vert_glyph(font,ret);
return ret;
}
if(font->ft_face->charmap->encoding == FT_ENCODING_MS_SYMBOL)
@ -5001,7 +5001,7 @@ static FT_UInt get_glyph_index(const GdiFont *font, UINT glyph)
}
else glyphId = pFT_Get_Char_Index(font->ft_face, glyph);
return get_GSUB_vert_glyph(font,glyphId);
return glyphId;
}
/*************************************************************
@ -6373,7 +6373,10 @@ static BOOL get_glyph_index_linked(GdiFont *font, UINT c, GdiFont **linked_font,
*linked_font = font;
if((*glyph = get_glyph_index(font, c)))
{
*glyph = get_GSUB_vert_glyph(font, *glyph);
return TRUE;
}
LIST_FOR_EACH_ENTRY(child_font, &font->child_fonts, CHILD_FONT, entry)
{
@ -6384,6 +6387,7 @@ static BOOL get_glyph_index_linked(GdiFont *font, UINT c, GdiFont **linked_font,
if(!child_font->font->ft_face)
continue;
g = get_glyph_index(child_font->font, c);
g = get_GSUB_vert_glyph(child_font->font, g);
if(g)
{
*glyph = g;

View file

@ -4070,13 +4070,14 @@ todo_wine
DeleteFile(ttf_name);
}
static void check_vertical_font(const char *name, BOOL *installed, BOOL *selected, GLYPHMETRICS *gm)
static void check_vertical_font(const char *name, BOOL *installed, BOOL *selected, GLYPHMETRICS *gm, WORD *gi)
{
LOGFONTA lf;
HFONT hfont, hfont_prev;
HDC hdc;
char facename[100];
DWORD ret;
static const WCHAR str[] = { 0x2025 };
*installed = is_truetype_font_installed(name);
@ -4112,6 +4113,9 @@ static void check_vertical_font(const char *name, BOOL *installed, BOOL *selecte
if (!*selected)
memset(gm, 0, sizeof *gm);
ret = pGetGlyphIndicesW(hdc, str, 1, gi, 0);
ok(ret != GDI_ERROR, "GetGlyphIndicesW failed\n");
SelectObject(hdc, hfont_prev);
DeleteObject(hfont);
ReleaseDC(NULL, hdc);
@ -4123,10 +4127,11 @@ static void test_vertical_font(void)
int num;
BOOL ret, installed, selected;
GLYPHMETRICS gm;
WORD hgi, vgi;
if (!pAddFontResourceExA || !pRemoveFontResourceExA)
if (!pAddFontResourceExA || !pRemoveFontResourceExA || !pGetGlyphIndicesW)
{
win_skip("AddFontResourceExA is not available on this platform\n");
win_skip("AddFontResourceExA or GetGlyphIndicesW is not available on this platform\n");
return;
}
@ -4139,20 +4144,22 @@ static void test_vertical_font(void)
num = pAddFontResourceExA(ttf_name, FR_PRIVATE, 0);
ok(num == 2, "AddFontResourceExA should add 2 fonts from vertical.ttf\n");
check_vertical_font("@WineTestVertical", &installed, &selected, &gm);
check_vertical_font("@WineTestVertical", &installed, &selected, &gm, &hgi);
ok(installed, "@WineTestVertical is not installed\n");
ok(selected, "@WineTestVertical is not selected\n");
ok(gm.gmBlackBoxX > gm.gmBlackBoxY,
"gmBlackBoxX(%u) should be greater than gmBlackBoxY(%u) if horizontal\n",
gm.gmBlackBoxX, gm.gmBlackBoxY);
check_vertical_font("@@WineTestVertical", &installed, &selected, &gm);
check_vertical_font("@@WineTestVertical", &installed, &selected, &gm, &vgi);
ok(installed, "@@WineTestVertical is not installed\n");
ok(selected, "@@WineTestVertical is not selected\n");
ok(gm.gmBlackBoxX < gm.gmBlackBoxY,
"gmBlackBoxX(%u) should be less than gmBlackBoxY(%u) if vertical\n",
gm.gmBlackBoxX, gm.gmBlackBoxY);
ok(hgi == vgi, "different glyph h:%u v:%u\n", hgi, vgi);
ret = pRemoveFontResourceExA(ttf_name, FR_PRIVATE, 0);
ok(ret, "RemoveFontResourceEx() error %d\n", GetLastError());