changeset 17177:9e550b522bc0

(x-charset-registries): Change entry for Ethiopic. Typo in comments fixed. (fontset-plain-name): Set correct size information. (x-reduce-font-name): New function. (x-compose-font-name): New optional argument REDUCE. (x-complement-fontset-spec): Call x-compose-font-name with t for the above argument.
author Kenichi Handa <handa@m17n.org>
date Tue, 18 Mar 1997 23:16:27 +0000
parents 12e0db4fd511
children 4173a7215c5b
files lisp/international/fontset.el
diffstat 1 files changed, 20 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/international/fontset.el	Tue Mar 18 23:16:27 1997 +0000
+++ b/lisp/international/fontset.el	Tue Mar 18 23:16:27 1997 +0000
@@ -68,7 +68,7 @@
     (arabic-1-column . "MuleArabic-1")
     (arabic-2-column . "MuleArabic-2")
     (ipa . "MuleIPA")
-    (ethiopic . "Ethio")
+    (ethiopic . "Ethiopic-Unicode")
     (ascii-right-to-left . "ISO8859-1")
     (indian-is13194 . "IS13194-Devanagari")
     (indian-2-column . "MuleIndian-2")
@@ -195,11 +195,24 @@
 		  (setq l (cdr (cdr l))))))
 	    xlfd-fields)))))
 
-(defsubst x-compose-font-name (xlfd-fields)
+;; Replace consecutive wild-cards (`*') in NAME to one.
+;; Ex. (x-reduce-font-name "-*-*-*-iso8859-1") => "-*-iso8859-1"
+(defsubst x-reduce-font-name (name)
+  (while (string-match "-\\*-\\(\\*-\\)+" name)
+    (setq name (replace-match "-*-" t t name)))
+  name)
+
+(defun x-compose-font-name (xlfd-fields &optional reduce)
   "Compose X's fontname from FIELDS.
 FIELDS is a vector of XLFD fields.
-If a field is nil, wild-card character `*' is embedded."
-  (concat "-" (mapconcat (lambda (x) (or x "*")) xlfd-fields "-")))
+If a field is nil, wild-card letter `*' is embedded.
+Optional argument REDUCE non-nil means consecutive wild-cards are
+reduced to be one."
+  (let ((name
+	 (concat "-" (mapconcat (lambda (x) (or x "*")) xlfd-fields "-"))))
+    (if reduce
+	(x-reduce-font-name name)
+      name)))
 
 (defun x-complement-fontset-spec (xlfd-fields fontlist)
   "Complement FONTLIST for all charsets based on XLFD-FIELDS and return it.
@@ -226,7 +239,7 @@
 		      (concat registry "*"))
 		(aset xlfd-fields xlfd-regexp-encoding-subnum "*"))
 	      (setq fontlist
-		    (cons (cons charset (x-compose-font-name xlfd-fields))
+		    (cons (cons charset (x-compose-font-name xlfd-fields t))
 			  fontlist)))))
       (setq charsets (cdr charsets))))
   fontlist)
@@ -255,8 +268,8 @@
 	      (swidth (aref xlfd-fields xlfd-regexp-swidth-subnum))
 	      (size   (aref xlfd-fields xlfd-regexp-pixelsize-subnum))
 	      name)
-	  (if (integerp size)
-	      (setq name (format "%d " size))
+	  (if (> (string-to-int size) 0)
+	      (setq name (format "%s " size))
 	    (setq name ""))
 	  (if (string-match "bold\\|demibold" weight)
 	      (setq name (concat name weight " ")))