diff src/fontset.c @ 49874:3bdee1887901

(check_fontset_name): If NAME is nil, return the default fontset. (override_font_info): New function. (Ffontset_info): If FONTSET is not the default fontset, merge FONTSET onto the copy of the default fontset, and work on that copy.
author Kenichi Handa <handa@m17n.org>
date Thu, 20 Feb 2003 08:40:35 +0000
parents fc85fba774da
children 95289e554702
line wrap: on
line diff
--- a/src/fontset.c	Thu Feb 20 01:54:27 2003 +0000
+++ b/src/fontset.c	Thu Feb 20 08:40:35 2003 +0000
@@ -955,7 +955,7 @@
 
 /* Check validity of NAME as a fontset name and return the
    corresponding fontset.  If not valid, signal an error.
-   If NAME is t, return Vdefault_fontset.  */
+   If NAME is nil, return Vdefault_fontset.  */
 
 static Lisp_Object
 check_fontset_name (name)
@@ -963,7 +963,7 @@
 {
   int id;
 
-  if (EQ (name, Qt))
+  if (EQ (name, Qnil))
     return Vdefault_fontset;
 
   CHECK_STRING (name);
@@ -1190,12 +1190,25 @@
 
 
 /* Called from Ffontset_info via map_char_table on each leaf of
+   fontset.  ARG is a copy of the default fontset.  The current leaf
+   is indexed by CHARACTER and has value ELT.  This function override
+   the copy by ELT if ELT is not nil.  */
+
+static void
+override_font_info (fontset, character, elt)
+     Lisp_Object fontset, character, elt;
+{
+  if (! NILP (elt))
+    Faset (fontset, character, elt);
+}
+
+/* Called from Ffontset_info via map_char_table on each leaf of
    fontset.  ARG is a list (LAST FONT-INFO ...), where LAST is `(last
    ARG)' and FONT-INFOs have this form:
 	(CHAR FONT-SPEC) or ((FROM . TO) FONT-SPEC)
    The current leaf is indexed by CHARACTER and has value ELT.  This
    function add the information of the current leaf to ARG by
-   appending a new element or modifying the last element..  */
+   appending a new element or modifying the last element.  */
 
 static void
 accumulate_font_info (arg, character, elt)
@@ -1286,6 +1299,14 @@
 	realized[n_realized++] = elt;
     }
 
+  if (! EQ (fontset, Vdefault_fontset))
+    {
+      /* Merge FONTSET onto the default fontset.  */
+      val = Fcopy_sequence (Vdefault_fontset);
+      map_char_table (override_font_info, Qnil, fontset, val, 0, indices);
+      fontset = val;
+    }
+
   /* Accumulate information of the fontset in VAL.  The format is
      (LAST FONT-INFO FONT-INFO ...), where FONT-INFO is (CHAR-OR-RANGE
      FONT-SPEC).  See the comment for accumulate_font_info for the