inspector: Use tabular numbers in the fps overlay
authorMatthias Clasen <mclasen@redhat.com>
Sat, 16 May 2020 01:26:10 +0000 (21:26 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Sat, 16 May 2020 01:30:14 +0000 (21:30 -0400)
It is a lot more readable if it doesn't constantly jitter.

gtk/inspector/fpsoverlay.c

index a1a4168e89273ff3bcfe38661918c88292888340..9c1e8e58a18304722e6b250496dec3cb48b94195 100644 (file)
@@ -155,6 +155,7 @@ gtk_fps_overlay_snapshot (GtkInspectorOverlay *overlay,
   GtkFpsOverlay *self = GTK_FPS_OVERLAY (overlay);
   GtkFpsInfo *info;
   PangoLayout *layout;
+  PangoAttrList *attrs;
   gint64 now;
   double fps;
   char *fps_string;
@@ -216,6 +217,10 @@ gtk_fps_overlay_snapshot (GtkInspectorOverlay *overlay,
     }
 
   layout = gtk_widget_create_pango_layout (widget, fps_string);
+  attrs = pango_attr_list_new ();
+  pango_attr_list_insert (attrs, pango_attr_font_features_new ("tnum=1"));
+  pango_layout_set_attributes (layout, attrs);
+  pango_attr_list_unref (attrs);
   pango_layout_get_pixel_size (layout, &width, &height);
 
   gtk_snapshot_save (snapshot);