[try 2] Enable the use of scaled font resource (.fot) files in AddFontResource

Jeremy White jwhite at winehq.org
Thu Apr 10 22:06:15 CDT 2008


---
 dlls/gdi32/font.c |   36 ++++++++++++++++++++++++++++++++++++
 1 files changed, 36 insertions(+), 0 deletions(-)

diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c
index 70b1809..fd3f916 100644
--- a/dlls/gdi32/font.c
+++ b/dlls/gdi32/font.c
@@ -3326,6 +3326,42 @@ INT WINAPI AddFontResourceExW( LPCWSTR str, DWORD fl, PVOID pdv )
                 ret = num_resources;
             FreeLibrary(hModule);
         }
+
+        /* If nothing has worked, probe to see if it is a .fot file */
+        if (ret == 0)
+        {
+            char strA[MAX_PATH];
+            HMODULE16 hModule;
+
+            memset(strA, 0, sizeof(strA));
+            WideCharToMultiByte(CP_ACP, 0, str, -1, strA, sizeof(strA) - 1, NULL, NULL);
+            hModule = LoadLibrary16(strA);
+            if (hModule)
+            {
+                HRSRC16 hres = 0;
+                HGLOBAL16 hglob = 0;
+                LPSTR fot_path = NULL;
+
+                TRACE("Trying to add an NE format file, possibly a .FOT file\n");
+
+                hres = FindResource16(hModule, "#1", (LPCSTR) NE_RSCTYPE_SCALABLE_FONTPATH);
+                if (hres)
+                {
+                    hglob = LoadResource16(hModule, hres);
+                    if (hglob)
+                        fot_path = LockResource16(hglob);
+                }
+
+                if (fot_path)
+                {
+                    TRACE("Found font file %s, trying to load it.\n", fot_path);
+                    ret = AddFontResourceExA(fot_path, fl, pdv);
+                    FreeResource16(hglob);
+                }
+
+                FreeLibrary16(hModule);
+            }
+        }
     }
     return ret;
 }
-- 
1.5.3.7




More information about the wine-patches mailing list