changeset 89428:eed327e0bad3

(BASE_FONTSET_P): Check FONTSET_BASE, not FONTSET_NAME. (fontset_add): Fix for the case that TO is less than TO1. (Ffontset_info): Don't use fallback fontset on checking the default fontset. (dump_fontset): New function for debugging.
author Kenichi Handa <handa@m17n.org>
date Tue, 20 May 2003 13:04:49 +0000
parents e25f0fe176b0
children 3c978149859b
files src/fontset.c
diffstat 1 files changed, 30 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/fontset.c	Thu May 08 17:58:17 2003 +0000
+++ b/src/fontset.c	Tue May 20 13:04:49 2003 +0000
@@ -269,8 +269,6 @@
 #define FONTSET_NAME(fontset)		XCHAR_TABLE (fontset)->extras[1]
 #define FONTSET_ASCII(fontset)		XCHAR_TABLE (fontset)->extras[4]
 
-#define BASE_FONTSET_P(fontset)		STRINGP (FONTSET_NAME (fontset))
-
 /* Macros to access special values of (realized) FONTSET.  */
 #define FONTSET_BASE(fontset)		XCHAR_TABLE (fontset)->extras[2]
 #define FONTSET_FRAME(fontset)		XCHAR_TABLE (fontset)->extras[3]
@@ -278,6 +276,8 @@
 #define FONTSET_REPERTORY(fontset)	XCHAR_TABLE (fontset)->extras[6]
 #define FONTSET_FALLBACK(fontset)	XCHAR_TABLE (fontset)->extras[7]
 
+#define BASE_FONTSET_P(fontset)		(NILP (FONTSET_BASE (fontset)))
+
 
 /* Return the element of FONTSET for the character C.  If FONTSET is a
    base fontset other then the default fontset and FONTSET doesn't
@@ -372,6 +372,8 @@
   to = XINT (XCDR (range));
   do {
     elt1 = char_table_ref_and_range (fontset, from, &from1, &to1);
+    if (to < to1)
+      to1 = to;
     if (NILP (elt1))
       elt1 = Fmake_vector (make_number (1), elt);
     else
@@ -386,7 +388,7 @@
 	  ASET (new, i0, AREF (elt1, i));
 	elt1 = new;
       }
-    char_table_set_range (fontset, from, to1, elt1);    
+    char_table_set_range (fontset, from, to1, elt1);
     from = to1 + 1;
   } while (from < to);
   return Qnil;
@@ -620,7 +622,6 @@
   if (! EQ (base_fontset, Vdefault_fontset))
     return fontset_face (FONTSET_FALLBACK (fontset), c, face);
 
- font_not_found:
   /* We have tried all the fonts for C, but none of them can be opened
      nor can display C.  */
   if (NILP (FONTSET_NOFONT_FACE (fontset)))
@@ -1608,8 +1609,10 @@
 	{
 	  this_fontset = Vdefault_fontset;
 	  this_table = XCHAR_TABLE (table)->extras[0];
+#if 0
 	  for (i = 0; i < n_realized; i++)
 	    realized[i] = FONTSET_FALLBACK (realized[i]);
+#endif
 	}
       for (c = 0; c <= MAX_5_BYTE_CHAR; )
 	{
@@ -1814,3 +1817,26 @@
   defsubr (&Sfontset_font);
   defsubr (&Sfontset_list);
 }
+
+Lisp_Object
+dump_fontset (fontset)
+     Lisp_Object fontset;
+{
+  Lisp_Object val;
+  
+  if (NILP (FONTSET_FALLBACK (fontset)))
+    val = Fcons (Fcons (intern ("fallback-id"), Qnil), Qnil);
+  else
+    val = Fcons (Fcons (intern ("fallback-id"),
+			FONTSET_ID (FONTSET_FALLBACK (fontset))),
+		 Qnil);
+  if (NILP (FONTSET_BASE (fontset)))
+    val = Fcons (Fcons (intern ("base"), Qnil), val);
+  else
+    val = Fcons (Fcons (intern ("base"),
+			FONTSET_NAME (FONTSET_BASE (fontset))),
+		 val);
+  val = Fcons (Fcons (intern ("name"), FONTSET_NAME (fontset)), val);
+  val = Fcons (Fcons (intern ("id"), FONTSET_ID (fontset)), val);
+  return val;
+}