[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: char-width of a font? pixel-width of a future frame? NOT SOLVED

From: David Reitter
Subject: RE: char-width of a font? pixel-width of a future frame? NOT SOLVED
Date: Mon, 30 May 2005 11:09:52 +0100

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:

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.


- D

reply via email to

[Prev in Thread] Current Thread [Next in Thread]