From 12429bd3ef2c2738a37114101474e6a96402ac08 Mon Sep 17 00:00:00 2001 From: Peter Hurley Date: Mon, 13 Feb 2012 14:08:06 -0500 Subject: [PATCH] Add dpi font scaling to Xft driver Pango scales the font pixelsize by Xft's dpi / 72. So, when the system font selected is "Monospace, 8pt", the actual pixelsize fontconfig sees is 10.666667 (when the Xft dpi is 96.0). This is what gives the text in gnome-terminal and gedit a more condensed appearance. This patch adds this same behavior to the Xft driver. Note however, that this works on pixelsize not font size. For example, with font setting via .Xresources file: emacs*font: Monospace:pixelsize=8 gives the same appearance as gedit when the monospace-font-name is "Monospace 8". Signed-off-by: Peter Hurley --- src/xftfont.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/xftfont.c b/src/xftfont.c index de2572c..c002ee7 100644 --- a/src/xftfont.c +++ b/src/xftfont.c @@ -324,7 +324,7 @@ xftfont_open (f, entity, pixel_size) if (i < 0) i = 0; FcPatternAddInteger (pat, FC_SLANT, i); FcPatternAddInteger (pat, FC_WIDTH, FONT_WIDTH_NUMERIC (entity)); - FcPatternAddDouble (pat, FC_PIXEL_SIZE, pixel_size); + FcPatternAddDouble (pat, FC_PIXEL_SIZE, pixel_size * f->resy / 72.0); val = AREF (entity, FONT_FAMILY_INDEX); if (! NILP (val)) FcPatternAddString (pat, FC_FAMILY, (FcChar8 *) SDATA (SYMBOL_NAME (val))); -- 1.7.5.4