gdiplus: Take into account font substitution in GdipCreateFontFromLogfont.
This commit is contained in:
parent
65a966de76
commit
691be74f17
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue