changeset 29233:a09ee5c15dcb

(check_registry_encoding): This function deleted. (Fset_fontset_font): Remove the adhoc condition for the default fontset. Allow cons in FONTNAME.
author Kenichi Handa <handa@m17n.org>
date Fri, 26 May 2000 07:27:30 +0000
parents c0d6abd0b71b
children c9a5f356fe77
files src/fontset.c
diffstat 1 files changed, 16 insertions(+), 31 deletions(-) [+]
line wrap: on
line diff
--- a/src/fontset.c	Fri May 26 07:26:53 2000 +0000
+++ b/src/fontset.c	Fri May 26 07:27:30 2000 +0000
@@ -946,26 +946,6 @@
 }
 
 
-/* Return 1 iff REGISTRY is a valid string as the font registry and
-   encoding.  It is valid if it doesn't start with `-' and the number
-   of `-' in the string is at most 1.  */
-
-static int
-check_registry_encoding (registry)
-     Lisp_Object registry;
-{
-  unsigned char *str = XSTRING (registry)->data;
-  unsigned char *p = str;
-  int i;
-
-  if (!*p || *p++ == '-')
-    return 0;
-  for (i = 0; *p; p++)
-    if (*p == '-') i++;
-  return (i < 2);
-}
-
-
 /* 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.  */
@@ -993,9 +973,8 @@
 non-generic characters.  In that case, use FONTNAME\n\
 for all characters in the range FROM and TO (inclusive).\n\
 \n\
-If NAME is t, an entry in the default fontset is modified.\n\
-In that case, FONTNAME should be a registry and encoding name\n\
-of a font for CHARACTER.")
+FONTNAME may be a cons; (FAMILY . REGISTRY), where FAMILY is a family\n\
+name of a font, REGSITRY is a registry name of a font.")
   (name, character, fontname, frame)
      Lisp_Object name, character, fontname, frame;
 {
@@ -1003,6 +982,7 @@
   Lisp_Object realized;
   int from, to;
   int id;
+  Lisp_Object family, registry;
 
   fontset = check_fontset_name (name);
 
@@ -1038,17 +1018,22 @@
 	error ("Can't change font for a single byte character");
     }
 
-  CHECK_STRING (fontname, 2);
-  fontname = Fdowncase (fontname);
-  if (EQ (fontset, Vdefault_fontset))
+  if (STRINGP (fontname))
     {
-      if (!check_registry_encoding (fontname))
-	error ("Invalid registry and encoding name: %s",
-	       XSTRING (fontname)->data);
-      elt = Fcons (make_number (from), Fcons (Qnil, fontname));
+      fontname = Fdowncase (fontname);
+      elt = Fcons (make_number (from), font_family_registry (fontname));
     }
   else
-    elt = Fcons (make_number (from), font_family_registry (fontname));
+    {
+      CHECK_CONS (fontname, 2);
+      family = XCAR (fontname);
+      registry = XCDR (fontname);
+      if (!NILP (family))
+	CHECK_STRING (family, 2);
+      if (!NILP (registry))
+	CHECK_STRING (registry, 2);
+      elt = Fcons (make_number (from), Fcons (family, registry));
+    }
 
   /* The arg FRAME is kept for backward compatibility.  We only check
      the validity.  */