From 96c8afdbbbffcdafd626fd43cd3cd01f5a8da193 Mon Sep 17 00:00:00 2001 From: "dbaron%dbaron.org" Date: Thu, 19 Jan 2006 01:19:06 +0000 Subject: [PATCH] Old-pango code that should be correct. r=vlad git-svn-id: svn://10.0.0.236/trunk@187802 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/gfx/thebes/src/gfxPangoFonts.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/mozilla/gfx/thebes/src/gfxPangoFonts.cpp b/mozilla/gfx/thebes/src/gfxPangoFonts.cpp index d1e0d589ef6..cab5eba9fa7 100644 --- a/mozilla/gfx/thebes/src/gfxPangoFonts.cpp +++ b/mozilla/gfx/thebes/src/gfxPangoFonts.cpp @@ -184,6 +184,21 @@ static void InitPangoLib() // leak lib deliberately } +static double +GetXftDPI(void) +{ + char *val = XGetDefault(GDK_DISPLAY(), "Xft", "dpi"); + if (val) { + char *e; + double d = strtod(val, &e); + + if (e != val) + return round(d); + } + + return 0; +} + static void MOZ_pango_font_description_set_absolute_size(PangoFontDescription *desc, double size) @@ -191,8 +206,8 @@ MOZ_pango_font_description_set_absolute_size(PangoFontDescription *desc, if (PTR_pango_font_description_set_absolute_size) { PTR_pango_font_description_set_absolute_size(desc, size); } else { - // Fake it! Assume the server DPI is 96. If it isn't, too bad - pango_font_description_set_size(desc, (gint)(size * 72.0/96.0)); + pango_font_description_set_size(desc, + (gint)(size * 72.0 / GetXftDPI())); } } #else