From 1a67b811cbad70fec1d0eaf7a9e3c66784fe6556 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 13 Jul 2013 10:26:43 +0300 Subject: [PATCH] Fix bug #14838 with slow scrolling with certain fonts. lisp/simple.el (default-font-height): Don't call font-info if the frame's default font didn't change since the frame was created. --- lisp/ChangeLog | 6 ++++++ lisp/simple.el | 13 +++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 533ea0a0f23..4bfc800913a 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2013-07-13 Eli Zaretskii + + * simple.el (default-font-height): Don't call font-info if the + frame's default font didn't change since the frame was created. + (Bug#14838) + 2013-07-13 Leo Liu * ido.el (ido-read-file-name): Guard against non-symbol value. diff --git a/lisp/simple.el b/lisp/simple.el index 9158452fd64..3e3ff485c5e 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -4739,10 +4739,15 @@ lines." (defun default-font-height () "Return the height in pixels of the current buffer's default face font." - (cond - ((display-multi-font-p) - (aref (font-info (face-font 'default)) 3)) - (t (frame-char-height)))) + (let ((default-font (face-font 'default))) + (cond + ((and (display-multi-font-p) + ;; Avoid calling font-info if the frame's default font was + ;; not changed since the frame was created. That's because + ;; font-info is expensive for some fonts, see bug #14838. + (not (string= (frame-parameter nil 'font) default-font))) + (aref (font-info default-font) 3)) + (t (frame-char-height))))) (defun default-line-height () "Return the pixel height of current buffer's default-face text line. -- 2.39.2