unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: martin rudalics <rudalics@gmx.at>
To: Eli Zaretskii <eliz@gnu.org>
Cc: boruch_baum@gmx.com, 48408@debbugs.gnu.org
Subject: bug#48408: BUGFIX: window-default-font-height: check for nil string
Date: Fri, 14 May 2021 10:15:58 +0200	[thread overview]
Message-ID: <25ac01b7-c6ef-3554-60d0-25ddead80495@gmx.at> (raw)
In-Reply-To: <83bl9dzsg5.fsf@gnu.org>

 >> Sorry.  This function is missing from my current window.el here ...
 >
 > Really?  It is still there on today's master.  So I wonder what kind
 > of revolution do you have waiting in the wings...

Nothing special.  Just a function that takes its buffer's face remapping
into account.  But it lacks an alias and is apparently just as broken as
the old one, see below.

martin


(defun window-face-font-height (&optional window buffer-or-name face)
   "Return font height in pixels of FACE for BUFFER-OR-NAME in WINDOW.
WINDOW must be a live window and defaults to the selected one.
BUFFER-OR-NAME may be a buffer or the name of an existing buffer
and defaults to WINDOW's buffer.  FACE must specify a valid face
and defaults to the default face.

The return value accounts for any remapping of FACE's font (see
`face-remapping-alist') in BUFFER-OR-NAME.  If no such remapping
has been specified, return the height of the font of FACE for
WINDOW's frame.  If BUFFER-OR-NAME does not specify WINDOW's
buffer, calculate the return value with WINDOW's buffer
temporarily set to the buffer specified by BUFFER-OR-NAME."
   (let* ((window (window-normalize-window window t))
          (frame (window-frame window)))
     (if (display-multi-font-p frame)
         (let* ((buffer (if buffer-or-name
                            (window-normalize-buffer buffer-or-name)
                          (window-buffer window)))
                (face (or face 'default))
                (font (if (eq window (selected-window))
                          (window--buffer-face-font buffer face)
                        (with-selected-window window
                          (window--buffer-face-font buffer face))))
                (frame-font (frame-parameter frame 'font)))
	  ;; Avoid calling `font-info' if the font whose info we want is
	  ;; the same as the corresponding frame's default font since
	  ;; `font-info' is expensive for some fonts, see bug #14838.
           (if (and font (not (string-equal font frame-font)))
               (aref (font-info font frame) 3)
             (frame-char-height frame)))
       (frame-char-height frame))))





  reply	other threads:[~2021-05-14  8:15 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-14  1:15 bug#48408: BUGFIX: window-default-font-height: check for nil string Boruch Baum
2021-05-14  6:39 ` Eli Zaretskii
2021-05-16  3:06   ` Boruch Baum
2021-05-16  4:22     ` Eli Zaretskii
2021-05-16  4:42       ` Boruch Baum
2021-05-16  5:25         ` Eli Zaretskii
2021-05-16  6:05           ` Boruch Baum
2021-05-16  6:32             ` Eli Zaretskii
2021-05-16  6:29           ` Eli Zaretskii
     [not found]             ` <20210516065904.5wweuipi23oy5g2x@E15-2016.optimum.net>
2021-05-16  8:30               ` Eli Zaretskii
2021-05-16  8:35                 ` martin rudalics
2021-05-16  8:56                   ` Eli Zaretskii
2021-05-16  9:08                     ` Eli Zaretskii
2021-05-16  9:28                       ` martin rudalics
2021-05-16  9:36                         ` Eli Zaretskii
2021-05-19  4:00                 ` Boruch Baum
2021-05-19  7:45                   ` martin rudalics
2021-05-19 10:39                     ` Boruch Baum
2021-05-19 11:29                   ` Eli Zaretskii
2021-05-19 11:55                     ` Boruch Baum
2021-05-19 14:17                       ` Eli Zaretskii
2021-05-19 16:01                   ` Eli Zaretskii
2022-07-12 22:59                     ` Lars Ingebrigtsen
2021-05-16  8:31             ` martin rudalics
2021-05-14  7:09 ` martin rudalics
2021-05-14  7:15   ` martin rudalics
2021-05-14  7:26     ` Eli Zaretskii
2021-05-14  8:15       ` martin rudalics [this message]
2021-05-14 10:45         ` Eli Zaretskii
2021-05-16  3:11   ` Boruch Baum

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=25ac01b7-c6ef-3554-60d0-25ddead80495@gmx.at \
    --to=rudalics@gmx.at \
    --cc=48408@debbugs.gnu.org \
    --cc=boruch_baum@gmx.com \
    --cc=eliz@gnu.org \
    /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).