diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c index 15f401aaa50..ca9e18f9be9 100644 --- a/dlls/gdi32/freetype.c +++ b/dlls/gdi32/freetype.c @@ -6525,7 +6525,7 @@ static DWORD get_glyph_outline(GdiFont *incoming_font, UINT glyph, UINT format, lpgm->gmptGlyphOrigin.x = origin_x >> 6; lpgm->gmptGlyphOrigin.y = origin_y >> 6; abc->abcA = left >> 6; - abc->abcB = width; + abc->abcB = lpgm->gmBlackBoxX; abc->abcC = adv - abc->abcA - abc->abcB; TRACE("%u,%u,%s,%d,%d\n", lpgm->gmBlackBoxX, lpgm->gmBlackBoxY, diff --git a/dlls/gdi32/tests/font.c b/dlls/gdi32/tests/font.c index f6e4d07db57..031b86aa295 100644 --- a/dlls/gdi32/tests/font.c +++ b/dlls/gdi32/tests/font.c @@ -1298,11 +1298,22 @@ static void test_GetCharABCWidths(void) DeleteObject(hfont); } - ReleaseDC(NULL, hdc); - memset(&lf, 0, sizeof(lf)); strcpy(lf.lfFaceName, "Tahoma"); lf.lfHeight = 20; + hfont = CreateFontIndirectA(&lf); + + /* test empty glyph's metrics */ + hfont = SelectObject(hdc, hfont); + ret = pGetCharABCWidthsFloatW(hdc, ' ', ' ', abcf); + ok(ret, "GetCharABCWidthsFloatW should have succeeded\n"); + ok(abcf[0].abcfB == 1.0, "got %f\n", abcf[0].abcfB); + ret = pGetCharABCWidthsW(hdc, ' ', ' ', abcw); + ok(ret, "GetCharABCWidthsW should have succeeded\n"); + ok(abcw[0].abcB == 1, "got %u\n", abcw[0].abcB); + + DeleteObject(SelectObject(hdc, hfont)); + ReleaseDC(NULL, hdc); trace("ABC sign test for a variety of transforms:\n"); hfont = CreateFontIndirectA(&lf); @@ -1318,7 +1329,7 @@ static void test_GetCharABCWidths(void) ret = pGetCharABCWidthsI(hdc, 0, 1, glyphs, abc); ok(ret, "GetCharABCWidthsI should have succeeded\n"); ret = pGetCharABCWidthsW(hdc, 'i', 'i', abcw); - ok(ret, "GetCharABCWidthsI should have succeeded\n"); + ok(ret, "GetCharABCWidthsW should have succeeded\n"); ret = pGetCharABCWidthsFloatW(hdc, 'i', 'i', abcf); ok(ret, "GetCharABCWidthsFloatW should have succeeded\n");