help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Calculate window size in pixels


From: Mathias Dahl
Subject: Re: Calculate window size in pixels
Date: 06 May 2005 17:40:41 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

Mathias Dahl <address@hidden> writes:

 
> Which means I can use this:
> 
> (defun window-height-pixels ()
>   (let ((line-pixel-height-ratio (/ (+ (frame-pixel-height) 0.0) 
> (frame-height)))
>         (column-pixel-width-ratio (/ (+ (frame-pixel-width) 0.0) 
> (frame-width))))
>     (ftruncate (* (window-height) line-pixel-height-ratio))))
> 
> (defun window-width-pixels ()
>   (let ((column-pixel-width-ratio (/ (+ (frame-pixel-width) 0.0) 
> (frame-width))))
>     (ftruncate (* (window-width) column-pixel-width-ratio))))

And even better:

(defun window-height-pixels ()
  (let ((line-pixel-height-ratio (/ (+ (frame-pixel-height) 0.0) 
(frame-height))))
    (truncate (* (window-height) line-pixel-height-ratio))))

(defun window-width-pixels ()
  (let ((column-pixel-width-ratio (/ (+ (frame-pixel-width) 0.0) 
(frame-width))))
    (truncate (* (window-width) column-pixel-width-ratio))))

/Mathias


reply via email to

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