changeset 90821:5346cefbb15b

(reorder_font_vector): Check contents of font_def. (fontset_find_font): Fix previous change.
author Kenichi Handa <handa@m17n.org>
date Wed, 25 Apr 2007 13:11:57 +0000
parents 933d1187678d
children 18bdc5849a88
files src/fontset.c
diffstat 1 files changed, 9 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/fontset.c	Wed Apr 25 12:07:30 2007 +0000
+++ b/src/fontset.c	Wed Apr 25 13:11:57 2007 +0000
@@ -465,7 +465,8 @@
   for (i = 0; i < size; i++)
     {
       font_def = AREF (fontset_element, i + 3);
-      if (! NILP (AREF (font_def, 2)))
+      if (VECTORP (AREF (font_def, 2))
+	  && INTEGERP (AREF (AREF (font_def, 2), 1)))
 	charset_id_table[i] = XINT (AREF (AREF (font_def, 2), 1));
       else
 	charset_id_table[i] = -1;
@@ -547,7 +548,7 @@
      struct face *face;
      int id, fallback;
 {
-  Lisp_Object base_fontset, elt, vec;
+  Lisp_Object base_fontset, elt, vec, font_def;
   int i, from, to;
   int font_idx;
   FRAME_PTR f = XFRAME (FONTSET_FRAME (fontset));
@@ -604,7 +605,7 @@
 	      && enable_font_backend
 	      && EQ (base_fontset, Vdefault_fontset))
 	    {
-	      Lisp_Object script, font_spec, tmp;
+	      Lisp_Object script, font_spec;
 
 	      script = CHAR_TABLE_REF (Vchar_script_table, c);
 	      if (NILP (script))
@@ -613,9 +614,11 @@
 	      ASET (font_spec, FONT_REGISTRY_INDEX, Qiso10646_1);
 	      ASET (font_spec, FONT_EXTRA_INDEX,
 		    Fcons (Fcons (QCscript, script), Qnil));
-	      tmp = Fmake_vector (make_number (5), Qnil);
-	      ASET (tmp, 3, font_spec);
-	      ASET (vec, 3 + i, tmp);
+	      font_def = Fmake_vector (make_number (3), Qnil);
+	      ASET (font_def, 0, font_spec);
+	      elt = Fmake_vector (make_number (5), Qnil);
+	      ASET (elt, 2, font_def);
+	      ASET (vec, 3 + i, elt);
 	    }
 #endif	/* USE_FONT_BACKEND */
 
@@ -659,8 +662,6 @@
   /* Find the first available font in the vector of RFONT-DEF.  */
   for (; i < ASIZE (vec); i++)
     {
-      Lisp_Object font_def;
-
       elt = AREF (vec, i);
       if (NILP (elt))
 	continue;