[try2][Gdiplus] Warn if we can't get a Serif font and fall back to Tahoma
Adam Petaccia
adam at tpetaccia.com
Fri Aug 1 19:02:56 CDT 2008
---
dlls/gdiplus/font.c | 13 ++++++++++++-
dlls/gdiplus/tests/font.c | 3 ++-
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/dlls/gdiplus/font.c b/dlls/gdiplus/font.c
index b787691..2e276dd 100644
--- a/dlls/gdiplus/font.c
+++ b/dlls/gdiplus/font.c
@@ -646,10 +646,21 @@ GpStatus WINGDIPAPI GdipGetGenericFontFamilyMonospace(GpFontFamily **nativeFamil
GpStatus WINGDIPAPI GdipGetGenericFontFamilySerif(GpFontFamily **nativeFamily)
{
static const WCHAR TimesNewRoman[] = {'T','i','m','e','s',' ','N','e','w',' ','R','o','m','a','n','\0'};
+ static UINT count = 0;
+ GpStatus stat;
if (nativeFamily == NULL) return InvalidParameter;
- return GdipCreateFontFamilyFromName(TimesNewRoman, NULL, nativeFamily);
+ stat = GdipCreateFontFamilyFromName(TimesNewRoman, NULL, nativeFamily);
+ if (stat != Ok)
+ {
+ if (!count++)
+ ERR("No suitable Serif font. (falling back to Tahoma). "
+ "Install liberation fonts or Microsoft Core fonts.\n");
+ stat = GdipCreateFontFamilyFromName(Tahoma, NULL, nativeFamily);
+ }
+
+ return stat;
}
/*****************************************************************************
diff --git a/dlls/gdiplus/tests/font.c b/dlls/gdiplus/tests/font.c
index fc3b28c..d545ead 100644
--- a/dlls/gdiplus/tests/font.c
+++ b/dlls/gdiplus/tests/font.c
@@ -313,7 +313,8 @@ serif:
expect (Ok, stat);
stat = GdipGetFamilyName (family, familyName, LANG_NEUTRAL);
expect (Ok, stat);
- ok (lstrcmpiW(familyName, TimesNewRoman) == 0,
+ ok (lstrcmpiW(familyName, TimesNewRoman) == 0 ||
+ lstrcmpiW(familyName, Tahoma) == 0,
"Expected Times New Roman, got %s\n", debugstr_w(familyName));
stat = GdipDeleteFontFamily (family);
expect (Ok, stat);
--
1.5.4.3
More information about the wine-patches
mailing list