Huw Davies : gdi32: Factor out FreeType initialization into a separate function.

Alexandre Julliard julliard at winehq.org
Wed Mar 12 17:23:58 CDT 2008


Module: wine
Branch: master
Commit: e0693a18134be876625425ae1d18bfafe1466d6a
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=e0693a18134be876625425ae1d18bfafe1466d6a

Author: Huw Davies <huw at codeweavers.com>
Date:   Wed Mar 12 13:45:13 2008 +0000

gdi32: Factor out FreeType initialization into a separate function.

---

 dlls/gdi32/freetype.c |   76 +++++++++++++++++++++++++++----------------------
 1 files changed, 42 insertions(+), 34 deletions(-)

diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c
index 765ac82..aef9024 100644
--- a/dlls/gdi32/freetype.c
+++ b/dlls/gdi32/freetype.c
@@ -2163,28 +2163,9 @@ static void update_font_info(void)
     FIXME("there is no font defaults for codepages %u,%u\n", ansi_cp, oem_cp);
 }
 
-/*************************************************************
- *    WineEngInit
- *
- * Initialize FreeType library and create a list of available faces
- */
-BOOL WineEngInit(void)
-{
-    static const WCHAR dot_fonW[] = {'.','f','o','n','\0'};
-    static const WCHAR pathW[] = {'P','a','t','h',0};
-    HKEY hkey;
-    DWORD valuelen, datalen, i = 0, type, dlen, vlen;
-    LPVOID data;
-    WCHAR windowsdir[MAX_PATH];
-    char *unixname;
-    HANDLE font_mutex;
-    const char *data_dir;
-
-    TRACE("\n");
-
-    /* update locale dependent font info in registry */
-    update_font_info();
 
+static BOOL init_freetype(void)
+{
     ft_handle = wine_dlopen(SONAME_LIBFREETYPE, RTLD_NOW, NULL, 0);
     if(!ft_handle) {
         WINE_MESSAGE(
@@ -2219,7 +2200,7 @@ BOOL WineEngInit(void)
     LOAD_FUNCPTR(FT_Vector_Transform)
 
 #undef LOAD_FUNCPTR
-    /* Don't warn if this one is missing */
+    /* Don't warn if these ones are missing */
     pFT_Library_Version = wine_dlsym(ft_handle, "FT_Library_Version", NULL, 0);
     pFT_Load_Sfnt_Table = wine_dlsym(ft_handle, "FT_Load_Sfnt_Table", NULL, 0);
     pFT_Get_First_Char = wine_dlsym(ft_handle, "FT_Get_First_Char", NULL, 0);
@@ -2241,11 +2222,10 @@ BOOL WineEngInit(void)
         ft_handle = NULL;
 	return FALSE;
     }
-    FT_Version.major=FT_Version.minor=FT_Version.patch=-1;
+    FT_Version.major = FT_Version.minor = FT_Version.patch = -1;
     if (pFT_Library_Version)
-    {
         pFT_Library_Version(library,&FT_Version.major,&FT_Version.minor,&FT_Version.patch);
-    }
+
     if (FT_Version.major<=0)
     {
         FT_Version.major=2;
@@ -2257,6 +2237,43 @@ BOOL WineEngInit(void)
                        ((FT_Version.minor <<  8) & 0x00ff00) |
                        ((FT_Version.patch      ) & 0x0000ff);
 
+    return TRUE;
+
+sym_not_found:
+    WINE_MESSAGE(
+      "Wine cannot find certain functions that it needs inside the FreeType\n"
+      "font library.  To enable Wine to use TrueType fonts please upgrade\n"
+      "FreeType to at least version 2.0.5.\n"
+      "http://www.freetype.org\n");
+    wine_dlclose(ft_handle, NULL, 0);
+    ft_handle = NULL;
+    return FALSE;
+}
+
+/*************************************************************
+ *    WineEngInit
+ *
+ * Initialize FreeType library and create a list of available faces
+ */
+BOOL WineEngInit(void)
+{
+    static const WCHAR dot_fonW[] = {'.','f','o','n','\0'};
+    static const WCHAR pathW[] = {'P','a','t','h',0};
+    HKEY hkey;
+    DWORD valuelen, datalen, i = 0, type, dlen, vlen;
+    LPVOID data;
+    WCHAR windowsdir[MAX_PATH];
+    char *unixname;
+    HANDLE font_mutex;
+    const char *data_dir;
+
+    TRACE("\n");
+
+    /* update locale dependent font info in registry */
+    update_font_info();
+
+    if(!init_freetype()) return FALSE;
+
     if((font_mutex = CreateMutexW(NULL, FALSE, font_mutex_nameW)) == NULL) {
         ERR("Failed to create font mutex\n");
         return FALSE;
@@ -2385,15 +2402,6 @@ BOOL WineEngInit(void)
     
     ReleaseMutex(font_mutex);
     return TRUE;
-sym_not_found:
-    WINE_MESSAGE(
-      "Wine cannot find certain functions that it needs inside the FreeType\n"
-      "font library.  To enable Wine to use TrueType fonts please upgrade\n"
-      "FreeType to at least version 2.0.5.\n"
-      "http://www.freetype.org\n");
-    wine_dlclose(ft_handle, NULL, 0);
-    ft_handle = NULL;
-    return FALSE;
 }
 
 




More information about the wine-cvs mailing list