From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David Reitter Newsgroups: gmane.emacs.help Subject: RE: char-width of a font? pixel-width of a future frame? NOT SOLVED Date: Mon, 30 May 2005 11:09:52 +0100 Message-ID: <3CE7CEA4-36C0-4D39-ACFF-8092DA202865@gmail.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 (Apple Message framework v730) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1117448710 496 80.91.229.2 (30 May 2005 10:25:10 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 30 May 2005 10:25:10 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon May 30 12:25:05 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DchRV-0006VL-Da for geh-help-gnu-emacs@m.gmane.org; Mon, 30 May 2005 12:24:21 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DchWM-0002E9-3U for geh-help-gnu-emacs@m.gmane.org; Mon, 30 May 2005 06:29:22 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DchGZ-0005Gw-Kx for help-gnu-emacs@gnu.org; Mon, 30 May 2005 06:13:03 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DchGX-0005Fq-ML for Help-gnu-emacs@gnu.org; Mon, 30 May 2005 06:13:02 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DchGW-0005Ei-8H for Help-gnu-emacs@gnu.org; Mon, 30 May 2005 06:13:00 -0400 Original-Received: from [64.233.184.198] (helo=wproxy.gmail.com) by monty-python.gnu.org with esmtp (Exim 4.34) id 1DchF3-00065c-N6 for Help-gnu-emacs@gnu.org; Mon, 30 May 2005 06:11:29 -0400 Original-Received: by wproxy.gmail.com with SMTP id 50so1520497wri for ; Mon, 30 May 2005 03:09:55 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:mime-version:content-transfer-encoding:message-id:content-type:to:from:subject:date:x-mailer; b=BC+hNlxL8pMv1nVp4Ryu/so6vb7WjwQGfBczFyTxfo0lWvJrEBTfq9Lhlt1Vp1V0TeG6sLSF1+cYLUjhy9NrGwBwaUUJ9pXsexRAaA8uqM18a/TGtVvwXDjVBK+1hFhpWT+dzcuatDEHwyasqfvTYGkWDTeePYKWbSda76EUHPI= Original-Received: by 10.54.26.33 with SMTP id 33mr2601495wrz; Mon, 30 May 2005 03:09:55 -0700 (PDT) Original-Received: from ?10.0.0.58? ([82.20.45.45]) by mx.gmail.com with ESMTP id 16sm892448wrl.2005.05.30.03.09.55; Mon, 30 May 2005 03:09:55 -0700 (PDT) Original-To: Help-gnu-emacs@gnu.org X-Mailer: Apple Mail (2.730) 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:27070 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:27070 > How do I find out either > > - what the (average) width of characters of a given font/ > fontset is? or > > `frame-char-width' or height gives the pixel width or height of the > frame's > default font. Yes, but they only work with an existing frame as parameter. I only have a font/fontset or some frame-parameters, but not a frame. > > - what, given a set of frame-parameters (including font and > width and > height), what the pixel-width and pixel-height of a frame are > going > to be once it is created? > > If the frame is to fit the buffer (you mentioned font size), then > you need > to calculate the line length and number of lines, then multiply > these by the > frame-char-width and frame-char-height. You can see code that > calculates > frame size from buffer size here: > http://www.emacswiki.org/elisp/fit-frame.el. I need to know what width a frame is going to have in pixels, before it is created. Frames are not fitted by default, and I'm not trying to fit frames. I'm just trying to determine a decent position to open the frame at. That's why I was asking for frame-char-width for a given font, to calculate the pixel-width. > Otherwise, what do you mean by the frame size - it could be anything you > want. What is the relation between the frame parameters you mention and the > frame size you want? Frames are created with whatever is set in the width / height specification of the default-frame-alist (or whatever is given to make-frame). These specifications are in characters / lines, not pixels. I just need to translate to pixels. Anyone?? - D