From 2570e34465cefacf043cbd323cbd0603cd938636 Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Tue, 7 Jan 2003 01:26:33 +0000 Subject: [PATCH] (x_new_font): Optimize for the case that the font is already set for the frame. --- src/xterm.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/xterm.c b/src/xterm.c index 986d48353bd..893a09db885 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -12258,6 +12258,11 @@ x_new_font (f, fontname) if (!fontp) return Qnil; + if (f->output_data.x->font == (XFontStruct *) (fontp->font)) + /* This font is already set in frame F. There's nothing more to + do. */ + return build_string (fontp->full_name); + f->output_data.x->font = (XFontStruct *) (fontp->font); f->output_data.x->baseline_offset = fontp->baseline_offset; f->output_data.x->fontset = -1; @@ -12302,13 +12307,16 @@ x_new_font (f, fontname) return build_string (fontp->full_name); } -/* Give frame F the fontset named FONTSETNAME as its default font, and - return the full name of that fontset. FONTSETNAME may be a wildcard - pattern; in that case, we choose some fontset that fits the pattern. +/* Give frame F the fontset named FONTSETNAME as its default fontset, + and return the full name of that fontset. FONTSETNAME may be a + wildcard pattern; in that case, we choose some fontset that fits + the pattern. FONTSETNAME may be a font name for ASCII characters; + in that case, we create a fontset from that font name. + The return value shows which fontset we chose. If FONTSETNAME specifies the default fontset, return Qt. - If an ASCII font specified in the specified fontset can't be - loaded, return Qnil. */ + If an ASCII font in the specified fontset can't be loaded, return + Qnil. */ Lisp_Object x_new_fontset (f, fontsetname) -- 2.39.5