gdiplus: Use Liberation Mono as a fallback for Courier New for the monospace family.

Francois Gouget fgouget at free.fr
Mon Sep 12 18:47:27 CDT 2011


---

Once both this patch and the font tests one are applied the font tests 
should be more robust on systems that have the Liberation Fonts but not 
the Microsoft Web Fonts.

Systems that have neither will fail however because that feels like a 
broken situation.

 dlls/gdiplus/font.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/dlls/gdiplus/font.c b/dlls/gdiplus/font.c
index 3624391..169e28f 100644
--- a/dlls/gdiplus/font.c
+++ b/dlls/gdiplus/font.c
@@ -816,10 +816,20 @@ GpStatus WINGDIPAPI GdipIsStyleAvailable(GDIPCONST GpFontFamily* family,
 GpStatus WINGDIPAPI GdipGetGenericFontFamilyMonospace(GpFontFamily **nativeFamily)
 {
     static const WCHAR CourierNew[] = {'C','o','u','r','i','e','r',' ','N','e','w','\0'};
+    static const WCHAR LiberationMono[] = {'L','i','b','e','r','a','t','i','o','n',' ','M','o','n','o','\0'};
+    GpStatus stat;
 
     if (nativeFamily == NULL) return InvalidParameter;
 
-    return GdipCreateFontFamilyFromName(CourierNew, NULL, nativeFamily);
+    stat = GdipCreateFontFamilyFromName(CourierNew, NULL, nativeFamily);
+
+    if (stat == FontFamilyNotFound)
+        stat = GdipCreateFontFamilyFromName(LiberationMono, NULL, nativeFamily);
+
+    if (stat == FontFamilyNotFound)
+        ERR("Missing 'Courier New' font\n");
+
+    return stat;
 }
 
 /*****************************************************************************
-- 
1.7.5.4



More information about the wine-patches mailing list