[PATCH v2 4/7] gdi32: Store the unix file name in registry cache.

Rémi Bernon rbernon at codeweavers.com
Thu Sep 17 10:01:34 CDT 2020


The conversion is only temporary as we will store the path on faces.

Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---
 dlls/gdi32/freetype.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c
index 3298b31ab74..960c2dc745c 100644
--- a/dlls/gdi32/freetype.c
+++ b/dlls/gdi32/freetype.c
@@ -592,7 +592,7 @@ static const WCHAR face_y_ppem_value[] = {'Y','p','p','e','m',0};
 static const WCHAR face_flags_value[] = {'F','l','a','g','s',0};
 static const WCHAR face_internal_leading_value[] = {'I','n','t','e','r','n','a','l',' ','L','e','a','d','i','n','g',0};
 static const WCHAR face_font_sig_value[] = {'F','o','n','t',' ','S','i','g','n','a','t','u','r','e',0};
-static const WCHAR face_file_name_value[] = {'F','i','l','e',' ','N','a','m','e','\0'};
+static const WCHAR face_unix_name_value[] = {'U','n','i','x',' ','N','a','m','e','\0'};
 static const WCHAR face_full_name_value[] = {'F','u','l','l',' ','N','a','m','e','\0'};
 
 
@@ -1683,7 +1683,7 @@ static void load_face(HKEY hkey_face, WCHAR *face_name, Family *family, void *bu
     /* If we have a File Name key then this is a real font, not just the parent
        key of a bunch of non-scalable strikes */
     needed = buffer_size;
-    if (RegQueryValueExW(hkey_face, face_file_name_value, NULL, NULL, buffer, &needed) == ERROR_SUCCESS)
+    if (RegQueryValueExW( hkey_face, face_unix_name_value, NULL, NULL, buffer, &needed ) == ERROR_SUCCESS)
     {
         Face *face;
         face = HeapAlloc(GetProcessHeap(), 0, sizeof(*face));
@@ -1691,7 +1691,7 @@ static void load_face(HKEY hkey_face, WCHAR *face_name, Family *family, void *bu
         face->family = NULL;
 
         face->refcount = 1;
-        face->file = strdupW( buffer );
+        face->file = towstr( CP_UNIXCP, buffer );
         face->style_name = strdupW( face_name );
 
         needed = buffer_size;
@@ -1870,6 +1870,7 @@ static void add_face_to_cache(Face *face)
 {
     HKEY hkey_family, hkey_face;
     WCHAR *face_key_name;
+    char *unix_name;
 
     RegCreateKeyExW( hkey_font_cache, face->family->family_name, 0, NULL, REG_OPTION_VOLATILE,
                      KEY_ALL_ACCESS, NULL, &hkey_family, NULL );
@@ -1889,8 +1890,10 @@ static void add_face_to_cache(Face *face)
     if(!face->scalable)
         HeapFree(GetProcessHeap(), 0, face_key_name);
 
-    RegSetValueExW(hkey_face, face_file_name_value, 0, REG_SZ, (BYTE *)face->file,
-                   (strlenW(face->file) + 1) * sizeof(WCHAR));
+    unix_name = strWtoA( CP_UNIXCP, face->file );
+    RegSetValueExW( hkey_face, face_unix_name_value, 0, REG_BINARY, (BYTE *)unix_name, strlen( unix_name ) + 1 );
+    HeapFree( GetProcessHeap(), 0, unix_name );
+
     RegSetValueExW( hkey_face, face_full_name_value, 0, REG_SZ, (BYTE *)face->full_name,
                     (strlenW( face->full_name ) + 1) * sizeof(WCHAR) );
 
-- 
2.28.0




More information about the wine-devel mailing list