Sync up to trunk head.
[reactos.git] / dll / win32 / gdiplus / font.c
index fda5428..3a29771 100644 (file)
@@ -489,6 +489,7 @@ GpStatus WINGDIPAPI GdipGetFontHeightGivenDPI(GDIPCONST GpFont *font, REAL dpi,
     switch (font->unit)
     {
         case UnitPixel:
+        case UnitWorld:
             *height = font_height;
             break;
         case UnitPoint:
@@ -520,7 +521,7 @@ GpStatus WINGDIPAPI GdipGetFontHeightGivenDPI(GDIPCONST GpFont *font, REAL dpi,
 static INT CALLBACK is_font_installed_proc(const LOGFONTW *elf,
                             const TEXTMETRICW *ntm, DWORD type, LPARAM lParam)
 {
-    if (!ntm)
+    if (!ntm || type == RASTER_FONTTYPE)
     {
         return 1;
     }
@@ -642,12 +643,14 @@ GpStatus WINGDIPAPI GdipCloneFontFamily(GpFontFamily* FontFamily, GpFontFamily**
 GpStatus WINGDIPAPI GdipGetFamilyName (GDIPCONST GpFontFamily *family,
                                        WCHAR *name, LANGID language)
 {
+    static int lang_fixme;
+
     if (family == NULL)
          return InvalidParameter;
 
     TRACE("%p, %p, %d\n", family, name, language);
 
-    if (language != LANG_NEUTRAL)
+    if (language != LANG_NEUTRAL && !lang_fixme++)
         FIXME("No support for handling of multiple languages!\n");
 
     lstrcpynW (name, family->FamilyName, LF_FACESIZE);
@@ -826,15 +829,21 @@ GpStatus WINGDIPAPI GdipGetGenericFontFamilySerif(GpFontFamily **nativeFamily)
  */
 GpStatus WINGDIPAPI GdipGetGenericFontFamilySansSerif(GpFontFamily **nativeFamily)
 {
-    /* FIXME: On Windows this is called Microsoft Sans Serif, this shouldn't
-     * affect anything */
-    static const WCHAR MSSansSerif[] = {'M','S',' ','S','a','n','s',' ','S','e','r','i','f','\0'};
+    GpStatus stat;
+    static const WCHAR MicrosoftSansSerif[] = {'M','i','c','r','o','s','o','f','t',' ','S','a','n','s',' ','S','e','r','i','f','\0'};
+    static const WCHAR Tahoma[] = {'T','a','h','o','m','a','\0'};
 
     TRACE("(%p)\n", nativeFamily);
 
     if (nativeFamily == NULL) return InvalidParameter;
 
-    return GdipCreateFontFamilyFromName(MSSansSerif, NULL, nativeFamily);
+    stat = GdipCreateFontFamilyFromName(MicrosoftSansSerif, NULL, nativeFamily);
+
+    if (stat == FontFamilyNotFound)
+        /* FIXME: Microsoft Sans Serif is not installed on Wine. */
+        stat = GdipCreateFontFamilyFromName(Tahoma, NULL, nativeFamily);
+
+    return stat;
 }
 
 /*****************************************************************************
@@ -957,6 +966,9 @@ static INT CALLBACK add_font_proc(const LOGFONTW *lfw, const TEXTMETRICW *ntm,
     GpFontCollection* fonts = (GpFontCollection*)lParam;
     int i;
 
+    if (type == RASTER_FONTTYPE)
+        return 1;
+
     /* skip duplicates */
     for (i=0; i<fonts->count; i++)
         if (strcmpiW(lfw->lfFaceName, fonts->FontFamilies[i]->FamilyName) == 0)