[PATCH v2 3/7] gdi32: Introduce and use debugstr_face helper.

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


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

diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c
index 86585882342..3298b31ab74 100644
--- a/dlls/gdi32/freetype.c
+++ b/dlls/gdi32/freetype.c
@@ -288,6 +288,12 @@ typedef struct tagFace {
     struct enum_data *cached_enum_data;
 } Face;
 
+static inline const char *debugstr_face( Face *face )
+{
+    if (face->file) return wine_dbg_sprintf( "%s (%ld)", debugstr_w(face->file), face->face_index );
+    else return wine_dbg_sprintf( "%p-%p (%ld)", face->font_data_ptr, (char *)face->font_data_ptr + face->font_data_size, face->face_index );
+}
+
 #define FS_DBCS_MASK (FS_JISJAPAN|FS_CHINESESIMP|FS_WANSUNG|FS_CHINESETRAD|FS_JOHAB)
 
 #define ADDFONT_EXTERNAL_FONT 0x01
@@ -1585,20 +1591,17 @@ static BOOL insert_face_in_family_list( Face *face, Family *family )
             if (face->file && face->dev == cursor->dev && face->ino == cursor->ino)
             {
                 cursor->refcount++;
-                TRACE("Font %s already in list, refcount now %d\n",
-                      debugstr_w(face->file), cursor->refcount);
+                TRACE( "face %s already in list, refcount now %d\n", debugstr_face(face), cursor->refcount );
                 return FALSE;
             }
             if (face->font_version <= cursor->font_version)
             {
-                TRACE("Original font %s is newer so skipping %s\n",
-                      debugstr_w(cursor->file), debugstr_w(face->file));
+                TRACE( "Original %s is newer so skipping %s\n", debugstr_face(cursor), debugstr_face(face) );
                 return FALSE;
             }
             else
             {
-                TRACE("Replacing original %s with %s\n",
-                      debugstr_w(cursor->file), debugstr_w(face->file));
+                TRACE( "Replacing original %s with %s\n", debugstr_face(cursor), debugstr_face(face) );
                 list_add_before( &cursor->entry, &face->entry );
                 face->family = family;
                 family->refcount++;
@@ -1612,7 +1615,7 @@ static BOOL insert_face_in_family_list( Face *face, Family *family )
     }
 
     TRACE( "Adding face %s in family %s from %s\n", debugstr_w(face->full_name),
-           debugstr_w(family->family_name), debugstr_w(face->file) );
+           debugstr_w(family->family_name), debugstr_face(face) );
     list_add_before( &cursor->entry, &face->entry );
     face->family = family;
     family->refcount++;
@@ -2356,7 +2359,7 @@ static int remove_font_resource( const WCHAR *file, DWORD flags )
             if (LOWORD(face->flags) != LOWORD(flags)) continue;
             if (st.st_dev == face->dev && st.st_ino == face->ino)
             {
-                TRACE( "removing matching face %s refcount %d\n", debugstr_w(face->file), face->refcount );
+                TRACE( "removing matching face %s refcount %d\n", debugstr_face(face), face->refcount );
                 release_face( face );
                 count++;
             }
@@ -2623,8 +2626,7 @@ static void populate_system_links(const WCHAR *name, const WCHAR *const *values)
             child_font->font = NULL;
             font_link->fs.fsCsb[0] |= face->fs.fsCsb[0];
             font_link->fs.fsCsb[1] |= face->fs.fsCsb[1];
-            TRACE("Adding file %s index %ld\n", debugstr_w(child_font->face->file),
-                  child_font->face->face_index);
+            TRACE( "Adding %s\n", debugstr_face(child_font->face) );
             list_add_tail(&font_link->links, &child_font->entry);
 
             TRACE("added internal SystemLink for %s to %s in %s\n", debugstr_w(name), debugstr_w(value),debugstr_w(file));
@@ -2704,8 +2706,7 @@ static void init_system_links(void)
                 child_font->font = NULL;
                 font_link->fs.fsCsb[0] |= face->fs.fsCsb[0];
                 font_link->fs.fsCsb[1] |= face->fs.fsCsb[1];
