changeset 89614:355fc0282e50

(set_fontset_font): New function. (Fset_fontset_font): If a font is specified for a charset, use map_charset_chars to store the font spec in a fontset.
author Kenichi Handa <handa@m17n.org>
date Sat, 08 Nov 2003 00:54:53 +0000
parents e5a90f5870f7
children 88fa74816908
files src/fontset.c
diffstat 1 files changed, 25 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/fontset.c	Mon Nov 03 22:24:31 2003 +0000
+++ b/src/fontset.c	Sat Nov 08 00:54:53 2003 +0000
@@ -244,6 +244,8 @@
 					  Lisp_Object));
 static Lisp_Object find_font_encoding P_ ((char *));
 
+static void set_fontset_font P_ ((Lisp_Object, Lisp_Object));
+
 #ifdef FONTSET_DEBUG
 
 /* Return 1 if ID is a valid fontset id, else return 0.  */
@@ -1191,6 +1193,19 @@
   return build_font_name_from_vector (vec);
 }
 
+static void
+set_fontset_font (range, arg)
+     Lisp_Object range, arg;
+{
+  Lisp_Object fontset, font_def, add;
+
+  fontset = XCAR (arg);
+  font_def = XCAR (XCDR (arg));
+  add = XCAR (XCDR (XCDR (arg)));
+  FONTSET_ADD (fontset, range, font_def, add);
+  free_realized_fontsets (fontset);
+}
+
 
 DEFUN ("set-fontset-font", Fset_fontset_font, Sset_fontset_font, 3, 5, 0,
        doc: /*
@@ -1338,17 +1353,22 @@
 	  struct charset *charset;
 
 	  CHECK_CHARSET_GET_CHARSET (character, charset);
-	  if (CHARSET_METHOD (charset) == CHARSET_METHOD_OFFSET)
-	    range_list
-	      = Fcons (Fcons (make_number (CHARSET_MIN_CHAR (charset)),
-			      make_number (CHARSET_MAX_CHAR (charset))),
-		       range_list);
 	  if (EQ (character, Qascii))
 	    {
 	      if (VECTORP (font_spec))
 		font_spec = generate_ascii_font_name (FONTSET_NAME (fontset),
 						      font_spec);
 	      FONTSET_ASCII (fontset) = font_spec;
+	      range_list = Fcons (Fcons (make_number (0), make_number (127)),
+				  Qnil);
+	    }
+	  else
+	    {
+	      map_charset_chars (set_fontset_font, Qnil,
+				 list3 (fontset, font_def, add), charset,
+				 CHARSET_MIN_CODE (charset),
+				 CHARSET_MAX_CODE (charset));
+	      return Qnil;
 	    }
 	}