1 ;;; fontset.el --- commands for handling fontset
3 ;; Copyright (C) 1997-2016 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
)
210 (caucasian-albanian #x10530
)
212 (cypriot-syllabary #x10800
)
220 (sinhala-archaic-number #x111E1
)
229 (warang-citi #x118A1
)
230 (pau-cin-hau #x11AC0
)
234 (cuneiform-numbers-and-punctuation #x12400
)
237 (pahawh-hmong #x16B11
)
239 (tangut-components #x18800
)
240 (duployan-shorthand #x1BC20
)
241 (byzantine-musical-symbol #x1D000
)
242 (musical-symbol #x1D100
)
243 (ancient-greek-musical-notation #x1D200
)
244 (tai-xuan-jing-symbol #x1D300
)
245 (counting-rod-numeral #x1D360
)
246 (mende-kikakui #x1E810
)
248 (mahjong-tile #x1F000
)
249 (domino-tile #x1F030
)))
251 (defvar otf-script-alist
)
253 ;; The below was synchronized with the latest Feb 25, 2016 version of
254 ;; https://www.microsoft.com/typography/otspec/scripttags.htm.
255 (setq otf-script-alist
275 (byzm . byzantine-musical-symbol
)
276 (cans . canadian-aboriginal
)
278 (aghb . caucasian-albanian
)
289 (dupl . duployan-shorthand
)
308 (phli . inscriptional-pahlavi
)
309 (prti . inscriptional-parthian
)
312 (kana . kana
) ; Hiragana
335 (math . mathematical
)
336 (mtei . meetei-mayek
)
337 (mend . mende-kikakui
)
345 (musc . musical-symbol
)
355 (narb . old-north-arabian
)
357 (sarb . old-south-arabian
)
363 (hmng . pahawh-hmong
)
367 (phli . inscriptional-pahlavi
)
369 (phlp . psalter-pahlavi
)
370 (prti . inscriptional-parthian
)
378 (sgnw . sutton-sign-writing
)
380 (sora . sora-sompeng
)
382 (sylo . syloti_nagri
)
406 ;; Set standard fontname specification of characters in the default
407 ;; fontset to find an appropriate font for each script/charset. The
408 ;; specification has the form ((SCRIPT FONT-SPEC ...) ...), where
410 ;; a cons (FAMILY . REGISTRY),
411 ;; or a string FONT-NAME,
412 ;; or an object created by `font-spec'.
414 ;; FAMILY may be nil, in which case, the corresponding name of
415 ;; default face is used. If REGISTRY contains a character `-', the
416 ;; string before that is embedded in `CHARSET_REGISTRY' field, and the
417 ;; string after that is embedded in `CHARSET_ENCODING' field. If it
418 ;; does not contain `-', the whole string is embedded in
419 ;; `CHARSET_REGISTRY' field, and a wild card character `*' is embedded
420 ;; in `CHARSET_ENCODING' field.
422 ;; SCRIPT is a symbol that appears as an element of the char table
423 ;; `char-script-table'. SCRIPT may be a charset specifying the range
426 (declare-function new-fontset
"fontset.c" (name fontlist
))
427 (declare-function set-fontset-font
"fontset.c"
428 (name target font-spec
&optional frame add
))
432 ;; Build data to initialize the default fontset at compile time to
433 ;; avoid loading charsets that won't be necessary at runtime.
435 ;; The value is (CJK-REGISTRY-VECTOR TARGET-SPEC ...), where
436 ;; CJK-REGISTRY-VECTOR is ["JISX0208.1983-0" "GB2312.1980-0" ...],
437 ;; TARGET-SPEC is (TARGET . BITMASK) or (TARGET SPEC ...),
438 ;; TARGET is CHAR or (FROM-CHAR . TO-CHAR),
439 ;; BITMASK is a bitmask of indices to CJK-REGISTRY-VECTOR,
440 ;; SPEC is a list of arguments to font-spec.
442 (defmacro build-default-fontset-data
()
443 (let* (;; CHARSET-REGISTRY CHARSET FROM-CODE TO-CODE
444 (cjk '(("JISX0208.1983-0" japanese-jisx0208
#x2121
#x287E
)
445 ("GB2312.1980-0" chinese-gb2312
#x2121
#x297E
)
446 ("BIG5-0" big5
#xA140
#xA3FE
)
447 ("CNS11643.1992-1" chinese-cns11643-1
#x2121
#x427E
)
448 ("KSC5601.1987-0" korean-ksc5601
#x2121
#x2C7E
)))
450 (:registry
"iso10646-1" :otf
(tibt nil
(ccmp blws abvs
)))
451 (:family
"mtib" :registry
"iso10646-1")
452 (:registry
"muletibetan-2"))
454 (:registry
"iso10646-1" :script ethiopic
)
455 (:registry
"ethiopic-unicode"))
457 (:registry
"iso10646-1" :script phonetic
)
458 (:registry
"MuleIPA-1")
459 (:registry
"iso10646-1"))))
460 (cjk-table (make-char-table nil
))
465 #'(lambda (range val
)
466 (when (eq val script
)
468 (setq range
(cons (car range
) (cdr range
))))
469 (push range coverage
)))
472 (data (list (vconcat (mapcar 'car cjk
))))
475 (let ((mask (lsh 1 i
)))
477 #'(lambda (range _arg
)
478 (let ((from (car range
)) (to (cdr range
)))
481 (or (memq (aref char-script-table from
)
482 '(kana hangul han cjk-misc
))
484 (logior (or (aref cjk-table from
) 0) mask
)))
485 (setq from
(1+ from
))))))
486 (nth 1 elt
) nil
(nth 2 elt
) (nth 3 elt
)))
489 #'(lambda (range val
)
491 (setq range
(cons (car range
) (cdr range
))))
492 (push (cons range val
) data
))
494 (dolist (script scripts
)
495 (dolist (range (funcall script-coverage
(car script
)))
496 (push (cons range
(cdr script
)) data
)))
497 `(quote ,(nreverse data
))))
500 (defun setup-default-fontset ()
501 "Setup the default fontset."
505 (latin (nil .
"ISO8859-1")
515 (nil .
"VISCII1.1-1")
516 ,(font-spec :registry
"iso10646-1" :script
'latin
))
518 (thai ,(font-spec :registry
"iso10646-1" :otf
'(thai nil nil
(mark)))
519 ,(font-spec :registry
"iso10646-1" :script
'thai
)
521 (nil .
"ISO8859-11"))
523 (devanagari ,(font-spec :registry
"iso10646-1" :otf
'(dev2 nil
(rphf)))
524 ,(font-spec :registry
"iso10646-1" :otf
'(deva nil
(rphf)))
525 (nil .
"iso10646.indian-1"))
526 (bengali ,(font-spec :registry
"iso10646-1" :otf
'(bng2 nil
(rphf)))
527 ,(font-spec :registry
"iso10646-1" :otf
'(beng nil
(rphf))))
528 (gurmukhi ,(font-spec :registry
"iso10646-1" :otf
'(gur2 nil
(blwf)))
529 ,(font-spec :registry
"iso10646-1" :otf
'(guru nil
(blwf))))
530 (gujarati ,(font-spec :registry
"iso10646-1" :otf
'(gjr2 nil
(rphf)))
531 ,(font-spec :registry
"iso10646-1" :otf
'(gujr nil
(rphf))))
532 (oriya ,(font-spec :registry
"iso10646-1" :otf
'(ory2 nil
(rphf)))
533 ,(font-spec :registry
"iso10646-1" :otf
'(orya nil
(rphf))))
534 (tamil ,(font-spec :registry
"iso10646-1" :otf
'(tml2 nil
(akhn)))
535 ,(font-spec :registry
"iso10646-1" :otf
'(taml nil
(akhn))))
536 (telugu ,(font-spec :registry
"iso10646-1" :otf
'(tel2 nil
(blwf)))
537 ,(font-spec :registry
"iso10646-1" :otf
'(telu nil
(blwf))))
538 (kannada ,(font-spec :registry
"iso10646-1" :otf
'(knd2 nil
(rphf)))
539 ,(font-spec :registry
"iso10646-1" :otf
'(knda nil
(rphf))))
540 (sinhala ,(font-spec :registry
"iso10646-1" :otf
'(sinh nil
(akhn))))
541 (malayalam ,(font-spec :registry
"iso10646-1" :otf
'(mlm2 nil
(akhn)))
542 ,(font-spec :registry
"iso10646-1" :otf
'(mlym nil
(akhn))))
544 (burmese ,(font-spec :registry
"iso10646-1" :otf
'(mym2 nil nil
))
545 ,(font-spec :registry
"iso10646-1" :otf
'(mymr nil nil
))
546 ,(font-spec :registry
"iso10646-1" :script
'burmese
))
548 (lao ,(font-spec :registry
"iso10646-1" :otf
'(lao\ nil nil
(mark)))
549 ,(font-spec :registry
"iso10646-1" :script
'lao
)
552 (tai-viet ("TaiViet" .
"iso10646-1"))
554 (greek ,(font-spec :registry
"iso10646-1" :script
'greek
)
557 (cyrillic ,(font-spec :registry
"iso10646-1" :script
'cyrillic
)
559 (nil .
"microsoft-cp1251")
562 (arabic ,(font-spec :registry
"iso10646-1"
563 :otf
'(arab nil
(init medi fina liga
)))
564 (nil .
"MuleArabic-0")
565 (nil .
"MuleArabic-1")
566 (nil .
"MuleArabic-2")
569 (hebrew ,(font-spec :registry
"iso10646-1" :script
'hebrew
)
572 (khmer ,(font-spec :registry
"iso10646-1" :otf
'(khmr nil
(pres))))
574 (kana (nil .
"JISX0208*")
575 (nil .
"GB2312.1980-0")
576 (nil .
"KSC5601.1987*")
578 (nil .
"JISX0213.2000-1")
579 (nil .
"JISX0213.2004-1")
580 ,(font-spec :registry
"iso10646-1" :script
'kana
))
582 (bopomofo ,(font-spec :registry
"iso10646-1" :script
'bopomofo
)
583 (nil .
"sisheng_cwnn-0"))
585 (han (nil .
"GB2312.1980-0")
589 (nil .
"KSC5601.1987*")
590 (nil .
"CNS11643.1992-1")
591 (nil .
"CNS11643.1992-2")
592 (nil .
"CNS11643.1992-3")
593 (nil .
"CNS11643.1992-4")
594 (nil .
"CNS11643.1992-5")
595 (nil .
"CNS11643.1992-6")
596 (nil .
"CNS11643.1992-7")
599 (nil .
"JISX0213.2000-1")
600 (nil .
"JISX0213.2000-2")
601 (nil .
"JISX0213.2004-1")
602 ,(font-spec :registry
"iso10646-1" :lang
'ja
)
603 ,(font-spec :registry
"iso10646-1" :lang
'zh
))
605 (cjk-misc (nil .
"GB2312.1980-0")
609 (nil .
"KSC5601.1987*")
610 (nil .
"CNS11643.1992-1")
611 (nil .
"CNS11643.1992-2")
612 (nil .
"CNS11643.1992-3")
613 (nil .
"CNS11643.1992-4")
614 (nil .
"CNS11643.1992-5")
615 (nil .
"CNS11643.1992-6")
616 (nil .
"CNS11643.1992-7")
619 (nil .
"JISX0213.2000-1")
620 (nil .
"JISX0213.2000-2")
621 ,(font-spec :registry
"iso10646-1" :lang
'ja
)
622 ,(font-spec :registry
"iso10646-1" :lang
'zh
))
624 (hangul (nil .
"KSC5601.1987-0")
625 ,(font-spec :registry
"iso10646-1" :lang
'ko
))
628 (ascii (nil .
"ISO8859-1"))
629 (arabic-digit ("*" .
"MuleArabic-0"))
630 (arabic-1-column ("*" .
"MuleArabic-1"))
631 (arabic-2-column ("*" .
"MuleArabic-2"))
632 (indian-is13194 (nil .
"is13194-devanagari"))
633 (indian-1-column ("*" .
"muleindian-2"))
635 (devanagari-cdac (nil .
"Devanagari-CDAC"))
636 (sanskrit-cdac (nil .
"Sanskrit-CDAC"))
637 (bengali-cdac (nil .
"Bengali-CDAC"))
638 (assamese-cdac (nil .
"Assamese-CDAC"))
639 (punjabi-cdac (nil .
"Punjabi-CDAC"))
640 (gujarati-cdac (nil .
"Gujarati-CDAC"))
641 (oriya-cdac (nil .
"Oriya-CDAC"))
642 (tamil-cdac (nil .
"Tamil-CDAC"))
643 (telugu-cdac (nil .
"Telugu-CDAC"))
644 (kannada-cdac (nil .
"Kannada-CDAC"))
645 (malayalam-cdac (nil .
"Malayalam-CDAC"))
647 (devanagari-akruti (nil .
"Devanagari-Akruti"))
648 (bengali-akruti (nil .
"Bengali-Akruti"))
649 (punjabi-akruti (nil .
"Punjabi-Akruti"))
650 (gujarati-akruti (nil .
"Gujarati-Akruti"))
651 (oriya-akruti (nil .
"Oriya-Akruti"))
652 (tamil-akruti (nil .
"Tamil-Akruti"))
653 (telugu-akruti (nil .
"Telugu-Akruti"))
654 (kannada-akruti (nil .
"Kannada-Akruti"))
655 (malayalam-akruti (nil .
"Malayalam-Akruti"))
658 (nil (nil .
"gb2312.1980")
662 (nil .
"ksc5601.1987")
663 (nil .
"CNS11643.1992-1")
664 (nil .
"CNS11643.1992-2")
665 (nil .
"CNS11643.1992-3")
666 (nil .
"CNS11643.1992-4")
667 (nil .
"CNS11643.1992-5")
668 (nil .
"CNS11643.1992-6")
669 (nil .
"CNS11643.1992-7")
671 (nil .
"jisx0213.2000-1")
672 (nil .
"jisx0213.2004-1")
676 ;; For simple scripts
677 (dolist (script '(phonetic
706 cuneiform-numbers-and-punctuation
707 byzantine-musical-symbol
709 ancient-greek-musical-notation
714 (set-fontset-font "fontset-default"
715 script
(font-spec :registry
"iso10646-1" :script script
)
718 ;; Special settings for `MATHEMATICAL (U+1D400..U+1D7FF)'.
719 (dolist (math-subgroup '((#x1D400
#x1D433 mathematical-bold
)
720 (#x1D434
#x1D467 mathematical-italic
)
721 (#x1D468
#x1D49B mathematical-bold-italic
)
722 (#x1D49C
#x1D4CF mathematical-script
)
723 (#x1D4D0
#x1D503 mathematical-bold-script
)
724 (#x1D504
#x1D537 mathematical-fraktur
)
725 (#x1D538
#x1D56B mathematical-double-struck
)
726 (#x1D56C
#x1D59F mathematical-bold-fraktur
)
727 (#x1D5A0
#x1D5D3 mathematical-sans-serif
)
728 (#x1D5D4
#x1D607 mathematical-sans-serif-bold
)
729 (#x1D608
#x1D63B mathematical-sans-serif-italic
)
730 (#x1D63C
#x1D66F mathematical-sans-serif-bold-italic
)
731 (#x1D670
#x1D6A3 mathematical-monospace
)
732 (#x1D6A4
#x1D6A5 mathematical-italic
)
733 (#x1D6A8
#x1D6E1 mathematical-bold
)
734 (#x1D6E2
#x1D71B mathematical-italic
)
735 (#x1D71C
#x1D755 mathematical-bold-italic
)
736 (#x1D756
#x1D78F mathematical-sans-serif-bold
)
737 (#x1D790
#x1D7C9 mathematical-sans-serif-bold-italic
)
738 (#x1D7CA
#x1D7D7 mathematical-bold
)
739 (#x1D7D8
#x1D7E1 mathematical-double-struck
)
740 (#x1D7E2
#x1D7EB mathematical-sans-serif
)
741 (#x1D7EC
#x1D7F5 mathematical-sans-serif-bold
)
742 (#x1D7F6
#x1D7FF mathematical-monospace
)))
743 (let ((slot (assq (nth 2 math-subgroup
) script-representative-chars
)))
745 (if (vectorp (cdr slot
))
746 (setcdr slot
(vconcat (cdr slot
) (vector (car math-subgroup
))))
747 (setcdr slot
(vector (cadr slot
) (car math-subgroup
))))
748 (setq slot
(list (nth 2 math-subgroup
) (car math-subgroup
)))
749 (nconc script-representative-chars
(list slot
))))
752 (cons (car math-subgroup
) (nth 1 math-subgroup
))
753 (font-spec :registry
"iso10646-1" :script
(nth 2 math-subgroup
))))
755 ;; Special setup for various symbols and punctuation characters
756 ;; covered well by Symbola, excluding those covered well by popular
757 ;; Unicode fonts. We exclude the latter because users don't like us
758 ;; invading on their font setups where they have good support from
760 (dolist (symbol-subgroup
761 '((#x2000 .
#x2012
) ;; General Punctuation
767 (#x2070 .
#x209F
) ;; Superscripts and Subscripts
768 (#x20B6 .
#x20CF
) ;; Currency Symbols
769 (#x2100 .
#x2121
) ;; Letterlike Symbols
771 (#x2150 .
#x215A
) ;; Number Forms
773 (#x2194 .
#x21FF
) ;; Arrows
774 (#x2200 .
#x2211
) ;; Mathematical Operators
779 (#x2300 .
#x2301
) ;; Miscellaneous Technical
783 (#x2400 .
#x243F
) ;; Control Pictures
784 (#x2440 .
#x245F
) ;; Optical Char Recognition
785 (#x2460 .
#x24FF
) ;; Enclosed Alphanumerics
786 (#x25A0 .
#x25FF
) ;; Geometric Shapes
787 (#x2600 .
#x265F
) ;; Miscellaneous Symbols
792 (#x2700 .
#x27bF
) ;; Dingbats
793 (#x27C0 .
#x27EF
) ;; Misc Mathematical Symbols-A
794 (#x27F0 .
#x27FF
) ;; Supplemental Arrows-A
795 (#x2900 .
#x297F
) ;; Supplemental Arrows-B
796 (#x2980 .
#x29FF
) ;; Misc Mathematical Symbols-B
797 (#x2A00 .
#x2AFF
) ;; Suppl. Math Operators
798 (#x2B00 .
#x2BFF
) ;; Misc Symbols and Arrows
799 (#x2E00 .
#x2E7F
) ;; Supplemental Punctuation
800 (#x4DC0 .
#x4DFF
) ;; Yijing Hexagram Symbols
801 (#xFE10 .
#xFE1F
) ;; Vertical Forms
802 (#x10100 .
#x1013F
) ;; Aegean Numbers
803 (#x102E0 .
#x102FF
) ;; Coptic Epact Numbers
804 (#x1D000 .
#x1D0FF
) ;; Byzantine Musical Symbols
805 (#x1D200 .
#x1D24F
) ;; Ancient Greek Musical Notation
806 (#x1F0A0 .
#x1F0FF
) ;; Playing Cards
807 (#x1F100 .
#x1F1FF
) ;; Enclosed Alphanumeric Suppl
808 (#x1F300 .
#x1F5FF
) ;; Misc Symbols and Pictographs
809 (#x1F600 .
#x1F64F
) ;; Emoticons
810 (#x1F650 .
#x1F67F
) ;; Ornamental Dingbats
811 (#x1F680 .
#x1F6FF
) ;; Transport and Map Symbols
812 (#x1F700 .
#x1F77F
) ;; Alchemical Symbols
813 (#x1F780 .
#x1F7FF
) ;; Geometric Shapes Extended
814 (#x1F800 .
#x1F8FF
))) ;; Supplemental Arrows-C
815 (set-fontset-font "fontset-default" symbol-subgroup
"Symbola" nil
'prepend
))
816 ;; Box Drawing and Block Elements
817 (set-fontset-font "fontset-default" '(#x2500 .
#x259F
)
818 "FreeMono" nil
'prepend
)
820 ;; Since standard-fontset-spec on X uses fixed-medium font, which
821 ;; gets mapped to a iso8859-1 variant, we would like to prefer its
822 ;; iso10646-1 variant for symbols, where the coverage is known to be
824 (dolist (symbol-subgroup
825 '((#x2000 .
#x206F
) ;; General Punctuation
826 (#x2070 .
#x209F
) ;; Superscripts and Subscripts
827 (#x20A0 .
#x20CF
) ;; Currency Symbols
828 (#x2150 .
#x218F
) ;; Number Forms
829 (#x2190 .
#x21FF
) ;; Arrows
830 (#x2200 .
#x22FF
) ;; Mathematical Operators
831 (#x2300 .
#x23FF
) ;; Miscellaneous Technical
832 (#x2400 .
#x243F
) ;; Control Pictures
833 (#x2440 .
#x245F
) ;; Optical Char Recognition
834 (#x2460 .
#x24FF
) ;; Enclosed Alphanumerics
835 (#x2500 .
#x257F
) ;; Box Drawing
836 (#x2580 .
#x259F
) ;; Block Elements
837 (#x25A0 .
#x25FF
) ;; Geometric Shapes
838 (#x2600 .
#x2689
) ;; Miscellaneous Symbols
839 (#x2700 .
#x27bF
) ;; Dingbats
840 (#x27F5 .
#x27FF
))) ;; Supplemental Arrows-A
841 (set-fontset-font "fontset-default" symbol-subgroup
842 "-*-fixed-medium-*-*-*-*-*-*-*-*-*-iso10646-1"
845 ;; Append CJK fonts for characters other than han, kana, cjk-misc.
846 ;; Append fonts for scripts whose name is also a charset name.
847 (let* ((data (build-default-fontset-data))
848 (registries (car data
)))
849 (dolist (target-spec (cdr data
))
850 (let ((target (car target-spec
))
851 (spec (cdr target-spec
)))
853 (dotimes (i (length registries
))
854 (if (> (logand spec
(lsh 1 i
)) 0)
855 (set-fontset-font "fontset-default" target
856 (cons nil
(aref registries i
))
859 (set-fontset-font "fontset-default" target
860 (apply 'font-spec args
) nil
'append
))))))
862 ;; Append Unicode fonts.
863 ;; This may find fonts with more variants (bold, italic) but which
864 ;; don't cover many characters.
865 (set-fontset-font "fontset-default" nil
866 '(nil .
"iso10646-1") nil
'prepend
)
867 ;; These may find fonts that cover many characters but with fewer
869 (set-fontset-font "fontset-default" nil
870 '("gnu-unifont" .
"iso10646-1") nil
'prepend
)
871 (set-fontset-font "fontset-default" nil
872 '("mutt-clearlyu" .
"iso10646-1") nil
'prepend
)
873 (set-fontset-font "fontset-default" '(#x20000 .
#x2FFFF
)
874 '(nil .
"unicode-sip"))
876 (set-fontset-font "fontset-default" '(#xE000 .
#xF8FF
)
877 '(nil .
"iso10646-1"))
878 ;; Don't try the fallback fonts even if no suitable font was found
879 ;; by the above font-spec.
880 (set-fontset-font "fontset-default" '(#xE000 .
#xF8FF
) nil nil
'append
))
882 (defun create-default-fontset ()
883 "Create the default fontset.
884 Internal use only. Should be called at startup time."
886 (setup-default-fontset)
887 (error (display-warning
889 (format "Creation of the default fontsets failed: %s" err
)
892 ;; These are the registered registries/encodings from
893 ;; ftp://ftp.x.org/pub/DOCS/registry 2001/06/01
899 ;; "DEC.CNS11643.1986-2" [53]
900 ;; CNS11643 2-plane using the encoding
901 ;; suggested in that standard
902 ;; "DEC.DTSCS.1990-2" [54]
903 ;; DEC Taiwan Supplemental Character Set
904 ;; "fujitsu.u90x01.1991-0" [87]
905 ;; "fujitsu.u90x03.1991-0" [87]
906 ;; "GB2312.1980-0" [39],[12]
907 ;; China (PRC) Hanzi, GL encoding
908 ;; "GB2312.1980-1" [39]
910 ;; China (PRC) Hanzi, GR encoding
912 ;; HPARABIC8 8-bit character set
914 ;; HPEAST8 8-bit character set
916 ;; HPGREEK8 8-bit character set
918 ;; HPHEBREW8 8-bit character set
919 ;; "HP-Japanese15" [36]
920 ;; HPJAPAN15 15-bit character set,
921 ;; modified from industry de facto
922 ;; standard Shift-JIS
924 ;; HPKANA8 8-bit character set
925 ;; "HP-Korean15" [36]
926 ;; HPKOREAN15 15-bit character set
928 ;; HPROMAN8 8-bit character set
929 ;; "HP-SChinese15" [36]
930 ;; HPSCHINA15 15-bit character set for
931 ;; support of Simplified Chinese
932 ;; "HP-TChinese15" [36]
933 ;; HPTCHINA15 15-bit character set for
934 ;; support of Traditional Chinese
935 ;; "HP-Turkish8" [36]
936 ;; HPTURKISH8 8-bit character set
940 ;; "ISO2022"<REG>"-"<ENC> [44]
941 ;; "ISO646.1991-IRV" [107]
942 ;; ISO 646 International Reference Version
943 ;; "ISO8859-1" [15],[12]
944 ;; ISO Latin alphabet No. 1
945 ;; "ISO8859-2" [15],[12]
946 ;; ISO Latin alphabet No. 2
947 ;; "ISO8859-3" [15],[12]
948 ;; ISO Latin alphabet No. 3
949 ;; "ISO8859-4" [15],[12]
950 ;; ISO Latin alphabet No. 4
951 ;; "ISO8859-5" [15],[12]
952 ;; ISO Latin/Cyrillic alphabet
953 ;; "ISO8859-6" [15],[12]
954 ;; ISO Latin/Arabic alphabet
955 ;; "ISO8859-7" [15],[12]
956 ;; ISO Latin/Greek alphabet
957 ;; "ISO8859-8" [15],[12]
958 ;; ISO Latin/Hebrew alphabet
959 ;; "ISO8859-9" [15],[12]
960 ;; ISO Latin alphabet No. 5
961 ;; "ISO8859-10" [15],[12]
962 ;; ISO Latin alphabet No. 6
963 ;; "ISO8859-13" [15],[12]
964 ;; ISO Latin alphabet No. 7
965 ;; "ISO8859-14" [15],[12]
966 ;; ISO Latin alphabet No. 8
967 ;; "ISO8859-15" [15],[12]
968 ;; ISO Latin alphabet No. 9
971 ;; ISO Latin alphabet No. 9, Final Committee Draft
972 ;; "ISO10646-1" [133]
973 ;; Unicode Universal Multiple-Octet Coded Character Set
974 ;; "ISO10646-MES" [133]
976 ;; Unicode Minimum European Subset
977 ;; "JISX0201.1976-0" [38],[12]
978 ;; 8-Bit Alphanumeric-Katakana Code
979 ;; "JISX0208.1983-0" [40],[12]
980 ;; Japanese Graphic Character Set,
982 ;; "JISX0208.1990-0" [71]
983 ;; Japanese Graphic Character Set,
985 ;; "JISX0208.1983-1" [40]
987 ;; Japanese Graphic Character Set,
989 ;; "JISX0212.1990-0" [72]
990 ;; Supplementary Japanese Graphic Character Set,
994 ;; "KSC5601.1987-0" [41],[12]
995 ;; Korean Graphic Character Set,
997 ;; "KSC5601.1987-1" [41]
999 ;; Korean Graphic Character Set,
1001 ;; "omron_CNS11643-0" [45]
1002 ;; "omron_CNS11643-1" [45]
1003 ;; "omron_BIG5-0" [45]
1004 ;; "omron_BIG5-1" [45]
1005 ;; "wn.tamil.1993" [103]
1007 (defun set-font-encoding (pattern charset
)
1008 "Set arguments in `font-encoding-alist' (which see)."
1009 (let ((slot (assoc pattern font-encoding-alist
)))
1011 (setcdr slot charset
)
1012 (setq font-encoding-alist
1013 (cons (cons pattern charset
) font-encoding-alist
)))))
1015 (defvar x-pixel-size-width-font-regexp
)
1016 (defvar vertical-centering-font-regexp
)
1018 ;; Setting for suppressing XLoadQueryFont on big fonts.
1019 (setq x-pixel-size-width-font-regexp
1020 (purecopy "gb2312\\|gbk\\|gb18030\\|jisx0208\\|ksc5601\\|cns11643\\|big5"))
1022 ;; These fonts require vertical centering.
1023 (setq vertical-centering-font-regexp
1024 (purecopy "gb2312\\|gbk\\|gb18030\\|jisx0208\\|jisx0212\\|ksc5601\\|cns11643\\|big5"))
1025 (put 'vertical-centering-font-regexp
'standard-value
1026 (list vertical-centering-font-regexp
))
1028 ;; CDAC fonts are actually smaller than their design sizes.
1029 (setq face-font-rescale-alist
1030 (list (cons (purecopy "-cdac$") 1.3)))
1032 (defvar x-font-name-charset-alist nil
1033 "This variable has no meaning now. Just kept for backward compatibility.")
1035 ;;; XLFD (X Logical Font Description) format handler.
1037 ;; Define XLFD's field index numbers. ; field name
1038 (defconst xlfd-regexp-family-subnum
0) ; FOUNDRY and FAMILY
1039 (defconst xlfd-regexp-weight-subnum
1) ; WEIGHT_NAME
1040 (defconst xlfd-regexp-slant-subnum
2) ; SLANT
1041 (defconst xlfd-regexp-swidth-subnum
3) ; SETWIDTH_NAME
1042 (defconst xlfd-regexp-adstyle-subnum
4) ; ADD_STYLE_NAME
1043 (defconst xlfd-regexp-pixelsize-subnum
5) ; PIXEL_SIZE
1044 (defconst xlfd-regexp-pointsize-subnum
6) ; POINT_SIZE
1045 (defconst xlfd-regexp-resx-subnum
7) ; RESOLUTION_X
1046 (defconst xlfd-regexp-resy-subnum
8) ; RESOLUTION_Y
1047 (defconst xlfd-regexp-spacing-subnum
8) ; SPACING
1048 (defconst xlfd-regexp-avgwidth-subnum
10) ; AVERAGE_WIDTH
1049 (defconst xlfd-regexp-registry-subnum
11) ; REGISTRY and ENCODING
1051 ;; Regular expression matching against a fontname which conforms to
1052 ;; XLFD (X Logical Font Description). All fields in XLFD should be
1053 ;; not be omitted (but can be a wild card) to be matched.
1054 (defconst xlfd-tight-regexp
1056 -\\([^-]*-[^-]*\\)-\\([^-]*\\)-\\([^-]*\\)-\\([^-]*\\)\
1057 -\\([^-]*\\)-\\([^-]*\\)-\\([^-]*\\)-\\([^-]*\\)-\\([^-]*\\)\
1058 -\\([^-]*\\)-\\([^-]*\\)-\\([^-]*-[^-]*\\)$")
1060 ;; Regular expression matching against a fontname which conforms to
1061 ;; XLFD (X Logical Font Description). All fields in XLFD from FOUNDRY
1062 ;; to ADSTYLE, REGISTRY, and ENCODING should be not be omitted (but
1063 ;; can be a wild card) to be matched.
1064 (defconst xlfd-style-regexp
1066 -\\([^-]*-[^-]*\\)-\\([^-]*\\)-\\([^-]*\\)-\\([^-]*\\)-\\([^-]*\\)-.*\
1067 -\\([^-]*-[^-]*\\)$")
1069 ;; List of field numbers of XLFD whose values are numeric.
1070 (defconst xlfd-regexp-numeric-subnums
1071 (list xlfd-regexp-pixelsize-subnum
;5
1072 xlfd-regexp-pointsize-subnum
;6
1073 xlfd-regexp-resx-subnum
;7
1074 xlfd-regexp-resy-subnum
;8
1075 xlfd-regexp-avgwidth-subnum
;10
1078 (defun x-decompose-font-name (pattern)
1079 "Decompose PATTERN into XLFD fields and return a vector of the fields.
1080 The length of the vector is 12.
1081 The FOUNDRY and FAMILY fields are concatenated and stored in the first
1082 element of the vector.
1083 The REGISTRY and ENCODING fields are concatenated and stored in the last
1084 element of the vector.
1086 Return nil if PATTERN doesn't conform to XLFD."
1087 (if (string-match xlfd-tight-regexp pattern
)
1088 (let ((xlfd-fields (make-vector 12 nil
)))
1090 (aset xlfd-fields i
(match-string (1+ i
) pattern
)))
1092 (if (string-match "^[*-]+$" (aref xlfd-fields i
))
1093 (aset xlfd-fields i nil
)))
1096 (defun x-compose-font-name (fields &optional _reduce
)
1097 "Compose X fontname from FIELDS.
1098 FIELDS is a vector of XLFD fields, of length 12.
1099 If a field is nil, wild-card letter `*' is embedded.
1100 Optional argument REDUCE exists just for backward compatibility,
1101 and is always ignored."
1102 (concat "-" (mapconcat (lambda (x) (or x
"*")) fields
"-")))
1105 (defun x-must-resolve-font-name (xlfd-fields)
1106 "Like `x-resolve-font-name', but always return a font name.
1107 XLFD-FIELDS is a vector of XLFD (X Logical Font Description) fields.
1108 If no font matching XLFD-FIELDS is available, successively replace
1109 parts of the font name pattern with \"*\" until some font is found.
1110 Value is name of that font."
1111 (let ((ascii-font nil
) (index 0))
1112 (while (and (null ascii-font
) (<= index xlfd-regexp-registry-subnum
))
1113 (let ((pattern (x-compose-font-name xlfd-fields
)))
1115 (setq ascii-font
(x-resolve-font-name pattern
))
1117 (message "Warning: no fonts matching `%s' available" pattern
)
1118 (aset xlfd-fields index
"*")
1119 (setq index
(1+ index
))))))
1121 (error "No fonts found"))
1125 (defun x-complement-fontset-spec (default-spec fontlist
)
1126 "Complement elements of FONTLIST based on DEFAULT-SPEC.
1127 DEFAULT-SPEC is a font-spec object providing default font properties.
1128 FONTLIST is an alist of script names vs the corresponding font names.
1130 The font names are parsed and unspecified font properties are
1131 given from DEFAULT-SPEC."
1132 (let ((prop-list '(:foundry
:family
:weight
:slant
:width
:adstyle
:size
)))
1133 (dolist (elt fontlist
)
1134 (let ((spec (font-spec :name
(cadr elt
))))
1135 (dolist (prop prop-list
)
1136 (let ((val (font-get spec prop
)))
1138 (font-put spec prop
(font-get default-spec prop
)))))
1139 (setcar (cdr elt
) spec
)))
1142 (defun fontset-name-p (fontset)
1143 "Return non-nil if FONTSET is valid as fontset name.
1144 A valid fontset name should conform to XLFD (X Logical Font Description)
1145 with \"fontset\" in `<CHARSET_REGISTRY>' field."
1146 (and (string-match xlfd-tight-regexp fontset
)
1147 (string= (match-string (1+ xlfd-regexp-registry-subnum
) fontset
)
1150 (declare-function fontset-list
"fontset.c" ())
1152 (defun generate-fontset-menu ()
1153 "Return list to be appended to `x-fixed-font-alist'.
1154 Done when `mouse-set-font' is called."
1156 (dolist (fontset (fontset-list))
1157 (or (string-match "fontset-default$" fontset
)
1158 (string-match "fontset-auto[0-9]+$" fontset
)
1159 (push (list (fontset-plain-name fontset
) fontset
) l
)))
1161 (sort l
#'(lambda (x y
) (string< (car x
) (car y
)))))))
1163 (declare-function query-fontset
"fontset.c" (pattern &optional regexpp
))
1165 (defun fontset-plain-name (fontset)
1166 "Return a plain and descriptive name of FONTSET."
1167 (if (not (setq fontset
(query-fontset fontset
)))
1168 (error "Invalid fontset: %s" fontset
))
1169 (let ((xlfd-fields (x-decompose-font-name fontset
)))
1171 (let ((family (aref xlfd-fields xlfd-regexp-family-subnum
))
1172 (weight (aref xlfd-fields xlfd-regexp-weight-subnum
))
1173 (slant (aref xlfd-fields xlfd-regexp-slant-subnum
))
1174 ;(swidth (aref xlfd-fields xlfd-regexp-swidth-subnum))
1175 (size (aref xlfd-fields xlfd-regexp-pixelsize-subnum
))
1176 (nickname (aref xlfd-fields xlfd-regexp-registry-subnum
))
1178 (if (not (string-match "^fontset-\\(.*\\)$" nickname
))
1179 (setq nickname family
)
1180 (setq nickname
(match-string 1 nickname
)))
1181 (if (and size
(> (string-to-number size
) 0))
1182 (setq name
(format "%s: %s-dot" nickname size
))
1183 (setq name nickname
))
1185 (cond ((string-match "^medium$" weight
)
1186 (setq name
(concat name
" " "medium")))
1187 ((string-match "^bold$\\|^demibold$" weight
)
1188 (setq name
(concat name
" " weight
)))))
1190 (cond ((string-match "^i$" slant
)
1191 (setq name
(concat name
" " "italic")))
1192 ((string-match "^o$" slant
)
1193 (setq name
(concat name
" " "slant")))
1194 ((string-match "^ri$" slant
)
1195 (setq name
(concat name
" " "reverse italic")))
1196 ((string-match "^ro$" slant
)
1197 (setq name
(concat name
" " "reverse slant")))))
1201 (defvar charset-script-alist
1203 (latin-iso8859-1 . latin
)
1204 (latin-iso8859-2 . latin
)
1205 (latin-iso8859-3 . latin
)
1206 (latin-iso8859-4 . latin
)
1207 (latin-iso8859-9 . latin
)
1208 (latin-iso8859-10 . latin
)
1209 (latin-iso8859-13 . latin
)
1210 (latin-iso8859-14 . latin
)
1211 (latin-iso8859-15 . latin
)
1212 (latin-iso8859-16 . latin
)
1213 (latin-jisx0201 . latin
)
1214 (thai-tis620 . thai
)
1215 (cyrillic-iso8859-5 . cyrillic
)
1216 (arabic-iso8859-6 . arabic
)
1217 (greek-iso8859-7 . latin
)
1218 (hebrew-iso8859-8 . latin
)
1219 (katakana-jisx0201 . kana
)
1220 (chinese-gb2312 . han
)
1222 (gb18030-2-byte . han
)
1223 (gb18030-4-byte-bmp . han
)
1224 (gb18030-4-byte-ext-1 . han
)
1225 (gb18030-4-byte-ext-2 . han
)
1226 (gb18030-4-byte-smp . han
)
1227 (chinese-big5-1 . han
)
1228 (chinese-big5-2 . han
)
1229 (chinese-cns11643-1 . han
)
1230 (chinese-cns11643-2 . han
)
1231 (chinese-cns11643-3 . han
)
1232 (chinese-cns11643-4 . han
)
1233 (chinese-cns11643-5 . han
)
1234 (chinese-cns11643-6 . han
)
1235 (chinese-cns11643-7 . han
)
1236 (japanese-jisx0208 . han
)
1237 (japanese-jisx0208-1978 . han
)
1238 (japanese-jisx0212 . han
)
1239 (japanese-jisx0213-1 . han
)
1240 (japanese-jisx0213-2 . han
)
1241 (korean-ksc5601 . hangul
)
1242 (chinese-sisheng . bopomofo
)
1243 (vietnamese-viscii-lower . latin
)
1244 (vietnamese-viscii-upper . latin
)
1245 (arabic-digit . arabic
)
1246 (arabic-1-column . arabic
)
1247 (arabic-2-column . arabic
)
1248 (indian-is13194 . devanagari
)
1249 (indian-glyph . devanagari
)
1250 (indian-1-column . devanagari
)
1251 (indian-2-column . devanagari
)
1252 (tibetan-1-column . tibetan
))
1253 "Alist of charsets vs the corresponding most appropriate scripts.
1255 This alist is used by the function `create-fontset-from-fontset-spec'
1256 to map charsets to scripts.")
1258 (defun create-fontset-from-fontset-spec (fontset-spec
1259 &optional _style-variant _noerror
)
1260 "Create a fontset from fontset specification string FONTSET-SPEC.
1261 FONTSET-SPEC is a string of the format:
1262 FONTSET-NAME[,SCRIPT-NAME0:FONT-NAME0,SCRIPT-NAME1:FONT-NAME1] ...
1263 Any number of SPACE, TAB, and NEWLINE can be put before and after commas.
1265 When a frame uses the fontset as the `font' parameter, the frame's
1266 default font name is derived from FONTSET-NAME by substituting
1267 \"iso8859-1\" for the tail part \"fontset-XXX\". But, if SCRIPT-NAMEn
1268 is \"ascii\", use the corresponding FONT-NAMEn as the default font
1271 Optional 2nd and 3rd arguments exist just for backward compatibility,
1274 It returns a name of the created fontset.
1276 For backward compatibility, SCRIPT-NAME may be a charset name, in
1277 which case, the corresponding script is decided by the variable
1278 `charset-script-alist' (which see)."
1279 (or (string-match "^[^,]+" fontset-spec
)
1280 (error "Invalid fontset spec: %s" fontset-spec
))
1281 (let ((idx (match-end 0))
1282 (name (match-string 0 fontset-spec
))
1283 default-spec target script fontlist
)
1284 (or (string-match xlfd-tight-regexp name
)
1285 (error "Fontset name \"%s\" not conforming to XLFD" name
))
1286 (setq default-spec
(font-spec :name name
))
1287 ;; At first, extract pairs of charset and fontname from FONTSET-SPEC.
1288 (while (string-match "[, \t\n]*\\([^:]+\\):[ \t]*\\([^,]+\\)"
1290 (setq idx
(match-end 0))
1291 (setq target
(intern (match-string 1 fontset-spec
)))
1292 (cond ((or (eq target
'ascii
)
1293 (memq target
(char-table-extra-slot char-script-table
0)))
1294 (push (list target
(match-string 2 fontset-spec
)) fontlist
))
1295 ((setq script
(cdr (assq target charset-script-alist
)))
1296 (push (list script
(match-string 2 fontset-spec
)) fontlist
))
1298 (push (list target
(match-string 2 fontset-spec
)) fontlist
))))
1300 ;; Complement FONTLIST.
1301 (setq fontlist
(x-complement-fontset-spec default-spec fontlist
))
1303 ;; Create a fontset.
1304 (new-fontset name
(nreverse fontlist
))))
1306 (defun create-fontset-from-ascii-font (font &optional resolved-font
1308 "Create a fontset from an ASCII font FONT.
1310 Optional 2nd arg RESOLVED-FONT is a resolved name of FONT.
1311 If omitted, `x-resolve-font-name' is called to get the resolved name.
1312 At this time, if FONT is not available, an error is signaled.
1314 Optional 3rd arg FONTSET-NAME is a string to be used in
1315 `<CHARSET_ENCODING>' fields of a new fontset name. If it is omitted,
1316 an appropriate name is generated automatically.
1318 It returns a name of the created fontset."
1319 (setq font
(downcase font
))
1321 (downcase (or resolved-font
(x-resolve-font-name font
))))
1322 (let ((xlfd (x-decompose-font-name resolved-font
))
1325 (setq fontset-name
(downcase fontset-name
))
1326 (if (query-fontset "fontset-startup")
1328 (subst-char-in-string
1329 ?- ?_
(aref xlfd xlfd-regexp-registry-subnum
) t
))
1330 (setq fontset-name
"startup")))
1331 (aset xlfd xlfd-regexp-registry-subnum
1332 (format "fontset-%s" fontset-name
))
1333 (setq fontset
(x-compose-font-name xlfd
))
1334 (or (query-fontset fontset
)
1335 (create-fontset-from-fontset-spec (concat fontset
", ascii:" font
)))))
1338 ;; Create standard fontset from 16 dots fonts which are the most widely
1339 ;; installed fonts. Fonts for Chinese-GB, Korean, and Chinese-CNS are
1340 ;; specified here because FAMILY of those fonts are not "fixed" in
1342 (defvar standard-fontset-spec
1343 (purecopy "-*-fixed-medium-r-normal-*-16-*-*-*-*-*-fontset-standard")
1344 "String of fontset spec of the standard fontset.
1345 You have the biggest chance to display international characters
1346 with correct glyphs by using the standard fontset.
1347 See the documentation of `create-fontset-from-fontset-spec' for the format.")
1350 ;; Create fontsets from X resources of the name `fontset-N (class
1351 ;; Fontset-N)' where N is integer 0, 1, ...
1352 ;; The values of the resources the string of the same format as
1353 ;; `standard-fontset-spec'.
1355 (declare-function x-get-resource
"frame.c"
1356 (attribute class
&optional component subclass
))
1358 (defun create-fontset-from-x-resource ()
1361 (while (setq fontset-spec
(x-get-resource (format "fontset-%d" idx
)
1362 (format "Fontset-%d" idx
)))
1364 (create-fontset-from-fontset-spec fontset-spec t
)
1365 (error (display-warning
1367 (format "Fontset-%d: invalid specification in X resource" idx
)
1369 (setq idx
(1+ idx
)))))
1374 ;;; fontset.el ends here