aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenichi Handa2002-07-26 04:03:01 +0000
committerKenichi Handa2002-07-26 04:03:01 +0000
commit37a94e2f80306481c35bfa0b97bfbe202757b0dd (patch)
treeace04f34b2207ef9c661804831fb9551de6ee724
parent9ce5de1c3e665204ee16d7830352787310390b8f (diff)
downloademacs-37a94e2f80306481c35bfa0b97bfbe202757b0dd.tar.gz
emacs-37a94e2f80306481c35bfa0b97bfbe202757b0dd.zip
Setup the default fontset by the new
script based way. (x-complement-fontset-spec): Change the format of arg FONTLIST to an alist of charsets vs font name lists. (charset-script-alist): New variable. (create-fontset-from-fontset-spec): Allow script name in FONTSET-SPEC. If charset is specified in FONTSET-SPEC, change it to the corresponding script name. (create-fontset-from-ascii-font): Slightly tuned.
-rw-r--r--lisp/international/fontset.el386
1 files changed, 237 insertions, 149 deletions
diff --git a/lisp/international/fontset.el b/lisp/international/fontset.el
index 50d1811227c..c2ca80a1d4e 100644
--- a/lisp/international/fontset.el
+++ b/lisp/international/fontset.el
@@ -27,145 +27,177 @@
27 27
28;;; Code: 28;;; Code:
29 29
30;; Setup font-encoding-alist for all known encodings.
31
32(setq font-encoding-alist
33 '(("iso8859-1$" . iso-8859-1)
34 ("iso8859-2$" . iso-8859-2)
35 ("iso8859-3$" . iso-8859-3)
36 ("iso8859-4$" . iso-8859-4)
37 ("iso8859-5$" . iso-8859-5)
38 ("iso8859-6$" . iso-8859-6)
39 ("iso8859-7$" . iso-8859-7)
40 ("iso8859-8$" . iso-8859-8)
41 ("iso8859-9$" . iso-8859-9)
42 ("iso8859-10$" . iso-8859-10)
43 ("iso8859-11$" . iso-8859-11)
44 ("iso8859-13$" . iso-8859-13)
45 ("iso8859-14$" . iso-8859-14)
46 ("iso8859-15$" . iso-8859-15)
47 ("gb2312.1980" . chinese-gb2312)
48 ("jisx0208.1978" . japanese-jisx0208-1978)
49 ("jisx0208" . japanese-jisx0208)
50 ("jisx0201" . jisx0201)
51 ("jisx0212" . japanese-jisx0212)
52 ("ksc5601.1987" . korean-ksc5601)
53 ("cns11643.1992.*1" . chinese-cns11643-1)
54 ("cns11643.1992.*2" . chinese-cns11643-2)
55 ("cns11643.1992.*3" . chinese-cns11643-3)
56 ("cns11643.1992.*4" . chinese-cns11643-4)
57 ("cns11643.1992.*5" . chinese-cns11643-5)
58 ("cns11643.1992.*6" . chinese-cns11643-6)
59 ("cns11643.1992.*7" . chinese-cns11643-7)
60 ("big5" . big5)
61 ("sisheng_cwnn" . chinese-sisheng)
62 ("viscii" . viscii)
63 ("tis620" . tis620-2533)
64 ("mulearabic-0" . arabic-digit)
65 ("mulearabic-1" . arabic-1-column)
66 ("mulearabic-2" . arabic-2-column)
67 ("muleipa" . ipa)
68 ("ethiopic-unicode" . ethiopic)
69 ("is13194-devanagari" . indian-is13194)
70 ("devanagari-cdac" . devanagari-glyph)
71 ("muleindian-2" . indian-2-column)
72 ("muleindian-1" . indian-1-column)
73 ("mulelao-1" . mule-lao)
74 ("muletibetan-2" . tibetan)
75 ("muletibetan-1" . tibetan-1-column)
76 ("jisx0213.2000-1" . japanese-jisx0213-1)
77 ("jisx0213.2000-2" . japanese-jisx0213-2)
78 ("abobe-symbol" . symbol)
79 ("iso10646-1" . (unicode . nil))
80 ("iso10646.indian-1" . (unicode . nil))))
81
82
30;; Set standard fontname specification of characters in the default 83;; Set standard fontname specification of characters in the default
31;; fontset to find an appropriate font for each charset. This is used 84;; fontset to find an appropriate font for each script/charset. The
32;; to generate a font name for a fontset if the fontset doesn't 85;; specification has the form ((SCRIPT FONT-SPEC ...) ...), where
33;; specify a font name for a specific character. The specification 86;; FONT-SPEC is:
34;; has the form (FAMILY . REGISTRY). FAMILY may be nil, in which 87;; a vector [ FAMILY WEIGHT SLANT ADSTYLE REGISTRY ],
35;; case, the family name of default face is used. If REGISTRY 88;; or a cons (FAMILY . REGISTRY),
89;; or a string FONT-NAME.
90;;
91;; FAMILY, WEIGHT, SLANT, and ADSTYLE may be nil, in which case, the
92;; the corresponding name of default face is used. If REGISTRY
36;; contains a character `-', the string before that is embedded in 93;; contains a character `-', the string before that is embedded in
37;; `CHARSET_REGISTRY' field, and the string after that is embedded in 94;; `CHARSET_REGISTRY' field, and the string after that is embedded in
38;; `CHARSET_ENCODING' field. If it does not contain `-', the whole 95;; `CHARSET_ENCODING' field. If it does not contain `-', the whole
39;; string is embedded in `CHARSET_REGISTRY' field, and a wild card 96;; string is embedded in `CHARSET_REGISTRY' field, and a wild card
40;; character `*' is embedded in `CHARSET_ENCODING' field. The 97;; character `*' is embedded in `CHARSET_ENCODING' field.
41;; REGISTRY for ASCII characters are predefined as "ISO8859-1". 98;;
42 99;; SCRIPT is a symbol that appears as an element of the char table
43(let ((l 100;; `char-script-table'. SCRIPT may be a charset specifying the range
44 ;; Eval this at compile-time, since fontset.el is always loaded 101;; of characters.
45 ;; when run under X and this would always load ind-util.el as well. 102
46 (eval-when-compile 103(new-fontset
47 `((ascii . (nil . "ISO8859-1")) 104 "fontset-default"
48 (iso-8859-1 . (nil . "ISO8859-1")) 105 '( ;; for each script
49 (iso-8859-2 . (nil . "ISO8859-2")) 106 (ascii (nil . "ISO8859-1"))
50 (iso-8859-3 . (nil . "ISO8859-3")) 107
51 (iso-8859-4 . (nil . "ISO8859-4")) 108 (latin (nil . "ISO8859-1")
52 (tis620-2533 . (nil . "TIS620*")) 109 (nil . "ISO8859-2")
53 (iso-8859-7 . (nil . "ISO8859-7")) 110 (nil . "ISO8859-3")
54 (iso-8859-6 . (nil . "ISO8859-6")) 111 (nil . "ISO8859-4")
55 (iso-8859-8 . (nil . "ISO8859-8")) 112 (nil . "ISO8859-9")
56 (iso-8859-5 . (nil . "ISO8859-5")) 113 (nil . "ISO8859-10")
57 (iso-8859-9 . (nil . "ISO8859-9")) 114 (nil . "ISO8859-13")
58 (iso-8859-14 . (nil . "ISO8859-14")) 115 (nil . "ISO8859-14")
59 (iso-8859-15 . (nil . "ISO8859-15")) 116 (nil . "VISCII1.1-1"))
60 (chinese-gb2312 . (nil . "GB2312.1980-0")) 117
61 (japanese-jisx0208 . (nil . "JISX0208*")) 118 (thai (nil . "TIS620*")
62 (korean-ksc5601 . (nil . "KSC5601.1987*")) 119 (nil . "ISO8859-11"))
63 (japanese-jisx0212 . (nil . "JISX0212*")) 120
64 (big5 . (nil . "Big5")) 121 (lao (nil . "MuleLao-1"))
65 (chinese-cns11643-1 . (nil . "CNS11643.1992-1")) 122
66 (chinese-cns11643-2 . (nil . "CNS11643.1992-2")) 123 ;; both for script and charset.
67 (chinese-cns11643-3 . (nil . "CNS11643.1992-3")) 124 (tibetan (nil . "muletibetan-2"))
68 (chinese-cns11643-4 . (nil . "CNS11643.1992-4")) 125
69 (chinese-cns11643-5 . (nil . "CNS11643.1992-5")) 126 ;; both for script and charset.
70 (chinese-cns11643-6 . (nil . "CNS11643.1992-6")) 127 (ethiopic (nil . "ethiopic-unicode"))
71 (chinese-cns11643-7 . (nil . "CNS11643.1992-7")) 128
72 (chinese-gbk . (nil . "gbk-0")) 129 (greek (nil . "ISO8859-7"))
73 (chinese-sisheng . (nil . "sisheng_cwnn")) 130
74 (viscii . (nil . "VISCII1.1*")) 131 (cyrillic (nil . "ISO8859-5"))
75 (arabic-digit . (nil . "MuleArabic-0")) 132
76 (arabic-1-column . (nil . "MuleArabic-1")) 133 (arabic (nil . "MuleArabic-0")
77 (arabic-2-column . (nil . "MuleArabic-2")) 134 (nil . "MuleArabic-1")
78 (ipa . (nil . "MuleIPA")) 135 (nil . "MuleArabic-2")
79 (ethiopic . (nil . "Ethiopic-Unicode")) 136 (nil . "ISO8859-6"))
80 (indian-is13194 . (nil . "IS13194-Devanagari")) 137
81 (indian-2-column . (nil . "MuleIndian-2")) 138 (hebrew (nil . "ISO8859-8"))
82 (mule-lao . (nil . "MuleLao-1")) 139
83 (tibetan . ("proportional" . "MuleTibetan-2")) 140 (kana (nil . "JISX0208*")
84 (tibetan-1-column . (nil . "MuleTibetan-1")) 141 (nil . "GB2312.1980-0")
85 (jisx0201 . (nil . "JISX0201*")) 142 (nil . "KSC5601.1987*")
86 (japanese-jisx0208-1978 . (nil . "JISX0208.1978*")) 143 (nil . "JISX0201*"))
87 (japanese-jisx0213-1 . (nil . "JISX0213.2000-1")) 144
88 (japanese-jisx0213-2 . (nil . "JISX0213.2000-2")) 145 (bopomofo (nil . "sisheng_cwnn-0"))
89 ;; unicode 146
90 ((,(decode-char 'ucs #x0900) 147 (han (nil . "GB2312.1980-0")
91 . ,(decode-char 'ucs #x097F)) . (nil . "ISO10646.indian-1")) 148 (nil . "JISX0208*")
92 ;; indian 149 (nil . "JISX0212*")
93 (indian-glyph . (nil . "Devanagari-CDAC")) 150 (nil . "big5*")
94 ((,(indian-glyph-char 0 'devanagari) 151 (nil . "KSC5601.1987*")
95 . ,(indian-glyph-char 255 'devanagari)) . (nil . "Devanagari-CDAC")) 152 (nil . "CNS11643.1992-1")
96 ((,(indian-glyph-char 0 'sanskrit) 153 (nil . "CNS11643.1992-2")
97 . ,(indian-glyph-char 255 'sanskrit)) . (nil . "Sanskrit-CDAC")) 154 (nil . "CNS11643.1992-3")
98 ((,(indian-glyph-char 0 'bengali) 155 (nil . "CNS11643.1992-4")
99 . ,(indian-glyph-char 255 'bengali)) . (nil . "Bengali-CDAC")) 156 (nil . "CNS11643.1992-5")
100 ((,(indian-glyph-char 0 'assamese) 157 (nil . "CNS11643.1992-6")
101 . ,(indian-glyph-char 255 'assamese)) . (nil . "Assamese-CDAC")) 158 (nil . "CNS11643.1992-7")
102 ((,(indian-glyph-char 0 'punjabi) 159 (nil . "gbk-0")
103 . ,(indian-glyph-char 255 'punjabi)) . (nil . "Punjabi-CDAC")) 160 (nil . "JISX0213.2000-1")
104 ((,(indian-glyph-char 0 'gujarati) 161 (nil . "JISX0213.2000-2"))
105 . ,(indian-glyph-char 255 'gujarati)) . (nil . "Gujarati-CDAC")) 162
106 ((,(indian-glyph-char 0 'oriya) 163 (cjk-misc (nil . "GB2312.1980-0")
107 . ,(indian-glyph-char 255 'oriya)) . (nil . "Oriya-CDAC")) 164 (nil . "JISX0208*")
108 ((,(indian-glyph-char 0 'tamil) 165 (nil . "JISX0212*")
109 . ,(indian-glyph-char 255 'tamil)) . (nil . "Tamil-CDAC")) 166 (nil . "big5*")
110 ((,(indian-glyph-char 0 'telugu) 167 (nil . "KSC5601.1987*")
111 . ,(indian-glyph-char 255 'telugu)) . (nil . "Telugu-CDAC")) 168 (nil . "CNS11643.1992-1")
112 ((,(indian-glyph-char 0 'kannada) 169 (nil . "CNS11643.1992-2")
113 . ,(indian-glyph-char 255 'kannada)) . (nil . "Kannada-CDAC")) 170 (nil . "CNS11643.1992-3")
114 ((,(indian-glyph-char 0 'malayalam) 171 (nil . "CNS11643.1992-4")
115 . ,(indian-glyph-char 255 'malayalam)) . (nil . "Malayalam-CDAC")) 172 (nil . "CNS11643.1992-5")
116 (unicode . (nil . "ISO10646-1")) 173 (nil . "CNS11643.1992-6")
117 ))) 174 (nil . "CNS11643.1992-7")
118 charset font-spec) 175 (nil . "gbk-0")
119 (while l 176 (nil . "JISX0213.2000-1")
120 (setq charset (car (car l)) font-spec (cdr (car l)) l (cdr l)) 177 (nil . "JISX0213.2000-2"))
121 (set-fontset-font "fontset-default" charset font-spec))) 178
179 (hangul (nil . "KSC5601.1987-0"))
180
181 ;; for each charset
182 (arabic-digit ("*" . "MuleArabic-0"))
183 (arabic-1-column ("*" . "MuleArabic-1"))
184 (arabic-2-column ("*" . "MuleArabic-2"))
185 (indian-1-column ("*" . "muleindian-2"))
186 (devanagari-glyph ("altsys-dv_ttsurekh" . "devanagari-cdac"))
187 (ipa (nil . "MuleIPA-1"))
188 ))
189
190;; Append Unicode fonts.
191;; This may find fonts of more varients (bold, italic) but don't cover
192;; many characters.
193(set-fontset-font "fontset-default" '(#x00A0 . #xFFFF)
194 '(nil . "iso10646-1") nil 'append)
195;; These may find fonts that covers many characters but less varients.
196(set-fontset-font "fontset-default" '(#x00A0 . #xFFFF)
197 '("gnu-unifont" . "iso10646-1") nil 'append)
198(set-fontset-font "fontset-default" '(#x00A0 . #xFFFF)
199 '("mutt-clearlyu" . "iso10646-1") nil 'append)
122 200
123(setq font-encoding-alist
124 '(("ISO8859-1" . iso-8859-1)
125 ("ISO8859-2" . iso-8859-2)
126 ("ISO8859-3" . iso-8859-3)
127 ("ISO8859-4" . iso-8859-4)
128 ("TIS620" . tis620-2533)
129 ("ISO8859-7" . iso-8859-7)
130 ("ISO8859-6" . iso-8859-6)
131 ("ISO8859-8" . iso-8859-8)
132 ("JISX0201" . jisx0201)
133 ("ISO8859-5" . iso-8859-5)
134 ("ISO8859-9" . iso-8859-9)
135 ("JISX0208.1978" . japanese-jisx0208-1978)
136 ("GB2312.1980" . chinese-gb2312)
137 ("JISX0208.1990" . japanese-jisx0208)
138 ("JISX0208.1983" . japanese-jisx0208)
139 ("KSC5601.1987" . korean-ksc5601)
140 ("JISX0212" . japanese-jisx0212)
141 ("CNS11643.1992-1" . chinese-cns11643-1)
142 ("CNS11643.1992-2" . chinese-cns11643-2)
143 ("CNS11643.1992-3" . chinese-cns11643-3)
144 ("CNS11643.1992-4" . chinese-cns11643-4)
145 ("CNS11643.1992-5" . chinese-cns11643-5)
146 ("CNS11643.1992-6" . chinese-cns11643-6)
147 ("CNS11643.1992-7" . chinese-cns11643-7)
148 ("Big5" . big5)
149 ("sisheng_cwnn" . chinese-sisheng)
150 ("VISCII" . viscii)
151 ("MuleArabic-0" . arabic-digit)
152 ("MuleArabic-1" . arabic-1-column)
153 ("MuleArabic-2" . arabic-2-column)
154 ("MuleIPA" . ipa)
155 ("Ethiopic-Unicode" . ethiopic)
156 ("IS13194-Devanagari" . indian-is13194)
157 ("MuleIndian-2" . indian-2-column)
158 ("MuleIndian-1" . indian-1-column)
159 ("MuleLao-1" . mule-lao)
160 ("MuleTibetan-2" . tibetan)
161 ("MuleTibetan-1" . tibetan-1-column)
162 ("ISO8859-14" . iso-8859-14)
163 ("ISO8859-15" . iso-8859-15)
164 ("JISX0213.2000-1" . japanese-jisx0213-1)
165 ("JISX0213.2000-2" . japanese-jisx0213-2)
166 ("abobe-symbol" . symbol)
167 ("ISO10646-1" . unicode)
168 ("ISO10646.indian-1" . unicode)))
169 201
170;; Set arguments in `font-encoding-alist' (which see). 202;; Set arguments in `font-encoding-alist' (which see).
171(defun set-font-encoding (pattern charset) 203(defun set-font-encoding (pattern charset)
@@ -355,11 +387,12 @@ XLFD-FIELDS."
355 (aref xlfd-fields xlfd-regexp-adstyle-subnum) 387 (aref xlfd-fields xlfd-regexp-adstyle-subnum)
356 (aref xlfd-fields xlfd-regexp-registry-subnum))) 388 (aref xlfd-fields xlfd-regexp-registry-subnum)))
357 (slot (assq 'ascii fontlist)) 389 (slot (assq 'ascii fontlist))
358 (ascii-font (cdr slot)) 390 (ascii-font (cadr slot))
359 xlfd-ascii) 391 xlfd-ascii)
360 (if ascii-font 392 (if ascii-font
361 (progn 393 (progn
362 (setcdr slot (setq ascii-font (x-resolve-font-name ascii-font))) 394 (setq ascii-font (x-resolve-font-name ascii-font))
395 (setcar (cdr slot) ascii-font)
363 (setq xlfd-ascii (x-decompose-font-name ascii-font)) 396 (setq xlfd-ascii (x-decompose-font-name ascii-font))
364 (dotimes (i 11) 397 (dotimes (i 11)
365 (or (aref xlfd-fields i) 398 (or (aref xlfd-fields i)
@@ -368,10 +401,10 @@ XLFD-FIELDS."
368 (setq xlfd-ascii (copy-sequence xlfd-fields)) 401 (setq xlfd-ascii (copy-sequence xlfd-fields))
369 (aset xlfd-ascii xlfd-regexp-registry-subnum "iso8859-1") 402 (aset xlfd-ascii xlfd-regexp-registry-subnum "iso8859-1")
370 (setq ascii-font (x-must-resolve-font-name xlfd-ascii)) 403 (setq ascii-font (x-must-resolve-font-name xlfd-ascii))
371 (setq fontlist (cons (cons 'ascii ascii-font) fontlist))) 404 (setq fontlist (cons (list 'ascii ascii-font) fontlist)))
372 405
373 (dolist (elt fontlist) 406 (dolist (elt fontlist)
374 (let ((name (cdr elt)) 407 (let ((name (cadr elt))
375 font-spec) 408 font-spec)
376 (when (string-match xlfd-style-regexp name) 409 (when (string-match xlfd-style-regexp name)
377 (setq font-spec (make-vector 6 nil)) 410 (setq font-spec (make-vector 6 nil))
@@ -380,7 +413,7 @@ XLFD-FIELDS."
380 (dotimes (i 6) 413 (dotimes (i 6)
381 (if (string-match "^[*-]+$" (aref font-spec i)) 414 (if (string-match "^[*-]+$" (aref font-spec i))
382 (aset font-spec i (aref default-spec i)))) 415 (aset font-spec i (aref default-spec i))))
383 (setcdr elt font-spec)))) 416 (setcar (cdr elt) font-spec))))
384 417
385 fontlist)) 418 fontlist))
386 419
@@ -439,12 +472,63 @@ with \"fontset\" in `<CHARSET_REGISTRY> field."
439 name)) 472 name))
440 fontset))) 473 fontset)))
441 474
475(defvar charset-script-alist
476 '((ascii . ascii)
477 (latin-iso8859-1 . latin)
478 (latin-iso8859-2 . latin)
479 (latin-iso8859-3 . latin)
480 (latin-iso8859-4 . latin)
481 (latin-iso8859-9 . latin)
482 (latin-iso8859-10 . latin)
483 (latin-iso8859-13 . latin)
484 (latin-iso8859-14 . latin)
485 (latin-iso8859-15 . latin)
486 (latin-iso8859-16 . latin)
487 (latin-jisx0201 . latin)
488 (thai-tis620 . thai)
489 (cyrillic-iso8859-5 . cyrillic)
490 (arabic-iso8859-6 . arabic)
491 (greek-iso8859-7 . latin)
492 (hebrew-iso8859-8 . latin)
493 (katakana-jisx0201 . katakana-halfwidth)
494 (chinese-gb2312 . han)
495 (chinese-big5-1 . han)
496 (chinese-big5-2 . han)
497 (chinese-cns11643-1 . han)
498 (chinese-cns11643-2 . han)
499 (chinese-cns11643-3 . han)
500 (chinese-cns11643-4 . han)
501 (chinese-cns11643-5 . han)
502 (chinese-cns11643-6 . han)
503 (chinese-cns11643-7 . han)
504 (japanese-jisx0208 . han)
505 (japanese-jisx0208-1978 . han)
506 (japanese-jisx0212 . han)
507 (japanese-jisx0213-1 . han)
508 (japanese-jisx0213-2 . han)
509 (korean-ksc5601 . hangul-syllable)
510 (chinese-sisheng . bopomofo)
511 (vietnamese-viscii-lower . latin)
512 (vietnamese-viscii-upper . latin)
513 (arabic-digit . arabic)
514 (arabic-1-column . arabic)
515 (arabic-2-column . arabic)
516 (indian-is13194 . devanagari)
517 (indian-glyph . devanagari)
518 (indian-1-column . devanagari)
519 (indian-2-column . devanagari)
520 (tibetan-1-column . tibetan))
521 "Alist of charsets vs the corresponding most appropriate scripts.
522
523This alist is used by the function `create-fontset-from-fontset-spec'
524to map charsets to scripts.")
525
442;;;###autoload 526;;;###autoload
443(defun create-fontset-from-fontset-spec (fontset-spec 527(defun create-fontset-from-fontset-spec (fontset-spec
444 &optional style-variant noerror) 528 &optional style-variant noerror)
445 "Create a fontset from fontset specification string FONTSET-SPEC. 529 "Create a fontset from fontset specification string FONTSET-SPEC.
446FONTSET-SPEC is a string of the format: 530FONTSET-SPEC is a string of the format:
447 FONTSET-NAME,CHARSET-NAME0:FONT-NAME0,CHARSET-NAME1:FONT-NAME1, ... 531 FONTSET-NAME,SCRIPT-NAME0:FONT-NAME0,SCRIPT-NAME1:FONT-NAME1, ...
448Any number of SPACE, TAB, and NEWLINE can be put before and after commas. 532Any number of SPACE, TAB, and NEWLINE can be put before and after commas.
449 533
450Optional 2nd argument is ignored. It exists just for backward 534Optional 2nd argument is ignored. It exists just for backward
@@ -453,13 +537,16 @@ compatibility.
453If this function attempts to create already existing fontset, error is 537If this function attempts to create already existing fontset, error is
454signaled unless the optional 3rd argument NOERROR is non-nil. 538signaled unless the optional 3rd argument NOERROR is non-nil.
455 539
456It returns a name of the created fontset." 540It returns a name of the created fontset.
541
542For backward compatibility, SCRIPT-NAME may be a charset name, in
543which case, the corresponding script is decided by the variable
544`charset-script-alist' (which see)."
457 (if (not (string-match "^[^,]+" fontset-spec)) 545 (if (not (string-match "^[^,]+" fontset-spec))
458 (error "Invalid fontset spec: %s" fontset-spec)) 546 (error "Invalid fontset spec: %s" fontset-spec))
459 (setq fontset-spec (downcase fontset-spec))
460 (let ((idx (match-end 0)) 547 (let ((idx (match-end 0))
461 (name (match-string 0 fontset-spec)) 548 (name (match-string 0 fontset-spec))
462 xlfd-fields charset fontlist ascii-font) 549 xlfd-fields script fontlist ascii-font)
463 (if (query-fontset name) 550 (if (query-fontset name)
464 (or noerror 551 (or noerror
465 (error "Fontset \"%s\" already exists" name)) 552 (error "Fontset \"%s\" already exists" name))
@@ -470,11 +557,12 @@ It returns a name of the created fontset."
470 ;; At first, extract pairs of charset and fontname from FONTSET-SPEC. 557 ;; At first, extract pairs of charset and fontname from FONTSET-SPEC.
471 (while (string-match "[, \t\n]*\\([^:]+\\):\\([^,]+\\)" fontset-spec idx) 558 (while (string-match "[, \t\n]*\\([^:]+\\):\\([^,]+\\)" fontset-spec idx)
472 (setq idx (match-end 0)) 559 (setq idx (match-end 0))
473 (setq charset (intern (match-string 1 fontset-spec))) 560 (setq script (intern (match-string 1 fontset-spec)))
474 (if (charsetp charset) 561 (if (or (memq script (char-table-extra-slot char-script-table 0))
475 (setq fontlist (cons (cons charset (match-string 2 fontset-spec)) 562 (setq script (cdr (assq script charset-script-alist))))
563 (setq fontlist (cons (list script (match-string 2 fontset-spec))
476 fontlist)))) 564 fontlist))))
477 (setq ascii-font (cdr (assq 'ascii fontlist))) 565 (setq ascii-font (cadr (assq 'ascii fontlist)))
478 566
479 ;; Complement FONTLIST. 567 ;; Complement FONTLIST.
480 (setq fontlist (x-complement-fontset-spec xlfd-fields fontlist)) 568 (setq fontlist (x-complement-fontset-spec xlfd-fields fontlist))
@@ -513,9 +601,8 @@ an appropriate name is generated automatically.
513 601
514It returns a name of the created fontset." 602It returns a name of the created fontset."
515 (setq font (downcase font)) 603 (setq font (downcase font))
516 (if resolved-font 604 (setq resolved-font
517 (setq resolved-font (downcase resolved-font)) 605 (downcase (or resolved-font (x-resolve-font-name font))))
518 (setq resolved-font (downcase (x-resolve-font-name font))))
519 (let ((xlfd (x-decompose-font-name resolved-font)) 606 (let ((xlfd (x-decompose-font-name resolved-font))
520 fontset) 607 fontset)
521 (if fontset-name 608 (if fontset-name
@@ -541,6 +628,7 @@ You have the biggest chance to display international characters
541with correct glyphs by using the standard fontset. 628with correct glyphs by using the standard fontset.
542See the documentation of `create-fontset-from-fontset-spec' for the format.") 629See the documentation of `create-fontset-from-fontset-spec' for the format.")
543 630
631
544;; Create fontsets from X resources of the name `fontset-N (class 632;; Create fontsets from X resources of the name `fontset-N (class
545;; Fontset-N)' where N is integer 0, 1, ... 633;; Fontset-N)' where N is integer 0, 1, ...
546;; The values of the resources the string of the same format as 634;; The values of the resources the string of the same format as