mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-11-28 07:45:00 +00:00
Don't attempt to cache glyph metrics for FONT_INVALID_CODE
This was causing massive slowdown in redisplay when eg #xfe0f (VARIATION SELECTOR-16) was present, as the cache ended up very large, unused, and being recreated on every call to font_fill_lglyph_metrics (Bug#39133). * src/composite.c (fill_gstring_body): Hoist FONT_OBJECT_P check out of loop. Calculate glyph code and check for FONT_INVALID_CODE before calling font_fill_lglyph_metrics. Pass glyph code to it. * src/font.c (font_fill_lglyph_metrics): Add code parameter, move glyph code calculation up the call stack into fill_gstring_body. * src/font.h: Adjust font_fill_lglyph_metrics prototype.
This commit is contained in:
parent
b42b894d1d
commit
fe1a447d52
@ -818,6 +818,11 @@ 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 = NULL;
|
||||
unsigned int code;
|
||||
|
||||
if (FONT_OBJECT_P (font_object))
|
||||
font = XFONT_OBJECT (font_object);
|
||||
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
@ -832,10 +837,15 @@ 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))
|
||||
{
|
||||
font_fill_lglyph_metrics (g, font_object);
|
||||
}
|
||||
|
||||
if (font != NULL)
|
||||
code = font->driver->encode_char (font, LGLYPH_CHAR (g));
|
||||
else
|
||||
code = FONT_INVALID_CODE;
|
||||
if (code != FONT_INVALID_CODE)
|
||||
{
|
||||
font_fill_lglyph_metrics (g, font, code);
|
||||
}
|
||||
else
|
||||
{
|
||||
int width = XFIXNAT (CHAR_TABLE_REF (Vchar_width_table, c));
|
||||
|
@ -4416,10 +4416,8 @@ 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, struct font *font, 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);
|
||||
|
@ -886,7 +886,7 @@ extern Lisp_Object font_update_drivers (struct frame *f, Lisp_Object list);
|
||||
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, struct font *, unsigned int);
|
||||
|
||||
extern Lisp_Object font_put_extra (Lisp_Object font, Lisp_Object prop,
|
||||
Lisp_Object val);
|
||||
|
Loading…
Reference in New Issue
Block a user