gdiplus: Take into account font substitution in GdipCreateFontFamilyFromName.

This commit is contained in:
Dmitry Timoshkov 2012-09-27 15:52:18 +09:00 committed by Alexandre Julliard
parent 25ee85fe84
commit 65a966de76
2 changed files with 4 additions and 3 deletions

View File

@ -624,6 +624,7 @@ static INT CALLBACK is_font_installed_proc(const LOGFONTW *elf,
struct font_metrics
{
WCHAR facename[LF_FACESIZE];
UINT16 em_height, ascent, descent, line_spacing; /* in font units */
int dpi;
};
@ -639,6 +640,8 @@ static BOOL get_font_metrics(HDC hdc, struct font_metrics *fm)
otm.otmSize = sizeof(otm);
if (!GetOutlineTextMetricsW(hdc, otm.otmSize, &otm)) return FALSE;
GetTextFaceW(hdc, LF_FACESIZE, fm->facename);
fm->em_height = otm.otmEMSquare;
fm->dpi = GetDeviceCaps(hdc, LOGPIXELSY);
@ -739,7 +742,7 @@ GpStatus WINGDIPAPI GdipCreateFontFamilyFromName(GDIPCONST WCHAR *name,
ffamily = GdipAlloc(sizeof (GpFontFamily));
if (!ffamily) return OutOfMemory;
lstrcpynW(ffamily->FamilyName, name, LF_FACESIZE);
lstrcpyW(ffamily->FamilyName, fm.facename);
ffamily->em_height = fm.em_height;
ffamily->ascent = fm.ascent;
ffamily->descent = fm.descent;

View File

@ -746,7 +746,6 @@ static void test_font_substitution(void)
memset(&lf, 0xfe, sizeof(lf));
status = GdipGetLogFontA(font, graphics, &lf);
expect(Ok, status);
todo_wine
ok(!lstrcmp(lf.lfFaceName, "Microsoft Sans Serif") ||
!lstrcmp(lf.lfFaceName, "Tahoma"), "wrong face name %s\n", lf.lfFaceName);
GdipDeleteFont(font);
@ -758,7 +757,6 @@ todo_wine
memset(&lf, 0xfe, sizeof(lf));
status = GdipGetLogFontA(font, graphics, &lf);
expect(Ok, status);
todo_wine
ok(!lstrcmp(lf.lfFaceName, "Microsoft Sans Serif") ||
!lstrcmp(lf.lfFaceName, "Tahoma"), "wrong face name %s\n", lf.lfFaceName);
GdipDeleteFont(font);