emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: display-mm-height for MacOS?


From: Vincent LADEUIL
Subject: Re: display-mm-height for MacOS?
Date: 23 Mar 2004 10:13:23 +0100
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

>>>>> "David" == David Kastrup <address@hidden> writes:

    David> And an update for developers: try C-x C-e behind the
    David> following expressions:

    David> (display-mm-height) ;; 203 on my 13.3" display
    David> (display-pixel-height) ;; 768 here 
    David> (face-attribute 'default :height) ;; 150 here

With the following patch applied, I obtain the following results :

(display-mm-height)                ;; 304 on my 17" 1444*900 LCD display
(display-pixel-height)             ;; 900 here
(face-attribute 'default :height)  ;; 135 here

Note that Mac OSX reports a  72 dpi resolution instead of 100 dpi
in my case.  But may be your calculus take this into account thru
the default font size ?

        Vincent

Index: src/macfns.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/macfns.c,v
retrieving revision 1.31
diff -u -r1.31 macfns.c
--- src/macfns.c        11 Mar 2004 22:43:18 -0000      1.31
+++ src/macfns.c        23 Mar 2004 08:58:48 -0000
@@ -3025,11 +3025,10 @@
   /* MAC_TODO: this is an approximation, and only of the main display */
 
   struct mac_display_info *dpyinfo = check_x_display_info (display);
-  short h, v;
 
-  ScreenRes (&h, &v);
-
-  return make_number ((int) (v / 72.0 * 25.4));
+    /* Height  in   pixels  divided  by   vertical  resolution,
+     * converted from inches to mm */
+  return make_number ((int) ((dpyinfo->height * 25.4) / dpyinfo->resy));
 }
 
 DEFUN ("x-display-mm-width", Fx_display_mm_width, Sx_display_mm_width, 0, 1, 0,
@@ -3043,11 +3042,10 @@
   /* MAC_TODO: this is an approximation, and only of the main display */
 
   struct mac_display_info *dpyinfo = check_x_display_info (display);
-  short h, v;
-
-  ScreenRes (&h, &v);
 
-  return make_number ((int) (h / 72.0 * 25.4));
+    /* Width  in   pixels  divided  by   horizontal  resolution,
+     * converted from inches to mm */
+  return make_number ((int) ((dpyinfo->width * 25.4) / dpyinfo->resx));
 }
 
 DEFUN ("x-display-backing-store", Fx_display_backing_store,




reply via email to

[Prev in Thread] Current Thread [Next in Thread]