unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* display-mm-height for MacOS?
@ 2004-03-22 12:08 David Kastrup
  2004-03-22 13:22 ` Hans-Peter Binder
  2004-03-23  0:51 ` YAMAMOTO Mitsuharu
  0 siblings, 2 replies; 5+ messages in thread
From: David Kastrup @ 2004-03-22 12:08 UTC (permalink / raw)



People are trying out preview-latex, and it would appear that the
size calculations fail utterly.

preview-latex creates bitmaps to fit in well with the screen.  It uses
display-mm-height and display-pixel-height for calculating the
resolution of the screen, and then takes the point size of the default
font to make a guess how large the font is in reality.  This then gets
transformed into pixels, and the resulting images should match up
fine.

Or so is the theory, and the way stuff works under X.

On MacOS, it would appear that this results in awfully large images,
so one of the three above stated dimensions would seem to be quite
wrong.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: display-mm-height for MacOS?
  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  0:51 ` YAMAMOTO Mitsuharu
  1 sibling, 1 reply; 5+ messages in thread
From: Hans-Peter Binder @ 2004-03-22 13:22 UTC (permalink / raw)
  Cc: emacs-devel

* David Kastrup <dak@gnu.org> writes:
> People are trying out preview-latex, and it would appear that the
> size calculations fail utterly.

Just for your information, here are some screenshots of the problem:

<URL:http://www.appledomain.de/emacs/screenshots/emacs-2.jpg>
<URL:http://www.appledomain.de/emacs/screenshots/emacs-3.jpg>


Regards/Gruesse
Hans-Peter Binder
-- 
(coffee-mode -1)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: display-mm-height for MacOS?
  2004-03-22 13:22 ` Hans-Peter Binder
@ 2004-03-22 14:09   ` David Kastrup
  2004-03-23  9:13     ` Vincent LADEUIL
  0 siblings, 1 reply; 5+ messages in thread
From: David Kastrup @ 2004-03-22 14:09 UTC (permalink / raw)
  Cc: emacs-devel

Hans-Peter Binder <macosx.pb@gmx.de> writes:

> * David Kastrup <dak@gnu.org> writes:
> > People are trying out preview-latex, and it would appear that the
> > size calculations fail utterly.
> 
> Just for your information, here are some screenshots of the problem:
> 
> <URL:http://www.appledomain.de/emacs/screenshots/emacs-2.jpg>
> <URL:http://www.appledomain.de/emacs/screenshots/emacs-3.jpg>

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

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

Note that the face attribute is specified in tenths of PostScript
points.

I use this data to calculate the pixel height of graphics supposed to
fit the size of the default font.

What output do you Carbonized hackers get?

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: display-mm-height for MacOS?
  2004-03-22 12:08 display-mm-height for MacOS? David Kastrup
  2004-03-22 13:22 ` Hans-Peter Binder
@ 2004-03-23  0:51 ` YAMAMOTO Mitsuharu
  1 sibling, 0 replies; 5+ messages in thread
From: YAMAMOTO Mitsuharu @ 2004-03-23  0:51 UTC (permalink / raw)
  Cc: emacs-devel

>>>>> On 22 Mar 2004 13:08:11 +0100, David Kastrup <dak@gnu.org> said:

> On MacOS, it would appear that this results in awfully large images,
> so one of the three above stated dimensions would seem to be quite
> wrong.

Could you try this patch?

				     YAMAMOTO Mitsuharu
				mituharu@math.s.chiba-u.ac.jp

Index: src/macfns.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/macfns.c,v
retrieving revision 1.31
diff -c -r1.31 macfns.c
*** src/macfns.c	11 Mar 2004 22:43:18 -0000	1.31
--- src/macfns.c	23 Mar 2004 00:42:32 -0000
***************
*** 3025,3035 ****
    /* 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));
  }
  
  DEFUN ("x-display-mm-width", Fx_display_mm_width, Sx_display_mm_width, 0, 1, 0,
--- 3025,3032 ----
    /* MAC_TODO: this is an approximation, and only of the main display */
  
    struct mac_display_info *dpyinfo = check_x_display_info (display);
  
!   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,3053 ****
    /* 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));
  }
  
  DEFUN ("x-display-backing-store", Fx_display_backing_store,
--- 3040,3047 ----
    /* MAC_TODO: this is an approximation, and only of the main display */
  
    struct mac_display_info *dpyinfo = check_x_display_info (display);
  
!   return make_number ((int) (dpyinfo->width * 25.4 / dpyinfo->resx));
  }
  
  DEFUN ("x-display-backing-store", Fx_display_backing_store,

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: display-mm-height for MacOS?
  2004-03-22 14:09   ` David Kastrup
@ 2004-03-23  9:13     ` Vincent LADEUIL
  0 siblings, 0 replies; 5+ messages in thread
From: Vincent LADEUIL @ 2004-03-23  9:13 UTC (permalink / raw)


>>>>> "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,

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2004-03-23  9:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2004-03-23  0:51 ` YAMAMOTO Mitsuharu

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).