gdi32: Fix otmfsSelection to have italic style set in case of oblique simulation.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2016-02-09 17:24:27 +03:00 committed by Alexandre Julliard
parent f26b4a3575
commit 6389f41135
3 changed files with 51 additions and 3 deletions

View File

@ -707,8 +707,7 @@ if (0)
style = IDWriteFont_GetStyle(font);
ok(style == DWRITE_FONT_STYLE_OBLIQUE, "got %d\n", style);
todo_wine
ok(otm.otmfsSelection == 1, "got 0x%08x\n", otm.otmfsSelection);
ok(otm.otmfsSelection & 1, "got 0x%08x\n", otm.otmfsSelection);
ret = IDWriteFont_IsSymbolFont(font);
ok(!ret, "got %d\n", ret);

View File

@ -7848,6 +7848,8 @@ static BOOL get_outline_text_metrics(GdiFont *font)
font->potm->otmFiller = 0;
memcpy(&font->potm->otmPanoseNumber, pOS2->panose, PANOSE_COUNT);
font->potm->otmfsSelection = pOS2->fsSelection;
if (font->fake_italic)
font->potm->otmfsSelection |= 1;
font->potm->otmfsType = pOS2->fsType;
font->potm->otmsCharSlopeRise = pHori->caret_Slope_Rise;
font->potm->otmsCharSlopeRun = pHori->caret_Slope_Run;

View File

@ -2106,6 +2106,34 @@ static void test_height_selection(void)
DeleteDC(hdc);
}
static UINT get_font_fsselection(LOGFONTA *lf)
{
OUTLINETEXTMETRICA *otm;
HFONT hfont, hfont_old;
DWORD ret, otm_size;
UINT fsSelection;
HDC hdc;
hdc = GetDC(0);
hfont = CreateFontIndirectA(lf);
ok(hfont != NULL, "failed to create a font\n");
hfont_old = SelectObject(hdc, hfont);
otm_size = GetOutlineTextMetricsA(hdc, 0, NULL);
otm = HeapAlloc(GetProcessHeap(), 0, otm_size);
otm->otmSize = sizeof(*otm);
ret = GetOutlineTextMetricsA(hdc, otm->otmSize, otm);
ok(ret == otm->otmSize, "expected %u, got %u, error %d\n", otm->otmSize, ret, GetLastError());
fsSelection = otm->otmfsSelection;
HeapFree(GetProcessHeap(), 0, otm);
SelectObject(hdc, hfont_old);
DeleteObject(hfont);
ReleaseDC(0, hdc);
return fsSelection;
}
static void test_GetOutlineTextMetrics(void)
{
OUTLINETEXTMETRICA *otm;
@ -2114,6 +2142,25 @@ static void test_GetOutlineTextMetrics(void)
HDC hdc;
DWORD ret, otm_size;
LPSTR unset_ptr;
UINT fsSelection;
/* check fsSelection field with oblique simulation */
memset(&lf, 0, sizeof(lf));
strcpy(lf.lfFaceName, "Tahoma");
lf.lfHeight = -13;
lf.lfWeight = FW_NORMAL;
lf.lfPitchAndFamily = DEFAULT_PITCH;
lf.lfQuality = PROOF_QUALITY;
/* regular face */
fsSelection = get_font_fsselection(&lf);
ok((fsSelection & 1) == 0, "got 0x%x\n", fsSelection);
lf.lfItalic = 1;
/* face with oblique simulation */
fsSelection = get_font_fsselection(&lf);
ok((fsSelection & 1) == 1, "got 0x%x\n", fsSelection);
if (!is_font_installed("Arial"))
{
@ -2130,7 +2177,7 @@ static void test_GetOutlineTextMetrics(void)
lf.lfPitchAndFamily = DEFAULT_PITCH;
lf.lfQuality = PROOF_QUALITY;
hfont = CreateFontIndirectA(&lf);
assert(hfont != 0);
ok(hfont != NULL, "failed to create a font\n");
hfont_old = SelectObject(hdc, hfont);
otm_size = GetOutlineTextMetricsA(hdc, 0, NULL);