Module: wine Branch: master Commit: 65a966de76eb22a9c3ec7494c7a7beb9870aebfd URL: http://source.winehq.org/git/wine.git/?a=commit;h=65a966de76eb22a9c3ec7494c7...
Author: Dmitry Timoshkov dmitry@baikal.ru Date: Thu Sep 27 15:52:18 2012 +0900
gdiplus: Take into account font substitution in GdipCreateFontFamilyFromName.
---
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);