From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Vincent LADEUIL Newsgroups: gmane.emacs.devel Subject: Re: display-mm-height for MacOS? Date: 23 Mar 2004 10:13:23 +0100 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: References: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1080033371 24643 80.91.224.253 (23 Mar 2004 09:16:11 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 23 Mar 2004 09:16:11 +0000 (UTC) Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Tue Mar 23 10:16:06 2004 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1B5i10-0003bZ-00 for ; Tue, 23 Mar 2004 10:16:06 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1B5i10-00077T-00 for ; Tue, 23 Mar 2004 10:16:06 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.30) id 1B5i10-0006nS-S9 for emacs-devel@quimby.gnus.org; Tue, 23 Mar 2004 04:16:06 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30) id 1B5hyu-0006My-Rh for emacs-devel@gnu.org; Tue, 23 Mar 2004 04:13:56 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30) id 1B5hyL-0006EC-5c for emacs-devel@gnu.org; Tue, 23 Mar 2004 04:13:52 -0500 Original-Received: from [213.228.0.169] (helo=postfix3-2.free.fr) by monty-python.gnu.org with esmtp (Exim 4.30) id 1B5hyK-0006Dy-OM for emacs-devel@gnu.org; Tue, 23 Mar 2004 04:13:20 -0500 Original-Received: from leclerc-1-81-56-32-165.fbx.proxad.net (leclerc-1-81-56-32-165.fbx.proxad.net [81.56.32.165]) by postfix3-2.free.fr (Postfix) with ESMTP id D25C2C1D6 for ; Tue, 23 Mar 2004 10:13:15 +0100 (CET) Original-Received: by leclerc-1-81-56-32-165.fbx.proxad.net (Postfix, from userid 502) id 6345C5660C; Tue, 23 Mar 2004 10:13:24 +0100 (CET) Original-To: emacs-devel@gnu.org In-Reply-To: Original-Lines: 58 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.4 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:20774 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:20774 >>>>> "David" == David Kastrup 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,