gdiplus: Take into account font substitution in GdipCreateFontFromLogfont.

This commit is contained in:
Dmitry Timoshkov 2012-09-27 15:52:29 +09:00 committed by Alexandre Julliard
parent 65a966de76
commit 691be74f17
2 changed files with 5 additions and 5 deletions

View File

@ -205,6 +205,7 @@ GpStatus WINGDIPAPI GdipCreateFontFromLogfontW(HDC hdc,
{
HFONT hfont, oldfont;
OUTLINETEXTMETRICW otm;
WCHAR facename[LF_FACESIZE];
GpStatus stat;
int ret;
@ -217,6 +218,7 @@ GpStatus WINGDIPAPI GdipCreateFontFromLogfontW(HDC hdc,
oldfont = SelectObject(hdc, hfont);
otm.otmSize = sizeof(otm);
ret = GetOutlineTextMetricsW(hdc, otm.otmSize, &otm);
GetTextFaceW(hdc, LF_FACESIZE, facename);
SelectObject(hdc, oldfont);
DeleteObject(hfont);
@ -229,7 +231,7 @@ GpStatus WINGDIPAPI GdipCreateFontFromLogfontW(HDC hdc,
(*font)->emSize = otm.otmTextMetrics.tmAscent;
(*font)->otm = otm;
stat = GdipCreateFontFamilyFromName(logfont->lfFaceName, NULL, &(*font)->family);
stat = GdipCreateFontFamilyFromName(facename, NULL, &(*font)->family);
if (stat != Ok)
{
GdipFree(*font);

View File

@ -767,24 +767,20 @@ static void test_font_substitution(void)
lstrcpy(lf.lfFaceName, "ThisFontShouldNotExist");
status = GdipCreateFontFromLogfontA(hdc, &lf, &font);
todo_wine
expect(Ok, status);
memset(&lf, 0xfe, sizeof(lf));
status = GdipGetLogFontA(font, graphics, &lf);
expect(Ok, status);
todo_wine
ok(!lstrcmp(lf.lfFaceName, "Arial"), "wrong face name %s\n", lf.lfFaceName);
GdipDeleteFont(font);
/* empty FaceName */
lf.lfFaceName[0] = 0;
status = GdipCreateFontFromLogfontA(hdc, &lf, &font);
todo_wine
expect(Ok, status);
memset(&lf, 0xfe, sizeof(lf));
status = GdipGetLogFontA(font, graphics, &lf);
expect(Ok, status);
todo_wine
ok(!lstrcmp(lf.lfFaceName, "Arial"), "wrong face name %s\n", lf.lfFaceName);
GdipDeleteFont(font);
@ -793,12 +789,14 @@ todo_wine
lf.lfCharSet = 0;
lstrcpy(lf.lfFaceName, "ThisFontShouldNotExist");
status = GdipCreateFontFromLogfontA(hdc, &lf, &font);
todo_wine
ok(status == NotTrueTypeFont || broken(status == FileNotFound), /* before XP */
"expected NotTrueTypeFont, got %d\n", status);
/* empty FaceName */
lf.lfFaceName[0] = 0;
status = GdipCreateFontFromLogfontA(hdc, &lf, &font);
todo_wine
ok(status == NotTrueTypeFont || broken(status == FileNotFound), /* before XP */
"expected NotTrueTypeFont, got %d\n", status);