changeset 103097:129ed78cd442

(x_set_font): When ARG is a font-object, check if the font-object matches with the ASCII font-spec of the frame's fontset. If not, create a new fontset for the frame.
author Kenichi Handa <handa@m17n.org>
date Wed, 29 Apr 2009 01:40:57 +0000
parents d98eb168e700
children 8df81ecfbeb8
files src/frame.c
diffstat 1 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/frame.c	Tue Apr 28 21:29:47 2009 +0000
+++ b/src/frame.c	Wed Apr 29 01:40:57 2009 +0000
@@ -3418,6 +3418,16 @@
 	 itself in the future.  */
       arg = AREF (font_object, FONT_NAME_INDEX);
       fontset = FRAME_FONTSET (f);
+      /* Check if we can use the current fontset.  If not, set FONTSET
+	 to -1 to generate a new fontset from FONT-OBJECT.  */
+      if (fontset >= 0)
+	{
+	  Lisp_Object ascii_font = fontset_ascii (fontset);
+	  Lisp_Object spec = font_spec_from_name (ascii_font);
+
+	  if (! font_match_p (spec, font_object))
+	    fontset = -1;
+	}
     }
   else
     signal_error ("Invalid font", arg);