Module: wine Branch: master Commit: 7495d814954420c16e21de40c3031a9c95385f56 URL: http://source.winehq.org/git/wine.git/?a=commit;h=7495d814954420c16e21de40c3...
Author: Huw Davies huw@codeweavers.com Date: Thu Jul 5 15:27:20 2007 +0100
gdi32: Using a bitmap font as the fallback sans serif is a very bad idea.
---
dlls/gdi32/freetype.c | 2 +- dlls/gdi32/tests/font.c | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletions(-)
diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c index 33c9f1d..9db2d3e 100644 --- a/dlls/gdi32/freetype.c +++ b/dlls/gdi32/freetype.c @@ -337,7 +337,7 @@ static struct list font_subst_list = LIST_INIT(font_subst_list); static struct list font_list = LIST_INIT(font_list);
static const WCHAR defSerif[] = {'T','i','m','e','s',' ','N','e','w',' ','R','o','m','a','n','\0'}; -static const WCHAR defSans[] = {'M','S',' ','S','a','n','s',' ','S','e','r','i','f','\0'}; +static const WCHAR defSans[] = {'A','r','i','a','l','\0'}; static const WCHAR defFixed[] = {'C','o','u','r','i','e','r',' ','N','e','w','\0'};
static const WCHAR RegularW[] = {'R','e','g','u','l','a','r','\0'}; diff --git a/dlls/gdi32/tests/font.c b/dlls/gdi32/tests/font.c index b51c89b..92aad9e 100644 --- a/dlls/gdi32/tests/font.c +++ b/dlls/gdi32/tests/font.c @@ -1654,6 +1654,36 @@ static void test_GetTextMetrics(void) ReleaseDC(0, hdc); }
+static void test_non_existent_font(void) +{ + LOGFONTA lf; + HDC hdc; + HFONT hfont; + char buf[LF_FACESIZE]; + + if (!is_truetype_font_installed("Arial Black")) + { + skip("Arial not installed\n"); + return; + } + + hdc = GetDC(0); + + memset(&lf, 0, sizeof(lf)); + lf.lfHeight = 100; + lf.lfWeight = FW_REGULAR; + lf.lfCharSet = ANSI_CHARSET; + lf.lfPitchAndFamily = FF_SWISS; + strcpy(lf.lfFaceName, "Non existent font"); + + hfont = CreateFontIndirectA(&lf); + hfont = SelectObject(hdc, hfont); + GetTextFaceA(hdc, sizeof(buf), buf); + ok(!lstrcmpiA(buf, "Arial"), "Got %s\n", buf); + DeleteObject(SelectObject(hdc, hfont)); + ReleaseDC(0, hdc); +} + START_TEST(font) { init(); @@ -1670,6 +1700,8 @@ START_TEST(font) test_SetTextJustification(); test_font_charset(); test_GetFontUnicodeRanges(); + test_non_existent_font(); + /* On Windows Arial has a lot of default charset aliases such as Arial Cyr, * I'd like to avoid them in this test. */