-                TRACE("Adding file %s index %ld\n",
-                      debugstr_w(child_font->face->file), child_font->face->face_index);
+                TRACE( "Adding %s\n", debugstr_face(child_font->face) );
                 list_add_tail(&font_link->links, &child_font->entry);
             }
             list_add_tail(&system_links, &font_link->entry);
@@ -2763,8 +2764,7 @@ skip_internal:
         child_font->font = NULL;
         system_font_link->fs.fsCsb[0] |= face->fs.fsCsb[0];
         system_font_link->fs.fsCsb[1] |= face->fs.fsCsb[1];
-        TRACE("Found Tahoma in %s index %ld\n",
-              debugstr_w(child_font->face->file), child_font->face->face_index);
+        TRACE( "Found Tahoma in %s\n", debugstr_face(child_font->face) );
         list_add_tail(&system_font_link->links, &child_font->entry);
     }
     font_link = find_font_link(Tahoma);
@@ -4599,7 +4599,7 @@ static FT_Face OpenFontFace(GdiFont *font, Face *face, LONG width, LONG height)
     void *data_ptr;
     DWORD data_size;
 
-    TRACE("%s/%p, %ld, %d x %d\n", debugstr_w(face->file), face->font_data_ptr, face->face_index, width, height);
+    TRACE( "%s, %d x %d\n", debugstr_face(face), width, height );
 
     if (face->file)
     {
@@ -4608,7 +4608,7 @@ static FT_Face OpenFontFace(GdiFont *font, Face *face, LONG width, LONG height)
         HeapFree( GetProcessHeap(), 0, filename );
         if (!font->mapping)
         {
-            WARN("failed to map %s\n", debugstr_w(face->file));
+            WARN( "failed to map %s\n", debugstr_face(face) );
             return 0;
         }
         data_ptr = font->mapping->data;
@@ -4700,8 +4700,7 @@ static int get_nearest_charset(const WCHAR *family_name, Face *face, int *cp)
 	}
     }
 
-    FIXME("returning DEFAULT_CHARSET face->fs.fsCsb[0] = %08x file = %s\n",
-	  face->fs.fsCsb[0], debugstr_w(face->file));
+    FIXME( "returning DEFAULT_CHARSET face->fs.fsCsb[0] = %08x %s\n", face->fs.fsCsb[0], debugstr_face(face) );
     *cp = acp;
     return DEFAULT_CHARSET;
 }
@@ -5134,7 +5133,7 @@ static BOOL create_child_font_list(GdiFont *font)
             new_child->font = NULL;
             new_child->face->refcount++;
             list_add_tail(&font->child_fonts, &new_child->entry);
-            TRACE("font %s %ld\n", debugstr_w(new_child->face->file), new_child->face->face_index);
+            TRACE( "face %s\n", debugstr_face(new_child->face) );
         }
         ret = TRUE;
     }
@@ -5157,7 +5156,7 @@ static BOOL create_child_font_list(GdiFont *font)
                 new_child->font = NULL;
                 new_child->face->refcount++;
                 list_add_tail(&font->child_fonts, &new_child->entry);
-                TRACE("font %s %ld\n", debugstr_w(new_child->face->file), new_child->face->face_index);
+                TRACE( "face %s\n", debugstr_face(new_child->face) );
             }
             ret = TRUE;
         }
@@ -5894,8 +5893,7 @@ found_face:
     else
         ret->charset = get_nearest_charset( family->family_name, face, &ret->codepage );
 
-    TRACE( "Chosen: %s (%s/%p:%ld)\n", debugstr_w(face->full_name), debugstr_w(face->file),
-           face->font_data_ptr, face->face_index );
+    TRACE( "Chosen: %s from %s\n", debugstr_w(face->full_name), debugstr_face(face) );
 
     ret->aveWidth = height ? lf.lfWidth : 0;
 
-- 
2.28.0




More information about the wine-devel mailing list