all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Vincent LADEUIL <v.ladeuil+emacs-devel@free.fr>
Subject: Re: display-mm-height for MacOS?
Date: 23 Mar 2004 10:13:23 +0100	[thread overview]
Message-ID: <m1wu5cncy4.fsf@leclerc-1-81-56-32-165.fbx.proxad.net> (raw)
In-Reply-To: <x5wu5dynvo.fsf@lola.goethe.zz>

>>>>> "David" == David Kastrup <dak@gnu.org> 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	other threads:[~2004-03-23  9:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-22 12:08 display-mm-height for MacOS? David Kastrup
2004-03-22 13:22 ` Hans-Peter Binder
2004-03-22 14:09   ` David Kastrup
2004-03-23  9:13     ` Vincent LADEUIL [this message]
2004-03-23  0:51 ` YAMAMOTO Mitsuharu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m1wu5cncy4.fsf@leclerc-1-81-56-32-165.fbx.proxad.net \
    --to=v.ladeuil+emacs-devel@free.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.