Dmitry Timoshkov : gdiplus: Take into account font substitution in GdipCreateFontFromLogfont.

Alexandre Julliard julliard at winehq.org
Thu Sep 27 15:39:09 CDT 2012


Module: wine
Branch: master
Commit: 691be74f176f084c7f8bf109ae953e0ed65cff5f
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=691be74f176f084c7f8bf109ae953e0ed65cff5f

Author: Dmitry Timoshkov <dmitry at baikal.ru>
Date:   Thu Sep 27 15:52:29 2012 +0900

gdiplus: Take into account font substitution in GdipCreateFontFromLogfont.

---

 dlls/gdiplus/font.c       |    4 +++-
 dlls/gdiplus/tests/font.c |    6 ++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/dlls/gdiplus/font.c b/dlls/gdiplus/font.c
index 39449cb..e4f979c 100644
--- a/dlls/gdiplus/font.c
+++ b/dlls/gdiplus/font.c
@@ -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);
diff --git a/dlls/gdiplus/tests/font.c b/dlls/gdiplus/tests/font.c
index 4dfda25..66517b1 100644
--- a/dlls/gdiplus/tests/font.c
+++ b/dlls/gdiplus/tests/font.c
@@ -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);
 




More information about the wine-cvs mailing list