]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
label: Put dimensions of text in log
authorRay Strode <rstrode@redhat.com>
Fri, 29 Dec 2023 00:42:15 +0000 (19:42 -0500)
committerRay Strode <rstrode@redhat.com>
Fri, 29 Dec 2023 01:21:20 +0000 (20:21 -0500)
This just helps with debugging.

src/plugins/controls/label-freetype/plugin.c
src/plugins/controls/label-pango/plugin.c

index ecef8b239a5fd6b5db315f269874f839fa01d29f..e262919e66df0a17acce1a5c399baadadfffdc4e 100644 (file)
@@ -660,9 +660,23 @@ load_glyphs (ply_label_plugin_control_t *label,
         } while (true);
 
         if (action == PLY_LOAD_GLYPH_ACTION_MEASURE) {
-                if (!is_first_character)
+                if (!is_first_character) {
+                        char *text = NULL;
+
                         finish_measuring_line (label, &glyph_x, &glyph_y, line_dimensions);
 
+                        if (ply_is_tracing ()) {
+                                if (label->rich_text != NULL)
+                                        text = ply_rich_text_get_string (label->rich_text, &label->span);
+
+                                ply_trace ("Text '%s' has dimensions %ldx%ld", text?: label->text,
+                                           line_dimensions->width,
+                                           line_dimensions->height);
+
+                                free (text);
+                        }
+                }
+
                 align_lines (label);
         }
 }
index 9185c7afc3ae44fad794b511fc0af650776cc781..fdbddb6e03c1095afea8775535bafafebf052c7c 100644 (file)
@@ -42,6 +42,7 @@
 #include <cairo.h>
 #include <pango/pangocairo.h>
 
+#include "ply-logger.h"
 #include "ply-terminal.h"
 #include "ply-pixel-buffer.h"
 #include "ply-pixel-display.h"
@@ -338,6 +339,8 @@ size_control (ply_label_plugin_control_t *label,
                 pango_layout_get_pixel_size (pango_layout, &text_width, &text_height);
         }
 
+        ply_trace ("Text '%s' has dimensions %dx%d", label->text, text_width, text_height);
+
         label->area.width = text_width;
         label->area.height = text_height;