1 ;;; fontset.el --- commands for handling fontset
3 ;; Copyright (C) 1997-2015 Free Software Foundation, Inc.
4 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
5 ;; 2005, 2006, 2007, 2008, 2009, 2010, 2011
6 ;; National Institute of Advanced Industrial Science and Technology (AIST)
7 ;; Registration Number H14PRO021
8 ;; Copyright (C) 2003, 2006
9 ;; National Institute of Advanced Industrial Science and Technology (AIST)
10 ;; Registration Number H13PRO009
12 ;; Keywords: mule, i18n, fontset
14 ;; This file is part of GNU Emacs.
16 ;; GNU Emacs is free software: you can redistribute it and/or modify
17 ;; it under the terms of the GNU General Public License as published by
18 ;; the Free Software Foundation, either version 3 of the License, or
19 ;; (at your option) any later version.
21 ;; GNU Emacs is distributed in the hope that it will be useful,
22 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
23 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 ;; GNU General Public License for more details.
26 ;; You should have received a copy of the GNU General Public License
27 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
33 ;; Setup font-encoding-alist for all known encodings.
35 (setq font-encoding-alist
37 (cons (purecopy (car arg
)) (cdr arg
)))
38 '(("iso8859-1$" . iso-8859-1
)
39 ("iso8859-2$" . iso-8859-2
)
40 ("iso8859-3$" . iso-8859-3
)
41 ("iso8859-4$" . iso-8859-4
)
42 ("iso8859-5$" . iso-8859-5
)
43 ("iso8859-6$" . iso-8859-6
)
44 ("iso8859-7$" . iso-8859-7
)
45 ("iso8859-8$" . iso-8859-8
)
46 ("iso8859-9$" . iso-8859-9
)
47 ("iso8859-10$" . iso-8859-10
)
48 ("iso8859-11$" . iso-8859-11
)
49 ("iso8859-13$" . iso-8859-13
)
50 ("iso8859-14$" . iso-8859-14
)
51 ("iso8859-15$" . iso-8859-15
)
52 ("iso8859-16$" . iso-8859-16
)
54 ("gb2312.1980" . chinese-gb2312
)
56 ("gb18030" .
(unicode . nil
))
57 ("jisx0208.1978" . japanese-jisx0208-1978
)
58 ("jisx0208" . japanese-jisx0208
)
59 ("jisx0201" . jisx0201
)
60 ("jisx0212" . japanese-jisx0212
)
61 ("ksx1001" . korean-ksc5601
)
62 ("ksc5601.1987" . korean-ksc5601
)
63 ("cns11643.1992.*1" . chinese-cns11643-1
)
64 ("cns11643.1992.*2" . chinese-cns11643-2
)
65 ("cns11643.1992.*3" . chinese-cns11643-3
)
66 ("cns11643.1992.*4" . chinese-cns11643-4
)
67 ("cns11643.1992.*5" . chinese-cns11643-5
)
68 ("cns11643.1992.*6" . chinese-cns11643-6
)
69 ("cns11643.1992.*7" . chinese-cns11643-7
)
70 ("cns11643.92p1-0" . chinese-cns11643-1
)
71 ("cns11643.92p2-0" . chinese-cns11643-2
)
72 ("cns11643.92p3-0" . chinese-cns11643-3
)
73 ("cns11643.92p4-0" . chinese-cns11643-4
)
74 ("cns11643.92p5-0" . chinese-cns11643-5
)
75 ("cns11643.92p6-0" . chinese-cns11643-6
)
76 ("cns11643.92p7-0" . chinese-cns11643-7
)
79 ("tis620" . tis620-2533
)
80 ("microsoft-cp1251" . windows-1251
)
82 ("jisx0213.2000-1" . japanese-jisx0213-1
)
83 ("jisx0213.2000-2" . japanese-jisx0213-2
)
84 ("jisx0213.2004-1" . japanese-jisx0213.2004-
1)
85 ("iso10646-1$" .
(unicode-bmp . nil
))
86 ("iso10646.indian-1" .
(unicode-bmp . nil
))
87 ("unicode-bmp" .
(unicode-bmp . nil
))
88 ("abobe-symbol" . symbol
)
89 ("sisheng_cwnn" . chinese-sisheng
)
90 ("mulearabic-0" . arabic-digit
)
91 ("mulearabic-1" . arabic-1-column
)
92 ("mulearabic-2" . arabic-2-column
)
94 ("ethiopic-unicode" .
(unicode-bmp . ethiopic
))
95 ("is13194-devanagari" . indian-is13194
)
96 ("Devanagari-CDAC" . devanagari-cdac
)
97 ("Sanskrit-CDAC" . sanskrit-cdac
)
98 ("Bengali-CDAC" . bengali-cdac
)
99 ("Assamese-CDAC" . assamese-cdac
)
100 ("Punjabi-CDAC" . punjabi-cdac
)
101 ("Gujarati-CDAC" . gujarati-cdac
)
102 ("Oriya-CDAC" . oriya-cdac
)
103 ("Tamil-CDAC" . tamil-cdac
)
104 ("Telugu-CDAC" . telugu-cdac
)
105 ("Kannada-CDAC" . kannada-cdac
)
106 ("Malayalam-CDAC" . malayalam-cdac
)
107 ("Devanagari-Akruti" . devanagari-akruti
)
108 ("Bengali-Akruti" . bengali-akruti
)
109 ("Punjabi-Akruti" . punjabi-akruti
)
110 ("Gujarati-Akruti" . gujarati-akruti
)
111 ("Oriya-Akruti" . oriya-akruti
)
112 ("Tamil-Akruti" . tamil-akruti
)
113 ("Telugu-Akruti" . telugu-akruti
)
114 ("Kannada-Akruti" . kannada-akruti
)
115 ("Malayalam-Akruti" . malayalam-akruti
)
116 ("muleindian-2" . indian-2-column
)
117 ("muleindian-1" . indian-1-column
)
118 ("mulelao-1" . mule-lao
)
119 ("muletibetan-2" . tibetan
)
120 ("muletibetan-0" . tibetan
)
121 ("muletibetan-1" . tibetan-1-column
))))
123 (defvar font-encoding-charset-alist
)
125 (setq font-encoding-charset-alist
126 '((latin-iso8859-1 . iso-8859-1
)
127 (latin-iso8859-2 . iso-8859-2
)
128 (latin-iso8859-3 . iso-8859-3
)
129 (latin-iso8859-4 . iso-8859-4
)
130 (latin-iso8859-9 . iso-8859-9
)
131 (latin-iso8859-10 . iso-8859-10
)
132 (latin-iso8859-13 . iso-8859-13
)
133 (latin-iso8859-14 . iso-8859-14
)
134 (latin-iso8859-15 . iso-8859-15
)
135 (latin-iso8859-16 . iso-8859-16
)
136 (cyrillic-iso8859-5 . iso-8859-5
)
137 (greek-iso8859-7 . iso-8859-7
)
138 (arabic-iso8859-6 . iso-8859-6
)
139 (thai-tis620 . tis620-2533
)
140 (latin-jisx0201 . jisx0201
)
141 (katakana-jisx0201 . jisx0201
)
142 (chinese-big5-1 . big5
)
143 (chinese-big5-2 . big5
)
144 (vietnamese-viscii-lower . viscii
)
145 (vietnamese-viscii-upper . viscii
)
146 (tibetan . unicode-bmp
)))
148 (setq script-representative-chars
149 '((latin ?A ?Z ?a ?z
#x00C0
#x0100
#x0180
#x1e00
)
150 (phonetic #x250
#x283
)
177 (canadian-aboriginal #x14C0
)
182 (symbol .
[#x201C
#x2200
#x2500
])
184 (ideographic-description #x2FF0
)
195 (aegean-number #x10100
)
196 (ancient-greek-number #x10140
)
197 (ancient-symbol #x10190
)
198 (phaistos-disc #x101D0
)
204 (old-persian #x103A0
)
209 (caucasian-albanian #x10530
)
211 (cypriot-syllabary #x10800
)
219 (sinhala-archaic-number #x111E1
)
227 (warang-citi #x118A1
)
228 (pau-cin-hau #x11AC0
)
230 (cuneiform-numbers-and-punctuation #x12400
)
233 (pahawh-hmong #x16B11
)
234 (duployan-shorthand #x1BC20
)
235 (byzantine-musical-symbol #x1D000
)
236 (musical-symbol #x1D100
)
237 (ancient-greek-musical-notation #x1D200
)
238 (tai-xuan-jing-symbol #x1D300
)
239 (counting-rod-numeral #x1D360
)
240 (mende-kikakui #x1E810
)
241 (mahjong-tile #x1F000
)
242 (domino-tile #x1F030
)))
244 (defvar otf-script-alist
)
246 ;; The below was synchronized with the latest Jan 3, 2013 version of
247 ;; https://www.microsoft.com/typography/otspec/scripttags.htm.
248 (setq otf-script-alist
263 (byzm . byzantine-musical-symbol
)
264 (cans . canadian-aboriginal
)
291 (phli . inscriptional-pahlavi
)
292 (prti . inscriptional-parthian
)
295 (kana . kana
) ; Hiragana
312 (math . mathematical
)
313 (mtei . meetei-mayek
)
317 (musc . musical-symbol
)
325 (sarb . old-south-arabian
)
339 (sora . sora-sompeng
)
341 (sylo . syloti_nagri
)
362 ;; Set standard fontname specification of characters in the default
363 ;; fontset to find an appropriate font for each script/charset. The
364 ;; specification has the form ((SCRIPT FONT-SPEC ...) ...), where
366 ;; a cons (FAMILY . REGISTRY),
367 ;; or a string FONT-NAME,
368 ;; or an object created by `font-spec'.
370 ;; FAMILY may be nil, in which case, the corresponding name of
371 ;; default face is used. If REGISTRY contains a character `-', the
372 ;; string before that is embedded in `CHARSET_REGISTRY' field, and the
373 ;; string after that is embedded in `CHARSET_ENCODING' field. If it
374 ;; does not contain `-', the whole string is embedded in
375 ;; `CHARSET_REGISTRY' field, and a wild card character `*' is embedded
376 ;; in `CHARSET_ENCODING' field.
378 ;; SCRIPT is a symbol that appears as an element of the char table
379 ;; `char-script-table'. SCRIPT may be a charset specifying the range
382 (declare-function new-fontset
"fontset.c" (name fontlist
))
383 (declare-function set-fontset-font
"fontset.c"
384 (name target font-spec
&optional frame add
))
388 ;; Build data to initialize the default fontset at compile time to
389 ;; avoid loading charsets that won't be necessary at runtime.
391 ;; The value is (CJK-REGISTRY-VECTOR TARGET-SPEC ...), where
392 ;; CJK-REGISTRY-VECTOR is ["JISX0208.1983-0" "GB2312.1980-0" ...],
393 ;; TARGET-SPEC is (TARGET . BITMASK) or (TARGET SPEC ...),
394 ;; TARGET is CHAR or (FROM-CHAR . TO-CHAR),
395 ;; BITMASK is a bitmask of indices to CJK-REGISTRY-VECTOR,
396 ;; SPEC is a list of arguments to font-spec.
398 (defmacro build-default-fontset-data
()
399 (let* (;; CHARSET-REGISTRY CHARSET FROM-CODE TO-CODE
400 (cjk '(("JISX0208.1983-0" japanese-jisx0208
#x2121
#x287E
)
401 ("GB2312.1980-0" chinese-gb2312
#x2121
#x297E
)
402 ("BIG5-0" big5
#xA140
#xA3FE
)
403 ("CNS11643.1992-1" chinese-cns11643-1
#x2121
#x427E
)
404 ("KSC5601.1987-0" korean-ksc5601
#x2121
#x2C7E
)))
406 (:registry
"iso10646-1" :otf
(tibt nil
(ccmp blws abvs
)))
407 (:family
"mtib" :registry
"iso10646-1")
408 (:registry
"muletibetan-2"))
410 (:registry
"iso10646-1" :script ethiopic
)
411 (:registry
"ethiopic-unicode"))
413 (:registry
"iso10646-1" :script phonetic
)
414 (:registry
"MuleIPA-1")
415 (:registry
"iso10646-1"))))
416 (cjk-table (make-char-table nil
))
421 #'(lambda (range val
)
422 (when (eq val script
)
424 (setq range
(cons (car range
) (cdr range
))))
425 (push range coverage
)))
428 (data (list (vconcat (mapcar 'car cjk
))))
431 (let ((mask (lsh 1 i
)))
433 #'(lambda (range _arg
)
434 (let ((from (car range
)) (to (cdr range
)))
437 (or (memq (aref char-script-table from
)
438 '(kana hangul han cjk-misc
))
440 (logior (or (aref cjk-table from
) 0) mask
)))
441 (setq from
(1+ from
))))))
442 (nth 1 elt
) nil
(nth 2 elt
) (nth 3 elt
)))
445 #'(lambda (range val
)
447 (setq range
(cons (car range
) (cdr range
))))
448 (push (cons range val
) data
))
450 (dolist (script scripts
)
451 (dolist (range (funcall script-coverage
(car script
)))
452 (push (cons range
(cdr script
)) data
)))
453 `(quote ,(nreverse data
))))
456 (defun setup-default-fontset ()
457 "Setup the default fontset."
461 (latin (nil .
"ISO8859-1")
471 (nil .
"VISCII1.1-1")
472 ,(font-spec :registry
"iso10646-1" :script
'latin
))
474 (thai ,(font-spec :registry
"iso10646-1" :otf
'(thai nil nil
(mark)))
475 ,(font-spec :registry
"iso10646-1" :script
'thai
)
477 (nil .
"ISO8859-11"))
479 (devanagari ,(font-spec :registry
"iso10646-1" :otf
'(dev2 nil
(rphf)))
480 ,(font-spec :registry
"iso10646-1" :otf
'(deva nil
(rphf)))
481 (nil .
"iso10646.indian-1"))
482 (bengali ,(font-spec :registry
"iso10646-1" :otf
'(bng2 nil
(rphf)))
483 ,(font-spec :registry
"iso10646-1" :otf
'(beng nil
(rphf))))
484 (gurmukhi ,(font-spec :registry
"iso10646-1" :otf
'(gur2 nil
(blwf)))
485 ,(font-spec :registry
"iso10646-1" :otf
'(guru nil
(blwf))))
486 (gujarati ,(font-spec :registry
"iso10646-1" :otf
'(gjr2 nil
(rphf)))
487 ,(font-spec :registry
"iso10646-1" :otf
'(gujr nil
(rphf))))
488 (oriya ,(font-spec :registry
"iso10646-1" :otf
'(ory2 nil
(rphf)))
489 ,(font-spec :registry
"iso10646-1" :otf
'(orya nil
(rphf))))
490 (tamil ,(font-spec :registry
"iso10646-1" :otf
'(tml2 nil
(akhn)))
491 ,(font-spec :registry
"iso10646-1" :otf
'(taml nil
(akhn))))
492 (telugu ,(font-spec :registry
"iso10646-1" :otf
'(tel2 nil
(blwf)))
493 ,(font-spec :registry
"iso10646-1" :otf
'(telu nil
(blwf))))
494 (kannada ,(font-spec :registry
"iso10646-1" :otf
'(knd2 nil
(rphf)))
495 ,(font-spec :registry
"iso10646-1" :otf
'(knda nil
(rphf))))
496 (sinhala ,(font-spec :registry
"iso10646-1" :otf
'(sinh nil
(akhn))))
497 (malayalam ,(font-spec :registry
"iso10646-1" :otf
'(mlm2 nil
(akhn)))
498 ,(font-spec :registry
"iso10646-1" :otf
'(mlym nil
(akhn))))
500 (burmese ,(font-spec :registry
"iso10646-1" :otf
'(mym2 nil nil
))
501 ,(font-spec :registry
"iso10646-1" :otf
'(mymr nil nil
))
502 ,(font-spec :registry
"iso10646-1" :script
'burmese
))
504 (lao ,(font-spec :registry
"iso10646-1" :otf
'(lao\ nil nil
(mark)))
505 ,(font-spec :registry
"iso10646-1" :script
'lao
)
508 (tai-viet ("TaiViet" .
"iso10646-1"))
510 (greek ,(font-spec :registry
"iso10646-1" :script
'greek
)
513 (cyrillic ,(font-spec :registry
"iso10646-1" :script
'cyrillic
)
515 (nil .
"microsoft-cp1251")
518 (arabic ,(font-spec :registry
"iso10646-1"
519 :otf
'(arab nil
(init medi fina liga
)))
520 (nil .
"MuleArabic-0")
521 (nil .
"MuleArabic-1")
522 (nil .
"MuleArabic-2")
525 (hebrew ,(font-spec :registry
"iso10646-1" :script
'hebrew
)
528 (khmer ,(font-spec :registry
"iso10646-1" :otf
'(khmr nil
(pres))))
530 (kana (nil .
"JISX0208*")
531 (nil .
"GB2312.1980-0")
532 (nil .
"KSC5601.1987*")
534 (nil .
"JISX0213.2000-1")
535 (nil .
"JISX0213.2004-1")
536 ,(font-spec :registry
"iso10646-1" :script
'kana
))
538 (bopomofo ,(font-spec :registry
"iso10646-1" :script
'bopomofo
)
539 (nil .
"sisheng_cwnn-0"))
541 (han (nil .
"GB2312.1980-0")
545 (nil .
"KSC5601.1987*")
546 (nil .
"CNS11643.1992-1")
547 (nil .
"CNS11643.1992-2")
548 (nil .
"CNS11643.1992-3")
549 (nil .
"CNS11643.1992-4")
550 (nil .
"CNS11643.1992-5")
551 (nil .
"CNS11643.1992-6")
552 (nil .
"CNS11643.1992-7")
555 (nil .
"JISX0213.2000-1")
556 (nil .
"JISX0213.2000-2")
557 (nil .
"JISX0213.2004-1")
558 ,(font-spec :registry
"iso10646-1" :lang
'ja
)
559 ,(font-spec :registry
"iso10646-1" :lang
'zh
))
561 (cjk-misc (nil .
"GB2312.1980-0")
565 (nil .
"KSC5601.1987*")
566 (nil .
"CNS11643.1992-1")
567 (nil .
"CNS11643.1992-2")
568 (nil .
"CNS11643.1992-3")
569 (nil .
"CNS11643.1992-4")
570 (nil .
"CNS11643.1992-5")
571 (nil .
"CNS11643.1992-6")
572 (nil .
"CNS11643.1992-7")
575 (nil .
"JISX0213.2000-1")
576 (nil .
"JISX0213.2000-2")
577 ,(font-spec :registry
"iso10646-1" :lang
'ja
)
578 ,(font-spec :registry
"iso10646-1" :lang
'zh
))
580 (hangul (nil .
"KSC5601.1987-0")
581 ,(font-spec :registry
"iso10646-1" :lang
'ko
))
584 (ascii (nil .
"ISO8859-1"))
585 (arabic-digit ("*" .
"MuleArabic-0"))
586 (arabic-1-column ("*" .
"MuleArabic-1"))
587 (arabic-2-column ("*" .
"MuleArabic-2"))
588 (indian-is13194 (nil .
"is13194-devanagari"))
589 (indian-1-column ("*" .
"muleindian-2"))
591 (devanagari-cdac (nil .
"Devanagari-CDAC"))
592 (sanskrit-cdac (nil .
"Sanskrit-CDAC"))
593 (bengali-cdac (nil .
"Bengali-CDAC"))
594 (assamese-cdac (nil .
"Assamese-CDAC"))
595 (punjabi-cdac (nil .
"Punjabi-CDAC"))
596 (gujarati-cdac (nil .
"Gujarati-CDAC"))
597 (oriya-cdac (nil .
"Oriya-CDAC"))
598 (tamil-cdac (nil .
"Tamil-CDAC"))
599 (telugu-cdac (nil .
"Telugu-CDAC"))
600 (kannada-cdac (nil .
"Kannada-CDAC"))
601 (malayalam-cdac (nil .
"Malayalam-CDAC"))
603 (devanagari-akruti (nil .
"Devanagari-Akruti"))
604 (bengali-akruti (nil .
"Bengali-Akruti"))
605 (punjabi-akruti (nil .
"Punjabi-Akruti"))
606 (gujarati-akruti (nil .
"Gujarati-Akruti"))
607 (oriya-akruti (nil .
"Oriya-Akruti"))
608 (tamil-akruti (nil .
"Tamil-Akruti"))
609 (telugu-akruti (nil .
"Telugu-Akruti"))
610 (kannada-akruti (nil .
"Kannada-Akruti"))
611 (malayalam-akruti (nil .
"Malayalam-Akruti"))
614 (nil (nil .
"gb2312.1980")
618 (nil .
"ksc5601.1987")
619 (nil .
"CNS11643.1992-1")
620 (nil .
"CNS11643.1992-2")
621 (nil .
"CNS11643.1992-3")
622 (nil .
"CNS11643.1992-4")
623 (nil .
"CNS11643.1992-5")
624 (nil .
"CNS11643.1992-6")
625 (nil .
"CNS11643.1992-7")
627 (nil .
"jisx0213.2000-1")
628 (nil .
"jisx0213.2004-1")
632 ;; For simple scripts
633 (dolist (script '(phonetic
662 cuneiform-numbers-and-punctuation
663 byzantine-musical-symbol
665 ancient-greek-musical-notation
670 (set-fontset-font "fontset-default"
671 script
(font-spec :registry
"iso10646-1" :script script
)
674 ;; Special settings for `MATHEMATICAL (U+1D400..U+1D7FF)'.
675 (dolist (math-subgroup '((#x1D400
#x1D433 mathematical-bold
)
676 (#x1D434
#x1D467 mathematical-italic
)
677 (#x1D468
#x1D49B mathematical-bold-italic
)
678 (#x1D49C
#x1D4CF mathematical-script
)
679 (#x1D4D0
#x1D503 mathematical-bold-script
)
680 (#x1D504
#x1D537 mathematical-fraktur
)
681 (#x1D538
#x1D56B mathematical-double-struck
)
682 (#x1D56C
#x1D59F mathematical-bold-fraktur
)
683 (#x1D5A0
#x1D5D3 mathematical-sans-serif
)
684 (#x1D5D4
#x1D607 mathematical-sans-serif-bold
)
685 (#x1D608
#x1D63B mathematical-sans-serif-italic
)
686 (#x1D63C
#x1D66F mathematical-sans-serif-bold-italic
)
687 (#x1D670
#x1D6A3 mathematical-monospace
)
688 (#x1D6A4
#x1D6A5 mathematical-italic
)
689 (#x1D6A8
#x1D6E1 mathematical-bold
)
690 (#x1D6E2
#x1D71B mathematical-italic
)
691 (#x1D71C
#x1D755 mathematical-bold-italic
)
692 (#x1D756
#x1D78F mathematical-sans-serif-bold
)
693 (#x1D790
#x1D7C9 mathematical-sans-serif-bold-italic
)
694 (#x1D7CA
#x1D7D7 mathematical-bold
)
695 (#x1D7D8
#x1D7E1 mathematical-double-struck
)
696 (#x1D7E2
#x1D7EB mathematical-sans-serif
)
697 (#x1D7EC
#x1D7F5 mathematical-sans-serif-bold
)
698 (#x1D7F6
#x1D7FF mathematical-monospace
)))
699 (let ((slot (assq (nth 2 math-subgroup
) script-representative-chars
)))
701 (if (vectorp (cdr slot
))
702 (setcdr slot
(vconcat (cdr slot
) (vector (car math-subgroup
))))
703 (setcdr slot
(vector (cadr slot
) (car math-subgroup
))))
704 (setq slot
(list (nth 2 math-subgroup
) (car math-subgroup
)))
705 (nconc script-representative-chars
(list slot
))))
708 (cons (car math-subgroup
) (nth 1 math-subgroup
))
709 (font-spec :registry
"iso10646-1" :script
(nth 2 math-subgroup
))))
711 ;; Special setup for various symbols and punctuation characters
712 ;; covered well by Symbola, excluding those covered well by popular
713 ;; Unicode fonts. We exclude the latter because users don't like us
714 ;; invading on their font setups where they have good support from
716 (dolist (symbol-subgroup
717 '((#x2000 .
#x2012
) ;; General Punctuation
723 (#x2070 .
#x209F
) ;; Superscripts and Subscripts
724 (#x20B6 .
#x20CF
) ;; Currency Symbols
725 (#x2100 .
#x2121
) ;; Letterlike Symbols
727 (#x2150 .
#x215A
) ;; Number Forms
729 (#x2194 .
#x21FF
) ;; Arrows
730 (#x2200 .
#x2211
) ;; Mathematical Operators
735 (#x2300 .
#x2301
) ;; Miscellaneous Technical
739 (#x2400 .
#x243F
) ;; Control Pictures
740 (#x2440 .
#x245F
) ;; Optical Char Recognition
741 (#x2460 .
#x24FF
) ;; Enclosed Alphanumerics
742 (#x25A0 .
#x25FF
) ;; Geometric Shapes
743 (#x2600 .
#x265F
) ;; Miscellaneous Symbols
748 (#x2700 .
#x27bF
) ;; Dingbats
749 (#x27C0 .
#x27EF
) ;; Misc Mathematical Symbols-A
750 (#x27F0 .
#x27FF
) ;; Supplemental Arrows-A
751 (#x2900 .
#x297F
) ;; Supplemental Arrows-B
752 (#x2980 .
#x29FF
) ;; Misc Mathematical Symbols-B
753 (#x2A00 .
#x2AFF
) ;; Suppl. Math Operators
754 (#x2B00 .
#x2BFF
) ;; Misc Symbols and Arrows
755 (#x2E00 .
#x2E7F
) ;; Supplemental Punctuation
756 (#x4DC0 .
#x4DFF
) ;; Yijing Hexagram Symbols
757 (#xFE10 .
#xFE1F
) ;; Vertical Forms
758 (#x10100 .
#x1013F
) ;; Aegean Numbers
759 (#x102E0 .
#x102FF
) ;; Coptic Epact Numbers
760 (#x1D000 .
#x1D0FF
) ;; Byzantine Musical Symbols
761 (#x1D200 .
#x1D24F
) ;; Ancient Greek Musical Notation
762 (#x1F0A0 .
#x1F0FF
) ;; Playing Cards
763 (#x1F100 .
#x1F1FF
) ;; Enclosed Alphanumeric Suppl
764 (#x1F300 .
#x1F5FF
) ;; Misc Symbols and Pictographs
765 (#x1F600 .
#x1F64F
) ;; Emoticons
766 (#x1F650 .
#x1F67F
) ;; Ornamental Dingbats
767 (#x1F680 .
#x1F6FF
) ;; Transport and Map Symbols
768 (#x1F700 .
#x1F77F
) ;; Alchemical Symbols
769 (#x1F780 .
#x1F7FF
) ;; Geometric Shapes Extended
770 (#x1F800 .
#x1F8FF
))) ;; Supplemental Arrows-C
771 (set-fontset-font "fontset-default" symbol-subgroup
"Symbola" nil
'prepend
))
772 ;; Box Drawing and Block Elements
773 (set-fontset-font "fontset-default" '(#x2500 .
#x259F
)
774 "FreeMono" nil
'prepend
)
776 ;; Since standard-fontset-spec on X uses fixed-medium font, which
777 ;; gets mapped to a iso8859-1 variant, we would like to prefer its
778 ;; iso10646-1 variant for symbols, where the coverage is known to be
780 (dolist (symbol-subgroup
781 '((#x2000 .
#x206F
) ;; General Punctuation
782 (#x2070 .
#x209F
) ;; Superscripts and Subscripts
783 (#x20A0 .
#x20CF
) ;; Currency Symbols
784 (#x2150 .
#x218F
) ;; Number Forms
785 (#x2190 .
#x21FF
) ;; Arrows
786 (#x2200 .
#x22FF
) ;; Mathematical Operators
787 (#x2300 .
#x23FF
) ;; Miscellaneous Technical
788 (#x2400 .
#x243F
) ;; Control Pictures
789 (#x2440 .
#x245F
) ;; Optical Char Recognition
790 (#x2460 .
#x24FF
) ;; Enclosed Alphanumerics
791 (#x2500 .
#x257F
) ;; Box Drawing
792 (#x2580 .
#x259F
) ;; Block Elements
793 (#x25A0 .
#x25FF
) ;; Geometric Shapes
794 (#x2600 .
#x2689
) ;; Miscellaneous Symbols
795 (#x2700 .
#x27bF
) ;; Dingbats
796 (#x27F5 .
#x27FF
))) ;; Supplemental Arrows-A
797 (set-fontset-font "fontset-default" symbol-subgroup
798 "-*-fixed-medium-*-*-*-*-*-*-*-*-*-iso10646-1"
801 ;; Append CJK fonts for characters other than han, kana, cjk-misc.
802 ;; Append fonts for scripts whose name is also a charset name.
803 (let* ((data (build-default-fontset-data))
804 (registries (car data
)))
805 (dolist (target-spec (cdr data
))
806 (let ((target (car target-spec
))
807 (spec (cdr target-spec
)))
809 (dotimes (i (length registries
))
810 (if (> (logand spec
(lsh 1 i
)) 0)
811 (set-fontset-font "fontset-default" target
812 (cons nil
(aref registries i
))
815 (set-fontset-font "fontset-default" target
816 (apply 'font-spec args
) nil
'append
))))))
818 ;; Append Unicode fonts.
819 ;; This may find fonts with more variants (bold, italic) but which
820 ;; don't cover many characters.
821 (set-fontset-font "fontset-default" nil
822 '(nil .
"iso10646-1") nil
'prepend
)
823 ;; These may find fonts that cover many characters but with fewer
825 (set-fontset-font "fontset-default" nil
826 '("gnu-unifont" .
"iso10646-1") nil
'prepend
)
827 (set-fontset-font "fontset-default" nil
828 '("mutt-clearlyu" .
"iso10646-1") nil
'prepend
)
829 (set-fontset-font "fontset-default" '(#x20000 .
#x2FFFF
)
830 '(nil .
"unicode-sip"))
832 (set-fontset-font "fontset-default" '(#xE000 .
#xF8FF
)
833 '(nil .
"iso10646-1"))
834 ;; Don't try the fallback fonts even if no suitable font was found
835 ;; by the above font-spec.
836 (set-fontset-font "fontset-default" '(#xE000 .
#xF8FF
) nil nil
'append
))
838 (defun create-default-fontset ()
839 "Create the default fontset.
840 Internal use only. Should be called at startup time."
842 (setup-default-fontset)
843 (error (display-warning
845 (format "Creation of the default fontsets failed: %s" err
)
848 ;; These are the registered registries/encodings from
849 ;; ftp://ftp.x.org/pub/DOCS/registry 2001/06/01
855 ;; "DEC.CNS11643.1986-2" [53]
856 ;; CNS11643 2-plane using the encoding
857 ;; suggested in that standard
858 ;; "DEC.DTSCS.1990-2" [54]
859 ;; DEC Taiwan Supplemental Character Set
860 ;; "fujitsu.u90x01.1991-0" [87]
861 ;; "fujitsu.u90x03.1991-0" [87]
862 ;; "GB2312.1980-0" [39],[12]
863 ;; China (PRC) Hanzi, GL encoding
864 ;; "GB2312.1980-1" [39]
866 ;; China (PRC) Hanzi, GR encoding
868 ;; HPARABIC8 8-bit character set
870 ;; HPEAST8 8-bit character set
872 ;; HPGREEK8 8-bit character set
874 ;; HPHEBREW8 8-bit character set
875 ;; "HP-Japanese15" [36]
876 ;; HPJAPAN15 15-bit character set,
877 ;; modified from industry de facto
878 ;; standard Shift-JIS
880 ;; HPKANA8 8-bit character set
881 ;; "HP-Korean15" [36]
882 ;; HPKOREAN15 15-bit character set
884 ;; HPROMAN8 8-bit character set
885 ;; "HP-SChinese15" [36]
886 ;; HPSCHINA15 15-bit character set for
887 ;; support of Simplified Chinese
888 ;; "HP-TChinese15" [36]
889 ;; HPTCHINA15 15-bit character set for
890 ;; support of Traditional Chinese
891 ;; "HP-Turkish8" [36]
892 ;; HPTURKISH8 8-bit character set
896 ;; "ISO2022"<REG>"-"<ENC> [44]
897 ;; "ISO646.1991-IRV" [107]
898 ;; ISO 646 International Reference Version
899 ;; "ISO8859-1" [15],[12]
900 ;; ISO Latin alphabet No. 1
901 ;; "ISO8859-2" [15],[12]
902 ;; ISO Latin alphabet No. 2
903 ;; "ISO8859-3" [15],[12]
904 ;; ISO Latin alphabet No. 3
905 ;; "ISO8859-4" [15],[12]
906 ;; ISO Latin alphabet No. 4
907 ;; "ISO8859-5" [15],[12]
908 ;; ISO Latin/Cyrillic alphabet
909 ;; "ISO8859-6" [15],[12]
910 ;; ISO Latin/Arabic alphabet
911 ;; "ISO8859-7" [15],[12]
912 ;; ISO Latin/Greek alphabet
913 ;; "ISO8859-8" [15],[12]
914 ;; ISO Latin/Hebrew alphabet
915 ;; "ISO8859-9" [15],[12]
916 ;; ISO Latin alphabet No. 5
917 ;; "ISO8859-10" [15],[12]
918 ;; ISO Latin alphabet No. 6
919 ;; "ISO8859-13" [15],[12]
920 ;; ISO Latin alphabet No. 7
921 ;; "ISO8859-14" [15],[12]
922 ;; ISO Latin alphabet No. 8
923 ;; "ISO8859-15" [15],[12]
924 ;; ISO Latin alphabet No. 9
927 ;; ISO Latin alphabet No. 9, Final Committee Draft
928 ;; "ISO10646-1" [133]
929 ;; Unicode Universal Multiple-Octet Coded Character Set
930 ;; "ISO10646-MES" [133]
932 ;; Unicode Minimum European Subset
933 ;; "JISX0201.1976-0" [38],[12]
934 ;; 8-Bit Alphanumeric-Katakana Code
935 ;; "JISX0208.1983-0" [40],[12]
936 ;; Japanese Graphic Character Set,
938 ;; "JISX0208.1990-0" [71]
939 ;; Japanese Graphic Character Set,
941 ;; "JISX0208.1983-1" [40]
943 ;; Japanese Graphic Character Set,
945 ;; "JISX0212.1990-0" [72]
946 ;; Supplementary Japanese Graphic Character Set,
950 ;; "KSC5601.1987-0" [41],[12]
951 ;; Korean Graphic Character Set,
953 ;; "KSC5601.1987-1" [41]
955 ;; Korean Graphic Character Set,
957 ;; "omron_CNS11643-0" [45]
958 ;; "omron_CNS11643-1" [45]
959 ;; "omron_BIG5-0" [45]
960 ;; "omron_BIG5-1" [45]
961 ;; "wn.tamil.1993" [103]
963 (defun set-font-encoding (pattern charset
)
964 "Set arguments in `font-encoding-alist' (which see)."
965 (let ((slot (assoc pattern font-encoding-alist
)))
967 (setcdr slot charset
)
968 (setq font-encoding-alist
969 (cons (cons pattern charset
) font-encoding-alist
)))))
971 (defvar x-pixel-size-width-font-regexp
)
972 (defvar vertical-centering-font-regexp
)
974 ;; Setting for suppressing XLoadQueryFont on big fonts.
975 (setq x-pixel-size-width-font-regexp
976 (purecopy "gb2312\\|gbk\\|gb18030\\|jisx0208\\|ksc5601\\|cns11643\\|big5"))
978 ;; These fonts require vertical centering.
979 (setq vertical-centering-font-regexp
980 (purecopy "gb2312\\|gbk\\|gb18030\\|jisx0208\\|jisx0212\\|ksc5601\\|cns11643\\|big5"))
981 (put 'vertical-centering-font-regexp
'standard-value
982 (list vertical-centering-font-regexp
))
984 ;; CDAC fonts are actually smaller than their design sizes.
985 (setq face-font-rescale-alist
986 (list (cons (purecopy "-cdac$") 1.3)))
988 (defvar x-font-name-charset-alist nil
989 "This variable has no meaning now. Just kept for backward compatibility.")
991 ;;; XLFD (X Logical Font Description) format handler.
993 ;; Define XLFD's field index numbers. ; field name
994 (defconst xlfd-regexp-family-subnum
0) ; FOUNDRY and FAMILY
995 (defconst xlfd-regexp-weight-subnum
1) ; WEIGHT_NAME
996 (defconst xlfd-regexp-slant-subnum
2) ; SLANT
997 (defconst xlfd-regexp-swidth-subnum
3) ; SETWIDTH_NAME
998 (defconst xlfd-regexp-adstyle-subnum
4) ; ADD_STYLE_NAME
999 (defconst xlfd-regexp-pixelsize-subnum
5) ; PIXEL_SIZE
1000 (defconst xlfd-regexp-pointsize-subnum
6) ; POINT_SIZE
1001 (defconst xlfd-regexp-resx-subnum
7) ; RESOLUTION_X
1002 (defconst xlfd-regexp-resy-subnum
8) ; RESOLUTION_Y
1003 (defconst xlfd-regexp-spacing-subnum
8) ; SPACING
1004 (defconst xlfd-regexp-avgwidth-subnum
10) ; AVERAGE_WIDTH
1005 (defconst xlfd-regexp-registry-subnum
11) ; REGISTRY and ENCODING
1007 ;; Regular expression matching against a fontname which conforms to
1008 ;; XLFD (X Logical Font Description). All fields in XLFD should be
1009 ;; not be omitted (but can be a wild card) to be matched.
1010 (defconst xlfd-tight-regexp
1012 -\\([^-]*-[^-]*\\)-\\([^-]*\\)-\\([^-]*\\)-\\([^-]*\\)\
1013 -\\([^-]*\\)-\\([^-]*\\)-\\([^-]*\\)-\\([^-]*\\)-\\([^-]*\\)\
1014 -\\([^-]*\\)-\\([^-]*\\)-\\([^-]*-[^-]*\\)$")
1016 ;; Regular expression matching against a fontname which conforms to
1017 ;; XLFD (X Logical Font Description). All fields in XLFD from FOUNDRY
1018 ;; to ADSTYLE, REGISTRY, and ENCODING should be not be omitted (but
1019 ;; can be a wild card) to be matched.
1020 (defconst xlfd-style-regexp
1022 -\\([^-]*-[^-]*\\)-\\([^-]*\\)-\\([^-]*\\)-\\([^-]*\\)-\\([^-]*\\)-.*\
1023 -\\([^-]*-[^-]*\\)$")
1025 ;; List of field numbers of XLFD whose values are numeric.
1026 (defconst xlfd-regexp-numeric-subnums
1027 (list xlfd-regexp-pixelsize-subnum
;5
1028 xlfd-regexp-pointsize-subnum
;6
1029 xlfd-regexp-resx-subnum
;7
1030 xlfd-regexp-resy-subnum
;8
1031 xlfd-regexp-avgwidth-subnum
;10
1034 (defun x-decompose-font-name (pattern)
1035 "Decompose PATTERN into XLFD fields and return a vector of the fields.
1036 The length of the vector is 12.
1037 The FOUNDRY and FAMILY fields are concatenated and stored in the first
1038 element of the vector.
1039 The REGISTRY and ENCODING fields are concatenated and stored in the last
1040 element of the vector.
1042 Return nil if PATTERN doesn't conform to XLFD."
1043 (if (string-match xlfd-tight-regexp pattern
)
1044 (let ((xlfd-fields (make-vector 12 nil
)))
1046 (aset xlfd-fields i
(match-string (1+ i
) pattern
)))
1048 (if (string-match "^[*-]+$" (aref xlfd-fields i
))
1049 (aset xlfd-fields i nil
)))
1052 (defun x-compose-font-name (fields &optional _reduce
)
1053 "Compose X fontname from FIELDS.
1054 FIELDS is a vector of XLFD fields, of length 12.
1055 If a field is nil, wild-card letter `*' is embedded.
1056 Optional argument REDUCE exists just for backward compatibility,
1057 and is always ignored."
1058 (concat "-" (mapconcat (lambda (x) (or x
"*")) fields
"-")))
1061 (defun x-must-resolve-font-name (xlfd-fields)
1062 "Like `x-resolve-font-name', but always return a font name.
1063 XLFD-FIELDS is a vector of XLFD (X Logical Font Description) fields.
1064 If no font matching XLFD-FIELDS is available, successively replace
1065 parts of the font name pattern with \"*\" until some font is found.
1066 Value is name of that font."
1067 (let ((ascii-font nil
) (index 0))
1068 (while (and (null ascii-font
) (<= index xlfd-regexp-registry-subnum
))
1069 (let ((pattern (x-compose-font-name xlfd-fields
)))
1071 (setq ascii-font
(x-resolve-font-name pattern
))
1073 (message "Warning: no fonts matching `%s' available" pattern
)
1074 (aset xlfd-fields index
"*")
1075 (setq index
(1+ index
))))))
1077 (error "No fonts found"))
1081 (defun x-complement-fontset-spec (default-spec fontlist
)
1082 "Complement elements of FONTLIST based on DEFAULT-SPEC.
1083 DEFAULT-SPEC is a font-spec object providing default font properties.
1084 FONTLIST is an alist of script names vs the corresponding font names.
1086 The font names are parsed and unspecified font properties are
1087 given from DEFAULT-SPEC."
1088 (let ((prop-list '(:foundry
:family
:weight
:slant
:width
:adstyle
:size
)))
1089 (dolist (elt fontlist
)
1090 (let ((spec (font-spec :name
(cadr elt
))))
1091 (dolist (prop prop-list
)
1092 (let ((val (font-get spec prop
)))
1094 (font-put spec prop
(font-get default-spec prop
)))))
1095 (setcar (cdr elt
) spec
)))
1098 (defun fontset-name-p (fontset)
1099 "Return non-nil if FONTSET is valid as fontset name.
1100 A valid fontset name should conform to XLFD (X Logical Font Description)
1101 with \"fontset\" in `<CHARSET_REGISTRY>' field."
1102 (and (string-match xlfd-tight-regexp fontset
)
1103 (string= (match-string (1+ xlfd-regexp-registry-subnum
) fontset
)
1106 (declare-function fontset-list
"fontset.c" ())
1108 (defun generate-fontset-menu ()
1109 "Return list to be appended to `x-fixed-font-alist'.
1110 Done when `mouse-set-font' is called."
1112 (dolist (fontset (fontset-list))
1113 (or (string-match "fontset-default$" fontset
)
1114 (string-match "fontset-auto[0-9]+$" fontset
)
1115 (push (list (fontset-plain-name fontset
) fontset
) l
)))
1117 (sort l
#'(lambda (x y
) (string< (car x
) (car y
)))))))
1119 (declare-function query-fontset
"fontset.c" (pattern &optional regexpp
))
1121 (defun fontset-plain-name (fontset)
1122 "Return a plain and descriptive name of FONTSET."
1123 (if (not (setq fontset
(query-fontset fontset
)))
1124 (error "Invalid fontset: %s" fontset
))
1125 (let ((xlfd-fields (x-decompose-font-name fontset
)))
1127 (let ((family (aref xlfd-fields xlfd-regexp-family-subnum
))
1128 (weight (aref xlfd-fields xlfd-regexp-weight-subnum
))
1129 (slant (aref xlfd-fields xlfd-regexp-slant-subnum
))
1130 ;(swidth (aref xlfd-fields xlfd-regexp-swidth-subnum))
1131 (size (aref xlfd-fields xlfd-regexp-pixelsize-subnum
))
1132 (nickname (aref xlfd-fields xlfd-regexp-registry-subnum
))
1134 (if (not (string-match "^fontset-\\(.*\\)$" nickname
))
1135 (setq nickname family
)
1136 (setq nickname
(match-string 1 nickname
)))
1137 (if (and size
(> (string-to-number size
) 0))
1138 (setq name
(format "%s: %s-dot" nickname size
))
1139 (setq name nickname
))
1141 (cond ((string-match "^medium$" weight
)
1142 (setq name
(concat name
" " "medium")))
1143 ((string-match "^bold$\\|^demibold$" weight
)
1144 (setq name
(concat name
" " weight
)))))
1146 (cond ((string-match "^i$" slant
)
1147 (setq name
(concat name
" " "italic")))
1148 ((string-match "^o$" slant
)
1149 (setq name
(concat name
" " "slant")))
1150 ((string-match "^ri$" slant
)
1151 (setq name
(concat name
" " "reverse italic")))
1152 ((string-match "^ro$" slant
)
1153 (setq name
(concat name
" " "reverse slant")))))
1157 (defvar charset-script-alist
1159 (latin-iso8859-1 . latin
)
1160 (latin-iso8859-2 . latin
)
1161 (latin-iso8859-3 . latin
)
1162 (latin-iso8859-4 . latin
)
1163 (latin-iso8859-9 . latin
)
1164 (latin-iso8859-10 . latin
)
1165 (latin-iso8859-13 . latin
)
1166 (latin-iso8859-14 . latin
)
1167 (latin-iso8859-15 . latin
)
1168 (latin-iso8859-16 . latin
)
1169 (latin-jisx0201 . latin
)
1170 (thai-tis620 . thai
)
1171 (cyrillic-iso8859-5 . cyrillic
)
1172 (arabic-iso8859-6 . arabic
)
1173 (greek-iso8859-7 . latin
)
1174 (hebrew-iso8859-8 . latin
)
1175 (katakana-jisx0201 . kana
)
1176 (chinese-gb2312 . han
)
1178 (gb18030-2-byte . han
)
1179 (gb18030-4-byte-bmp . han
)
1180 (gb18030-4-byte-ext-1 . han
)
1181 (gb18030-4-byte-ext-2 . han
)
1182 (gb18030-4-byte-smp . han
)
1183 (chinese-big5-1 . han
)
1184 (chinese-big5-2 . han
)
1185 (chinese-cns11643-1 . han
)
1186 (chinese-cns11643-2 . han
)
1187 (chinese-cns11643-3 . han
)
1188 (chinese-cns11643-4 . han
)
1189 (chinese-cns11643-5 . han
)
1190 (chinese-cns11643-6 . han
)
1191 (chinese-cns11643-7 . han
)
1192 (japanese-jisx0208 . han
)
1193 (japanese-jisx0208-1978 . han
)
1194 (japanese-jisx0212 . han
)
1195 (japanese-jisx0213-1 . han
)
1196 (japanese-jisx0213-2 . han
)
1197 (korean-ksc5601 . hangul
)
1198 (chinese-sisheng . bopomofo
)
1199 (vietnamese-viscii-lower . latin
)
1200 (vietnamese-viscii-upper . latin
)
1201 (arabic-digit . arabic
)
1202 (arabic-1-column . arabic
)
1203 (arabic-2-column . arabic
)
1204 (indian-is13194 . devanagari
)
1205 (indian-glyph . devanagari
)
1206 (indian-1-column . devanagari
)
1207 (indian-2-column . devanagari
)
1208 (tibetan-1-column . tibetan
))
1209 "Alist of charsets vs the corresponding most appropriate scripts.
1211 This alist is used by the function `create-fontset-from-fontset-spec'
1212 to map charsets to scripts.")
1214 (defun create-fontset-from-fontset-spec (fontset-spec
1215 &optional _style-variant _noerror
)
1216 "Create a fontset from fontset specification string FONTSET-SPEC.
1217 FONTSET-SPEC is a string of the format:
1218 FONTSET-NAME,SCRIPT-NAME0:FONT-NAME0,SCRIPT-NAME1:FONT-NAME1, ...
1219 Any number of SPACE, TAB, and NEWLINE can be put before and after commas.
1221 When a frame uses the fontset as the `font' parameter, the frame's
1222 default font name is derived from FONTSET-NAME by substituting
1223 \"iso8859-1\" for the tail part \"fontset-XXX\". But, if SCRIPT-NAMEn
1224 is \"ascii\", use the corresponding FONT-NAMEn as the default font
1227 Optional 2nd and 3rd arguments exist just for backward compatibility,
1230 It returns a name of the created fontset.
1232 For backward compatibility, SCRIPT-NAME may be a charset name, in
1233 which case, the corresponding script is decided by the variable
1234 `charset-script-alist' (which see)."
1235 (or (string-match "^[^,]+" fontset-spec
)
1236 (error "Invalid fontset spec: %s" fontset-spec
))
1237 (let ((idx (match-end 0))
1238 (name (match-string 0 fontset-spec
))
1239 default-spec target script fontlist
)
1240 (or (string-match xlfd-tight-regexp name
)
1241 (error "Fontset name \"%s\" not conforming to XLFD" name
))
1242 (setq default-spec
(font-spec :name name
))
1243 ;; At first, extract pairs of charset and fontname from FONTSET-SPEC.
1244 (while (string-match "[, \t\n]*\\([^:]+\\):[ \t]*\\([^,]+\\)"
1246 (setq idx
(match-end 0))
1247 (setq target
(intern (match-string 1 fontset-spec
)))
1248 (cond ((or (eq target
'ascii
)
1249 (memq target
(char-table-extra-slot char-script-table
0)))
1250 (push (list target
(match-string 2 fontset-spec
)) fontlist
))
1251 ((setq script
(cdr (assq target charset-script-alist
)))
1252 (push (list script
(match-string 2 fontset-spec
)) fontlist
))
1254 (push (list target
(match-string 2 fontset-spec
)) fontlist
))))
1256 ;; Complement FONTLIST.
1257 (setq fontlist
(x-complement-fontset-spec default-spec fontlist
))
1259 ;; Create a fontset.
1260 (new-fontset name
(nreverse fontlist
))))
1262 (defun create-fontset-from-ascii-font (font &optional resolved-font
1264 "Create a fontset from an ASCII font FONT.
1266 Optional 2nd arg RESOLVED-FONT is a resolved name of FONT.
1267 If omitted, `x-resolve-font-name' is called to get the resolved name.
1268 At this time, if FONT is not available, an error is signaled.
1270 Optional 3rd arg FONTSET-NAME is a string to be used in
1271 `<CHARSET_ENCODING>' fields of a new fontset name. If it is omitted,
1272 an appropriate name is generated automatically.
1274 It returns a name of the created fontset."
1275 (setq font
(downcase font
))
1277 (downcase (or resolved-font
(x-resolve-font-name font
))))
1278 (let ((xlfd (x-decompose-font-name resolved-font
))
1281 (setq fontset-name
(downcase fontset-name
))
1282 (if (query-fontset "fontset-startup")
1284 (subst-char-in-string
1285 ?- ?_
(aref xlfd xlfd-regexp-registry-subnum
) t
))
1286 (setq fontset-name
"startup")))
1287 (aset xlfd xlfd-regexp-registry-subnum
1288 (format "fontset-%s" fontset-name
))
1289 (setq fontset
(x-compose-font-name xlfd
))
1290 (or (query-fontset fontset
)
1291 (create-fontset-from-fontset-spec (concat fontset
", ascii:" font
)))))
1294 ;; Create standard fontset from 16 dots fonts which are the most widely
1295 ;; installed fonts. Fonts for Chinese-GB, Korean, and Chinese-CNS are
1296 ;; specified here because FAMILY of those fonts are not "fixed" in
1298 (defvar standard-fontset-spec
1299 (purecopy "-*-fixed-medium-r-normal-*-16-*-*-*-*-*-fontset-standard")
1300 "String of fontset spec of the standard fontset.
1301 You have the biggest chance to display international characters
1302 with correct glyphs by using the standard fontset.
1303 See the documentation of `create-fontset-from-fontset-spec' for the format.")
1306 ;; Create fontsets from X resources of the name `fontset-N (class
1307 ;; Fontset-N)' where N is integer 0, 1, ...
1308 ;; The values of the resources the string of the same format as
1309 ;; `standard-fontset-spec'.
1311 (declare-function x-get-resource
"frame.c"
1312 (attribute class
&optional component subclass
))
1314 (defun create-fontset-from-x-resource ()
1317 (while (setq fontset-spec
(x-get-resource (format "fontset-%d" idx
)
1318 (format "Fontset-%d" idx
)))
1320 (create-fontset-from-fontset-spec fontset-spec t
)
1321 (error (display-warning
1323 (format "Fontset-%d: invalid specification in X resource" idx
)
1325 (setq idx
(1+ idx
)))))
1330 ;;; fontset.el ends here