unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: martin rudalics <rudalics@gmx.at>
Cc: holtzermann17@gmail.com, 19194@debbugs.gnu.org
Subject: bug#19194: 24.4.50; `window-body-width' is not dynamic relative to font size changes
Date: Sat, 20 Dec 2014 18:18:22 +0200	[thread overview]
Message-ID: <834msqs3ap.fsf@gnu.org> (raw)
In-Reply-To: <54958C83.8010209@gmx.at>

> Date: Sat, 20 Dec 2014 15:49:39 +0100
> From: martin rudalics <rudalics@gmx.at>
> CC: Eli Zaretskii <eliz@gnu.org>, 19194@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).





  reply	other threads:[~2014-12-20 16:18 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-26 13:47 bug#19194: 24.4.50; `window-body-width' is not dynamic relative to font size changes Joe Corneli
2014-11-26 15:55 ` Stefan Monnier
2014-11-26 16:34   ` Joe Corneli
2014-11-26 17:06     ` Eli Zaretskii
2014-11-26 16:04 ` Eli Zaretskii
2014-11-27  9:44 ` martin rudalics
2014-11-27 10:54   ` Joe Corneli
2014-11-27 18:35     ` martin rudalics
2014-11-27 18:52       ` Eli Zaretskii
2014-11-27 19:58         ` martin rudalics
2014-11-27 20:43           ` Eli Zaretskii
2014-11-28  7:29             ` martin rudalics
2014-11-28  8:49               ` Eli Zaretskii
2014-11-28 18:38                 ` martin rudalics
2014-11-28 19:20                   ` Eli Zaretskii
2014-12-19 19:40                   ` Eli Zaretskii
2014-12-20 10:10                     ` martin rudalics
2014-12-20 11:52                       ` Joe Corneli
2014-12-20 14:49                         ` martin rudalics
2014-12-20 16:18                           ` Eli Zaretskii [this message]
2014-12-20 16:31                             ` martin rudalics
2014-12-20 16:47                               ` Eli Zaretskii
2014-12-20 17:51                                 ` martin rudalics
2014-12-20 18:29                                   ` Eli Zaretskii
2014-11-27 20:23       ` Joe Corneli
2014-11-28  7:27         ` martin rudalics
2014-11-27 16:17   ` Eli Zaretskii
2014-11-27 18:35     ` martin rudalics
2014-11-27 18:46       ` Eli Zaretskii
2014-11-27 19:58         ` martin rudalics
2014-11-27 20:37           ` Eli Zaretskii
2014-11-28  7:27             ` martin rudalics
2014-11-28  8:42               ` Eli Zaretskii
2022-02-10  8:16 ` bug#19194: bug#20022: 24.4.90; window-body-height, window-body-width wrong value after text-scale-adjust Lars Ingebrigtsen
2022-02-10 17:39   ` bug#19194: [External] : " Drew Adams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=834msqs3ap.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=19194@debbugs.gnu.org \
    --cc=holtzermann17@gmail.com \
    --cc=rudalics@gmx.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).