[2/3] gdiplus: Take into account font substitution in GdipCreateFontFamilyFromName.

Dmitry Timoshkov dmitry at baikal.ru
Thu Sep 27 01:52:18 CDT 2012


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

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




More information about the wine-patches mailing list