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: Tue, 10 May 2005 12:28:45 +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 1115720637 7590 80.91.229.2 (10 May 2005 10:23:57 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 10 May 2005 10:23:57 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue May 10 12:23:55 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DVRtu-0006r4-Ex for geh-help-gnu-emacs@m.gmane.org; Tue, 10 May 2005 12:23:42 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DVS2P-00078l-Tq for geh-help-gnu-emacs@m.gmane.org; Tue, 10 May 2005 06:32:29 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!newsmi-us.news.garr.it!newsmi-eu.news.garr.it!NewsITBone-GARR!newsserver.news.garr.it!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 35 Original-X-Trace: individual.net hWskvpcSlilAPnOpy/eQDwAUySgXyxUBaRz9N5TbvAInmGc9re User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/21.3.50 (windows-nt) Cancel-Lock: sha1:UWqw4/DqnNX8wNPT0nAbXesy2AI= Original-Xref: shelby.stanford.edu gnu.emacs.help:130817 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:26473 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:26473 "Ehud Karni" writes: > 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. That seems to be exactly what I wanted. Strange I missed it. I will try using that instead and see how it works. Thanks! /Mathias