]> git.sur5r.net Git - i3/i3/blobdiff - libi3/font.c
Merge pull request #3192 from Exagone313/next
[i3/i3] / libi3 / font.c
index 7c305e25b6f992afaf27441d39445319193c6a69..81091ea74a31da11d392864c1158ed387b0da1cd 100644 (file)
@@ -5,6 +5,8 @@
  * © 2009 Michael Stapelberg and contributors (see also: LICENSE)
  *
  */
+#include "libi3.h"
+
 #include <assert.h>
 #include <stdint.h>
 #include <stdlib.h>
@@ -15,8 +17,6 @@
 #include <cairo/cairo-xcb.h>
 #include <pango/pangocairo.h>
 
-#include "libi3.h"
-
 static const i3Font *savedFont = NULL;
 
 static xcb_visualtype_t *root_visual_type;
@@ -24,24 +24,12 @@ static double pango_font_red;
 static double pango_font_green;
 static double pango_font_blue;
 
-/* Necessary to track whether the dpi changes and trigger a LOG() message,
- * which is more easily visible to users. */
-static double logged_dpi = 0.0;
-
 static PangoLayout *create_layout_with_dpi(cairo_t *cr) {
     PangoLayout *layout;
     PangoContext *context;
 
     context = pango_cairo_create_context(cr);
-    const double dpi = (double)root_screen->height_in_pixels * 25.4 /
-                       (double)root_screen->height_in_millimeters;
-    if (logged_dpi != dpi) {
-        logged_dpi = dpi;
-        LOG("X11 root window dictates %f DPI\n", dpi);
-    } else {
-        DLOG("X11 root window dictates %f DPI\n", dpi);
-    }
-    pango_cairo_context_set_resolution(context, dpi);
+    pango_cairo_context_set_resolution(context, get_dpi_value());
     layout = pango_layout_new(context);
     g_object_unref(context);