help-gnu-emacs
[Top][All Lists]
Advanced

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

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


From: Drew Adams
Subject: RE: char-width of a font? pixel-width of a future frame?
Date: Sun, 29 May 2005 07:03:37 -0700

    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.

    - 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.

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?





reply via email to

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