diff lisp/faces.el @ 3659:98af8a976fc3

[xemacs-hg @ 2006-11-05 22:31:31 by aidan] Support specifying fonts for particular character sets in Mule; support translation to ISO 10646-1 for Mule character sets without an otherwise matching font; move to a vector of X11-charset-X11-registry instead of a regex for the charset-registry property.
author aidan
date Sun, 05 Nov 2006 22:31:46 +0000
parents 316fddbf58e2
children 049dc907c17a
line wrap: on
line diff
--- a/lisp/faces.el	Sat Nov 04 22:51:03 2006 +0000
+++ b/lisp/faces.el	Sun Nov 05 22:31:46 2006 +0000
@@ -250,19 +250,9 @@
 
   (setq face (get-face face))
   (let ((value (get face property)))
-    (if (specifierp value)
-	(setq value (if (or (charsetp matchspec)
-			    (and (symbolp matchspec)
-				 (find-charset matchspec)))
-			(or
-			 (specifier-matching-instance
-			  value (cons matchspec nil) domain default
-			  no-fallback)
-			 (specifier-matching-instance
-			  value (cons matchspec t) domain default
-			  no-fallback))
-		      (specifier-matching-instance value matchspec domain
-						   default no-fallback))))
+    (when (specifierp value)
+      (setq value (specifier-matching-instance value matchspec domain
+					       default no-fallback)))
     value))
 
 (defun set-face-property (face property value &optional locale tag-set
@@ -473,25 +463,40 @@
   and an instance object describing how the font appears in that
   particular window and buffer will be returned.
 
+CHARSET is a Mule charset (meaning return the font used for that charset) or
+nil (meaning return the font used for ASCII.)
+
 See `face-property-instance' for more information."
-  (if charset
-      (face-property-matching-instance face 'font charset domain)
-    (face-property-instance face 'font domain)))
+  (if (null charset)
+      (face-property-instance face 'font domain)
+    (let (matchspec)
+      ;; get-charset signals an error if its argument doesn't have an
+      ;; associated charset.
+      (setq charset (get-charset charset)
+	    matchspec (cons charset nil))
+      (or (null (setcdr matchspec 'initial))
+	  (face-property-matching-instance 
+	   face 'font matchspec domain)
+	  (null (setcdr matchspec 'final))
+	  (face-property-matching-instance
+	   face 'font matchspec domain)))))
 
 (defun set-face-font (face font &optional locale tag-set how-to-add)
   "Change the font of FACE to FONT in LOCALE.
 
 FACE may be either a face object or a symbol representing a face.
 
-FONT should be an instantiator (see `make-font-specifier'), a list of
-  instantiators, an alist of specifications (each mapping a
-  locale to an instantiator list), or a font specifier object.
+FONT should be an instantiator (see `make-font-specifier'; a common
+  instantiator is a platform-dependent string naming the font), a list
+  of instantiators, an alist of specifications (each mapping a locale
+  to an instantiator list), or a font specifier object.
 
-If FONT is an alist, LOCALE must be omitted.  If FONT is a
-  specifier object, LOCALE can be a locale, a locale type, `all',
-  or nil; see `copy-specifier' for its semantics.  Otherwise LOCALE
-  specifies the locale under which the specified instantiator(s)
-  will be added, and defaults to `global'.
+If FONT is an alist, LOCALE must be omitted.  If FONT is a specifier
+  object, LOCALE can be a locale, a locale type, `all', or nil; see
+  `copy-specifier' for its semantics.  Common LOCALEs are buffer
+  objects, window objects, device objects and `global'.  Otherwise
+  LOCALE specifies the locale under which the specified
+  instantiator(s) will be added, and defaults to `global'.
 
 See `set-face-property' for more information."
   (interactive (face-interactive "font"))