changeset 89336:4f46c53eb254

(x_new_font): Optimize for the case that the font is already set for the frame.
author Kenichi Handa <handa@m17n.org>
date Tue, 07 Jan 2003 01:26:33 +0000
parents 6a5480f8b2f9
children 6026c8e5664f
files src/xterm.c
diffstat 1 files changed, 13 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/xterm.c	Tue Jan 07 01:26:08 2003 +0000
+++ b/src/xterm.c	Tue Jan 07 01:26:33 2003 +0000
@@ -12258,6 +12258,11 @@
   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 @@
   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)