From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Mathias Dahl Newsgroups: gmane.emacs.help Subject: Re: Calculate window size in pixels Date: 06 May 2005 17:40:41 +0200 Message-ID: References: <87u0lgigvl.fsf-monnier+gnu.emacs.help@gnu.org> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1115396445 26863 80.91.229.2 (6 May 2005 16:20:45 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 6 May 2005 16:20:45 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri May 06 18:20:45 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DU5Xi-0003K0-JZ for geh-help-gnu-emacs@m.gmane.org; Fri, 06 May 2005 18:19:10 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DU5fS-0004Qa-Un for geh-help-gnu-emacs@m.gmane.org; Fri, 06 May 2005 12:27:11 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!logbridge.uoregon.edu!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 25 Original-X-Trace: individual.net mpvPRqBVzfMWJbCaLtJkTA8zPusOnQ1dxyLe3ye7yMyzJDfESh User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 Original-Xref: shelby.stanford.edu gnu.emacs.help:130724 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:26376 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:26376 Mathias Dahl 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