emacs/emacs-23.1-fontdpi.patch

46 lines
2.1 KiB
Diff
Raw Normal View History

2010-01-04 11:26:26 +00:00
diff -up emacs-23.1/src/xterm.c.fontdpi emacs-23.1/src/xterm.c
2010-01-07 13:29:30 +00:00
--- emacs-23.1/src/xterm.c.fontdpi 2010-01-04 09:11:45.000000000 +0100
+++ emacs-23.1/src/xterm.c 2010-01-04 11:50:19.627777180 +0100
@@ -10380,17 +10380,31 @@ x_term_init (display_name, xrm_option, r
2010-01-04 11:26:26 +00:00
dpyinfo->visual, AllocNone);
{
- int screen_number = XScreenNumberOfScreen (dpyinfo->screen);
- double pixels = DisplayHeight (dpyinfo->display, screen_number);
- double mm = DisplayHeightMM (dpyinfo->display, screen_number);
- /* Mac OS X 10.3's Xserver sometimes reports 0.0mm. */
- dpyinfo->resy = (mm < 1) ? 100 : pixels * 25.4 / mm;
- pixels = DisplayWidth (dpyinfo->display, screen_number);
- mm = DisplayWidthMM (dpyinfo->display, screen_number);
- /* Mac OS X 10.3's Xserver sometimes reports 0.0mm. */
- dpyinfo->resx = (mm < 1) ? 100 : pixels * 25.4 / mm;
+ /* If we are using Xft, check dpi value in X resources.
+ It is better we use it as well, since Xft will use it, as will all
+ Gnome applications. If our real DPI is smaller or larger than the
+ one Xft uses, our font will look smaller or larger than other
+ for other applications, even if it is the same font name (monospace-10
+ for example). */
+ char *v = XGetDefault (dpyinfo->display, "Xft", "dpi");
+ double d;
+ if (v != NULL && sscanf (v, "%lf", &d) == 1)
+ dpyinfo->resy = dpyinfo->resx = d;
}
+ if (dpyinfo->resy < 1)
+ {
+ int screen_number = XScreenNumberOfScreen (dpyinfo->screen);
+ double pixels = DisplayHeight (dpyinfo->display, screen_number);
+ double mm = DisplayHeightMM (dpyinfo->display, screen_number);
+ /* Mac OS X 10.3's Xserver sometimes reports 0.0mm. */
+ dpyinfo->resy = (mm < 1) ? 100 : pixels * 25.4 / mm;
+ pixels = DisplayWidth (dpyinfo->display, screen_number);
+ mm = DisplayWidthMM (dpyinfo->display, screen_number);
+ /* Mac OS X 10.3's Xserver sometimes reports 0.0mm. */
+ dpyinfo->resx = (mm < 1) ? 100 : pixels * 25.4 / mm;
+ }
+
dpyinfo->Xatom_wm_protocols
= XInternAtom (dpyinfo->display, "WM_PROTOCOLS", False);
dpyinfo->Xatom_wm_take_focus
2010-01-07 13:29:30 +00:00