[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 48eb022debb: Avoid errors in posn-col-row if fonts disappear from
From: |
Po Lu |
Subject: |
master 48eb022debb: Avoid errors in posn-col-row if fonts disappear from an X server |
Date: |
Tue, 22 Aug 2023 00:35:50 -0400 (EDT) |
branch: master
commit 48eb022debb85ec3b844e6833194bb05d35cb5c5
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>
Avoid errors in posn-col-row if fonts disappear from an X server
* lisp/window.el (window-font-width, window-font-height): Resort
to frame-char-width/height should the font returned by font-info
be unavailable.
---
lisp/window.el | 23 ++++++++++++++---------
1 file changed, 14 insertions(+), 9 deletions(-)
diff --git a/lisp/window.el b/lisp/window.el
index d91bbabc010..b0970cfb064 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -2121,12 +2121,16 @@ remapped (see `face-remapping-alist'), the function
returns the
information for the remapped face."
(with-selected-window (window-normalize-window window t)
(if (display-multi-font-p)
- (let* ((face (if face face 'default))
- (info (font-info (face-font face)))
- (width (aref info 11)))
- (if (> width 0)
- width
- (aref info 10)))
+ ;; Opening the XLFD returned by `font-info' may be
+ ;; unsuccessful. Use `frame-char-width' as a recourse if
+ ;; such a situation transpires.
+ (or (when-let* ((face (if face face 'default))
+ (info (font-info (face-font face)))
+ (width (aref info 11)))
+ (if (> width 0)
+ width
+ (aref info 10)))
+ (frame-char-width))
(frame-char-width))))
(defun window-font-height (&optional window face)
@@ -2138,9 +2142,10 @@ remapped (see `face-remapping-alist'), the function
returns the
information for the remapped face."
(with-selected-window (window-normalize-window window t)
(if (display-multi-font-p)
- (let* ((face (if face face 'default))
- (info (font-info (face-font face))))
- (aref info 3))
+ (or (when-let* ((face (if face face 'default))
+ (info (font-info (face-font face))))
+ (aref info 3))
+ (frame-char-height))
(frame-char-height))))
(defvar overflow-newline-into-fringe)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 48eb022debb: Avoid errors in posn-col-row if fonts disappear from an X server,
Po Lu <=