From cb9dd606aa80387ccaf434f7bf575bf7018ef058 Mon Sep 17 00:00:00 2001 From: QC Date: Fri, 30 Oct 2015 21:32:09 +0100 Subject: [PATCH] Allow dpi to be set --- config/config.def.c | 1 + include/rofi.h | 2 ++ source/textbox.c | 6 ++++-- source/xrmoptions.c | 3 ++- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/config/config.def.c b/config/config.def.c index 701d6cce..7bedb5ef 100644 --- a/config/config.def.c +++ b/config/config.def.c @@ -145,4 +145,5 @@ Settings config = { .markup_rows = FALSE, .fullscreen = FALSE, .fake_transparency = FALSE, + .dpi = -1, }; diff --git a/include/rofi.h b/include/rofi.h index ff52b71d..04459f2a 100644 --- a/include/rofi.h +++ b/include/rofi.h @@ -248,6 +248,8 @@ typedef struct _Settings unsigned int fullscreen; /** bg image */ unsigned int fake_transparency; + /** dpi */ + int dpi; } Settings; /** Global Settings structure. */ diff --git a/source/textbox.c b/source/textbox.c index 36d1429b..3c01cc08 100644 --- a/source/textbox.c +++ b/source/textbox.c @@ -647,9 +647,11 @@ void textbox_setup ( Display *display ) parse_color ( display, config.menu_hlfg_active, &( colors[ACTIVE].hlfg ) ); parse_color ( display, config.menu_hlbg_active, &( colors[ACTIVE].hlbg ) ); } - PangoFontMap *font_map = pango_cairo_font_map_new (); + PangoFontMap *font_map = pango_cairo_font_map_get_default (); + if(config.dpi > 0 ) { + pango_cairo_font_map_set_resolution((PangoCairoFontMap*)font_map, (double)config.dpi); + } p_context = pango_font_map_create_context ( font_map ); - g_object_unref ( font_map ); } void textbox_cleanup ( void ) diff --git a/source/xrmoptions.c b/source/xrmoptions.c index c91bbd86..648fa697 100644 --- a/source/xrmoptions.c +++ b/source/xrmoptions.c @@ -134,7 +134,8 @@ static XrmOption xrmOptions[] = { { xrm_Boolean, "hide-scrollbar", { .num = &config.hide_scrollbar }, NULL, "Hide scroll-bar" }, { xrm_Boolean, "markup-rows", { .num = &config.markup_rows }, NULL, "Show markup" }, { xrm_Boolean, "fullscreen", { .num = &config.fullscreen }, NULL, "Fullscreen" }, - { xrm_Boolean, "fake-transparency", { .num = &config.fake_transparency }, NULL, "Fake transparency" } + { xrm_Boolean, "fake-transparency", { .num = &config.fake_transparency }, NULL, "Fake transparency" }, + { xrm_SNumber, "dpi", { .snum = &config.dpi }, NULL, "DPI" } }; // Dynamic options.