bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#39133: 28.0.50; Emacs slowdown on special char


From: Robert Pluim
Subject: bug#39133: 28.0.50; Emacs slowdown on special char
Date: Fri, 24 Jan 2020 11:13:54 +0100

>>>>> On Wed, 15 Jan 2020 18:19:28 +0200, Eli Zaretskii <address@hidden> said:
    Eli> We could do in the 'else' branch the same we do in the single caller
    Eli> of this function, fill_gstring_body, when we don't call
    Eli> font_fill_lglyph_metrics:

Rather than duplicate that code, I moved the FONT_INVALID_CODE check
up. This works for me:

diff --git a/src/composite.c b/src/composite.c
index 53e6930b5f..bf5884fa55 100644
--- a/src/composite.c
+++ b/src/composite.c
@@ -818,6 +818,7 @@ fill_gstring_body (Lisp_Object gstring)
   Lisp_Object header = AREF (gstring, 0);
   ptrdiff_t len = LGSTRING_CHAR_LEN (gstring);
   ptrdiff_t i;
+  struct font *font = XFONT_OBJECT (font_object);
 
   for (i = 0; i < len; i++)
     {
@@ -832,9 +833,12 @@ fill_gstring_body (Lisp_Object gstring)
       LGLYPH_SET_FROM (g, i);
       LGLYPH_SET_TO (g, i);
       LGLYPH_SET_CHAR (g, c);
-      if (FONT_OBJECT_P (font_object))
+
+      unsigned int code = font->driver->encode_char (font, LGLYPH_CHAR (g));
+
+      if (FONT_OBJECT_P (font_object) && code != FONT_INVALID_CODE)
        {
-         font_fill_lglyph_metrics (g, font_object);
+         font_fill_lglyph_metrics (g, font_object, code);
        }
       else
        {
diff --git a/src/font.c b/src/font.c
index bb39aef92d..03d9cc50ae 100644
--- a/src/font.c
+++ b/src/font.c
@@ -4416,10 +4416,9 @@ DEFUN ("clear-font-cache", Fclear_font_cache, 
Sclear_font_cache, 0, 0, 0,
 
 
 void
-font_fill_lglyph_metrics (Lisp_Object glyph, Lisp_Object font_object)
+font_fill_lglyph_metrics (Lisp_Object glyph, Lisp_Object font_object, unsigned 
int code)
 {
   struct font *font = XFONT_OBJECT (font_object);
-  unsigned code = font->driver->encode_char (font, LGLYPH_CHAR (glyph));
   struct font_metrics metrics;
 
   LGLYPH_SET_CODE (glyph, code);
diff --git a/src/font.h b/src/font.h
index 0561e3c83f..d82039eed8 100644
--- a/src/font.h
+++ b/src/font.h
@@ -886,7 +886,7 @@ valid_font_driver (struct font_driver const *d)
 extern Lisp_Object font_range (ptrdiff_t, ptrdiff_t, ptrdiff_t *,
                               struct window *, struct face *,
                               Lisp_Object);
-extern void font_fill_lglyph_metrics (Lisp_Object, Lisp_Object);
+extern void font_fill_lglyph_metrics (Lisp_Object, Lisp_Object, unsigned int);
 
 extern Lisp_Object font_put_extra (Lisp_Object font, Lisp_Object prop,
                                    Lisp_Object val);





reply via email to

[Prev in Thread] Current Thread [Next in Thread]