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

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

Re: Font width and frame width


From: Chris McMahan
Subject: Re: Font width and frame width
Date: Sun, 15 Mar 2009 21:31:45 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.90 (windows-nt)

Does this work for you?

(pixels-to-cols (display-pixel-width))

- Chris

Lennart Borgman <lennart.borgman@gmail.com> writes:

> How do I get the number of columns on a maximized frame? I expected
> the following to give me this in cols, but it does not give the same
> value as (frame-width).
>
>
> ;; Run this on a maximized frame
> (defun my-display-test ()
>   (let* ((display-pixel-width (display-pixel-width))
>          (fontname (face-attribute 'default :font))
>          (font-info (font-info fontname))
>          (font-width  (aref font-info 2))
>          (cols (/ display-pixel-width font-width))
>          )
>     (message "frame-width: %s, cols: %s" (frame-width) cols)
>     ))
>
>

-- 
     (.   .)
  =ooO=(_)=Ooo=====================================
  Chris McMahan | first_initiallastname@one.dot.net
  =================================================


reply via email to

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