all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: David Reitter <david.reitter@gmail.com>
Subject: RE: char-width of a font? pixel-width of a future frame? NOT SOLVED
Date: Mon, 30 May 2005 11:09:52 +0100	[thread overview]
Message-ID: <3CE7CEA4-36C0-4D39-ACFF-8092DA202865@gmail.com> (raw)

> 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

             reply	other threads:[~2005-05-30 10:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-30 10:09 David Reitter [this message]
2005-05-30 13:55 ` char-width of a font? pixel-width of a future frame? NOT SOLVED Drew Adams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3CE7CEA4-36C0-4D39-ACFF-8092DA202865@gmail.com \
    --to=david.reitter@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.