[Top][All Lists]

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

bug#19194: 24.4.50; `window-body-width' is not dynamic relative to font

From: martin rudalics
Subject: bug#19194: 24.4.50; `window-body-width' is not dynamic relative to font size changes
Date: Sat, 20 Dec 2014 15:49:39 +0100

> The one thing I'd add is an explanation of how "character width" is
> found or computed for variable-width fonts.  (E.g. is it the width of an
> "M"?)

Elsewhere I proposed:

(defun window-char-width (&optional window)
  "Return default character width for WINDOW.
WINDOW must be a live window and defaults to the selected one."
  (setq window (window-normalize-window window t))
  (with-current-buffer (window-buffer window)
    (let* ((info (font-info (face-font 'default)))
       (width (aref info 11)))
      (if (> width 0)
    (aref info 10)))))

You could try to experiment with this and either use

(width (aref info 10))


(width (aref info 7))

instead of (aref info 11).  Or use something like

(face-font 'default ?M) instead of (face-font 'default).

I use variable width fonts only in customization buffers, so I'm not
very qualified at checking this myself.  We can use whatever you find
here provided we can pack it into an argument of `window-body-width'.

And Eli certainly knows better, so wait.  Maybe my idea is silly.


reply via email to

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