all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Font width and frame width
@ 2009-03-15 14:54 Lennart Borgman
  0 siblings, 0 replies; 2+ messages in thread
From: Lennart Borgman @ 2009-03-15 14:54 UTC (permalink / raw)
  To: help-gnu-emacs mailing list

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




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Font width and frame width
       [not found] <mailman.3227.1237128897.31690.help-gnu-emacs@gnu.org>
@ 2009-03-16  1:31 ` Chris McMahan
  0 siblings, 0 replies; 2+ messages in thread
From: Chris McMahan @ 2009-03-16  1:31 UTC (permalink / raw)
  To: help-gnu-emacs

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-03-16  1:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-15 14:54 Font width and frame width Lennart Borgman
     [not found] <mailman.3227.1237128897.31690.help-gnu-emacs@gnu.org>
2009-03-16  1:31 ` Chris McMahan

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.