[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#48408: BUGFIX: window-default-font-height: check for nil string
From: |
martin rudalics |
Subject: |
bug#48408: BUGFIX: window-default-font-height: check for nil string |
Date: |
Fri, 14 May 2021 10:15:58 +0200 |
>> 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))))
- bug#48408: BUGFIX: window-default-font-height: check for nil string, (continued)
- bug#48408: BUGFIX: window-default-font-height: check for nil string, Eli Zaretskii, 2021/05/19
- bug#48408: BUGFIX: window-default-font-height: check for nil string, Boruch Baum, 2021/05/19
- bug#48408: BUGFIX: window-default-font-height: check for nil string, Eli Zaretskii, 2021/05/19
- bug#48408: BUGFIX: window-default-font-height: check for nil string, Eli Zaretskii, 2021/05/19
- bug#48408: BUGFIX: window-default-font-height: check for nil string, martin rudalics, 2021/05/16
bug#48408: BUGFIX: window-default-font-height: check for nil string, martin rudalics, 2021/05/14
bug#48408: BUGFIX: window-default-font-height: check for nil string, Boruch Baum, 2021/05/15