]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix bug #14838 with slow scrolling with certain fonts.
authorEli Zaretskii <eliz@gnu.org>
Sat, 13 Jul 2013 07:26:43 +0000 (10:26 +0300)
committerEli Zaretskii <eliz@gnu.org>
Sat, 13 Jul 2013 07:26:43 +0000 (10:26 +0300)
 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
lisp/simple.el

index 533ea0a0f23f5692deb5bd6507a03a583325132a..4bfc800913a1f808bf7df0138878012c2580029a 100644 (file)
@@ -1,3 +1,9 @@
+2013-07-13  Eli Zaretskii  <eliz@gnu.org>
+
+       * 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  <sdl.web@gmail.com>
 
        * ido.el (ido-read-file-name): Guard against non-symbol value.
index 9158452fd64aff42c89229ba03ea4703dc41d934..3e3ff485c5e7bcfee775530cdcb20e59c5c99029 100644 (file)
@@ -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.