From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Ehud Karni" Newsgroups: gmane.emacs.help Subject: Re: Calculate window size in pixels Date: Mon, 9 May 2005 14:02:21 +0300 Organization: Mivtach-Simon Insurance agencies Message-ID: <200505091102.j49B2Lxk026669@beta.mvs.co.il> References: <87u0lgigvl.fsf-monnier+gnu.emacs.help@gnu.org> Reply-To: ehud@unix.mvs.co.il NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-8-i Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1115636698 11443 80.91.229.2 (9 May 2005 11:04:58 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 9 May 2005 11:04:58 +0000 (UTC) Cc: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon May 09 13:04:49 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DV62m-00013C-RP for geh-help-gnu-emacs@m.gmane.org; Mon, 09 May 2005 13:03:25 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DV6B6-0006Yq-7z for geh-help-gnu-emacs@m.gmane.org; Mon, 09 May 2005 07:12:00 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DV66K-0005J8-Eu for help-gnu-emacs@gnu.org; Mon, 09 May 2005 07:07:04 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DV666-0005By-RO for help-gnu-emacs@gnu.org; Mon, 09 May 2005 07:06:54 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DV665-00059N-9Y for help-gnu-emacs@gnu.org; Mon, 09 May 2005 07:06:49 -0400 Original-Received: from [193.16.147.12] (helo=unix.mvs.co.il) by monty-python.gnu.org with esmtp (Exim 4.34) id 1DV67l-0006H9-06 for help-gnu-emacs@gnu.org; Mon, 09 May 2005 07:08:33 -0400 Original-Received: from beta.mvs.co.il (beta [10.253.0.3]) by unix.mvs.co.il (8.13.0/8.13.0) with ESMTP id j49B2L7T028434 for ; Mon, 9 May 2005 14:02:21 +0300 Original-Received: from beta.mvs.co.il (localhost [127.0.0.1]) by beta.mvs.co.il (8.12.10/8.12.10) with ESMTP id j49B2LW9026672 for ; Mon, 9 May 2005 14:02:21 +0300 Original-Received: (from root@localhost) by beta.mvs.co.il (8.12.10/8.12.10/Submit) id j49B2Lxk026669; Mon, 9 May 2005 14:02:21 +0300 Original-To: brakjoller@hotmail.com In-reply-to: (message from Mathias Dahl on 06 May 2005 17:40:41 +0200) X-Mailer: Emacs 21.3.1 rmail (send-msg 1.108) 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:26452 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:26452 On 06 May 2005 17:40:41 +0200, Mathias Dahl wrote: > > (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)))) I think that `frame-char-height' and `frame-char-width' is what you are looking for. I use the following to change the font without resizing the frames. This uses only the `editable' part of the frame - without the border and menus areas. (defun set-font-keep-size (font) "set font to use, keep window size" (let ((fht (* (frame-parameter nil 'height) (frame-char-height))) (fwd (* (frame-parameter nil 'width) (frame-char-width)))) (set-default-font font) (set-frame-value-all 'font font) (set-frame-value-all 'height (/ fht (frame-char-height))) (set-frame-value-all 'width (/ fwd (frame-char-width))))) `set-frame-value-all is my function to set a value on all frames. Ehud. -- Ehud Karni Tel: +972-3-7966-561 /"\ Mivtach - Simon Fax: +972-3-7966-667 \ / ASCII Ribbon Campaign Insurance agencies (USA) voice mail and X Against HTML Mail http://www.mvs.co.il FAX: 1-815-5509341 / \ GnuPG: 98EA398D Better Safe Than Sorry