GNU bug report logs -
#19194
24.4.50; `window-body-width' is not dynamic relative to font size changes
Previous Next
Reported by: Joe Corneli <holtzermann17 <at> gmail.com>
Date: Wed, 26 Nov 2014 13:48:01 UTC
Severity: normal
Tags: notabug
Merged with 20022
Found in versions 24.4.50, 24.4.90
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
> Date: Sat, 20 Dec 2014 15:49:39 +0100
> From: martin rudalics <rudalics <at> gmx.at>
> CC: Eli Zaretskii <eliz <at> gnu.org>, 19194 <at> debbugs.gnu.org
>
> > 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)
> width
> (aref info 10)))))
>
> You could try to experiment with this and either use
>
> (width (aref info 10))
>
> or
>
> (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.
I actually don't really understand the question. What does "character
width" mean when each character has a different width? Do you (Joe)
mean you want to know the actual width of each and every character?
If so, what for?
In any case, if you do need the width of individual characters, take a
look at font-get-glyphs (and font-at to get you the font for that).
This bug report was last modified 3 years and 105 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.