inspector: Replace "no glyph" with space glyph
authorBenjamin Otte <otte@redhat.com>
Wed, 1 Nov 2023 20:57:16 +0000 (21:57 +0100)
committerMatthias Clasen <mclasen@redhat.com>
Fri, 17 Nov 2023 20:28:58 +0000 (15:28 -0500)
This makes right-aligning the text work again.

gtk/inspector/fpsoverlay.c

index 22db2ff818fd40328da6afebd0d3fe1984ba3246..6bd08fdea66a5a1a209ddbda79b88a4f0e24dab5 100644 (file)
@@ -99,11 +99,13 @@ gtk_fps_info_new (GtkWidget *widget)
 
   pango_layout_iter_free (iter);
 
-  pango_layout_set_text (layout, "0123456789", -1);
+  pango_layout_set_text (layout, "0123456789 ", -1);
 
   iter = pango_layout_get_iter (layout);
   run = pango_layout_iter_get_run_readonly (iter);
 
+  g_assert (run->glyphs->num_glyphs == 11);
+
   info->digits = pango_glyph_string_copy (run->glyphs);
 
   pango_layout_iter_free (iter);
@@ -216,7 +218,7 @@ gtk_fps_overlay_snapshot (GtkInspectorOverlay *overlay,
           if (g_ascii_isdigit (fps_string[i]))
             info->glyphs->glyphs[i].glyph = info->digits->glyphs[fps_string[i] - '0'].glyph;
           else if (fps_string[i] == ' ')
-            info->glyphs->glyphs[i].glyph = PANGO_GLYPH_EMPTY;
+            info->glyphs->glyphs[i].glyph = info->digits->glyphs[10].glyph;
         }
 
       fps_node = gsk_text_node_new (info->font,