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? NOT SOLVED


From: Drew Adams
Subject: RE: char-width of a font? pixel-width of a future frame? NOT SOLVED
Date: Mon, 30 May 2005 06:55:21 -0700

    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.

For a given frame: use frame-pixel-width / -height. You can always create a
test frame, perhaps invisible, using default-frame-alist, and get its size
in pixels.

But it sounds like you have want to know the pixel size of a frame that
would be created using default-frame-alist, without creating any such frame.
You might try one of these (untested):

 - (face-attribute 'default :height t t). This can give you the height of a
font in 1/10 pt, but it can also give you a scale factor instead. To convert
points to pixels, perhaps you can use display-pixels-per-inch plus the
number of points in an inch.

 - Get the pixel size from the font name - see pixelsize and x-font-regexp
in faces.el. Multiply by the height parameter in default-frame-alist.

That's all I can think of. Perhaps someone has a simple and direct solution.






reply via email to

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