From: Eli Zaretskii Date: Sat, 13 Jul 2013 07:26:43 +0000 (+0300) Subject: Fix bug #14838 with slow scrolling with certain fonts. X-Git-Tag: emacs-24.3.90~173^2^2~42^2~45^2~387^2~1803 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=1a67b811cbad70fec1d0eaf7a9e3c66784fe6556;p=emacs.git 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. --- 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.