Mercurial > emacs
annotate lisp/international/fontset.el @ 90023:46eb9a242d5d
(get_next_display_element): In unibyte case, decide to
display in octal form by checking a chacter by
UNIBYTE_CHAR_HAS_MULTIBYTE_P.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Fri, 15 Oct 2004 02:12:58 +0000 |
parents | 0c0b009323eb |
children | 4a0f91659a65 |
rev | line source |
---|---|
38414
67b464da13ec
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
36368
diff
changeset
|
1 ;;; fontset.el --- commands for handling fontset |
17052 | 2 |
18377
8b4a66c66dd6
Change copyright notice.
Richard M. Stallman <rms@gnu.org>
parents:
18350
diff
changeset
|
3 ;; Copyright (C) 1995, 1997 Electrotechnical Laboratory, JAPAN. |
89483 | 4 ;; Licensed to the Free Software Foundation. |
40250
4f3033e5b688
(x-must-resolve-font-name): New
Gerd Moellmann <gerd@gnu.org>
parents:
38414
diff
changeset
|
5 ;; Copyright (C) 2001 Free Software Foundation, Inc. |
89483 | 6 ;; Copyright (C) 2003 |
7 ;; National Institute of Advanced Industrial Science and Technology (AIST) | |
8 ;; Registration Number H13PRO009 | |
17052 | 9 |
89274 | 10 ;; Keywords: mule, i18n, fontset |
17052 | 11 |
12 ;; This file is part of GNU Emacs. | |
13 | |
14 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
15 ;; it under the terms of the GNU General Public License as published by | |
16 ;; the Free Software Foundation; either version 2, or (at your option) | |
17 ;; any later version. | |
18 | |
19 ;; GNU Emacs is distributed in the hope that it will be useful, | |
20 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
21 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
22 ;; GNU General Public License for more details. | |
23 | |
24 ;; You should have received a copy of the GNU General Public License | |
17071 | 25 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
26 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
27 ;; Boston, MA 02111-1307, USA. | |
17052 | 28 |
38414
67b464da13ec
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
36368
diff
changeset
|
29 ;;; Commentary: |
67b464da13ec
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
36368
diff
changeset
|
30 |
17052 | 31 ;;; Code: |
32 | |
88893
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
33 ;; Setup font-encoding-alist for all known encodings. |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
34 |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
35 (setq font-encoding-alist |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
36 '(("iso8859-1$" . iso-8859-1) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
37 ("iso8859-2$" . iso-8859-2) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
38 ("iso8859-3$" . iso-8859-3) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
39 ("iso8859-4$" . iso-8859-4) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
40 ("iso8859-5$" . iso-8859-5) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
41 ("iso8859-6$" . iso-8859-6) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
42 ("iso8859-7$" . iso-8859-7) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
43 ("iso8859-8$" . iso-8859-8) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
44 ("iso8859-9$" . iso-8859-9) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
45 ("iso8859-10$" . iso-8859-10) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
46 ("iso8859-11$" . iso-8859-11) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
47 ("iso8859-13$" . iso-8859-13) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
48 ("iso8859-14$" . iso-8859-14) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
49 ("iso8859-15$" . iso-8859-15) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
50 ("gb2312.1980" . chinese-gb2312) |
90005
0c0b009323eb
(font-encoding-alist): Add gbk.
Kenichi Handa <handa@m17n.org>
parents:
89909
diff
changeset
|
51 ("gbk" . chinese-gbk) |
88893
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
52 ("jisx0208.1978" . japanese-jisx0208-1978) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
53 ("jisx0208" . japanese-jisx0208) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
54 ("jisx0201" . jisx0201) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
55 ("jisx0212" . japanese-jisx0212) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
56 ("ksc5601.1987" . korean-ksc5601) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
57 ("cns11643.1992.*1" . chinese-cns11643-1) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
58 ("cns11643.1992.*2" . chinese-cns11643-2) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
59 ("cns11643.1992.*3" . chinese-cns11643-3) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
60 ("cns11643.1992.*4" . chinese-cns11643-4) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
61 ("cns11643.1992.*5" . chinese-cns11643-5) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
62 ("cns11643.1992.*6" . chinese-cns11643-6) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
63 ("cns11643.1992.*7" . chinese-cns11643-7) |
89809
c03a2732d0fd
(font-encoding-alist): Add entries for
Kenichi Handa <handa@m17n.org>
parents:
89806
diff
changeset
|
64 ("cns11643.92p1-0" . chinese-cns11643-1) |
c03a2732d0fd
(font-encoding-alist): Add entries for
Kenichi Handa <handa@m17n.org>
parents:
89806
diff
changeset
|
65 ("cns11643.92p2-0" . chinese-cns11643-2) |
c03a2732d0fd
(font-encoding-alist): Add entries for
Kenichi Handa <handa@m17n.org>
parents:
89806
diff
changeset
|
66 ("cns11643.92p3-0" . chinese-cns11643-3) |
c03a2732d0fd
(font-encoding-alist): Add entries for
Kenichi Handa <handa@m17n.org>
parents:
89806
diff
changeset
|
67 ("cns11643.92p4-0" . chinese-cns11643-4) |
c03a2732d0fd
(font-encoding-alist): Add entries for
Kenichi Handa <handa@m17n.org>
parents:
89806
diff
changeset
|
68 ("cns11643.92p5-0" . chinese-cns11643-5) |
c03a2732d0fd
(font-encoding-alist): Add entries for
Kenichi Handa <handa@m17n.org>
parents:
89806
diff
changeset
|
69 ("cns11643.92p6-0" . chinese-cns11643-6) |
c03a2732d0fd
(font-encoding-alist): Add entries for
Kenichi Handa <handa@m17n.org>
parents:
89806
diff
changeset
|
70 ("cns11643.92p7-0" . chinese-cns11643-7) |
88893
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
71 ("big5" . big5) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
72 ("sisheng_cwnn" . chinese-sisheng) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
73 ("viscii" . viscii) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
74 ("tis620" . tis620-2533) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
75 ("mulearabic-0" . arabic-digit) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
76 ("mulearabic-1" . arabic-1-column) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
77 ("mulearabic-2" . arabic-2-column) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
78 ("muleipa" . ipa) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
79 ("ethiopic-unicode" . ethiopic) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
80 ("is13194-devanagari" . indian-is13194) |
89483 | 81 ("Devanagari-CDAC" . devanagari-cdac) |
82 ("Sanskrit-CDAC" . sanskrit-cdac) | |
83 ("Bengali-CDAC" . bengali-cdac) | |
84 ("Assamese-CDAC" . assamese-cdac) | |
85 ("Punjabi-CDAC" . punjabi-cdac) | |
86 ("Gujarati-CDAC" . gujarati-cdac) | |
87 ("Oriya-CDAC" . oriya-cdac) | |
88 ("Tamil-CDAC" . tamil-cdac) | |
89 ("Telugu-CDAC" . telugu-cdac) | |
90 ("Kannada-CDAC" . kannada-cdac) | |
91 ("Malayalam-CDAC" . malayalam-cdac) | |
92 ("Devanagari-Akruti" . devanagari-akruti) | |
93 ("Bengali-Akruti" . bengali-akruti) | |
94 ("Punjabi-Akruti" . punjabi-akruti) | |
95 ("Gujarati-Akruti" . gujarati-akruti) | |
96 ("Oriya-Akruti" . oriya-akruti) | |
97 ("Tamil-Akruti" . tamil-akruti) | |
98 ("Telugu-Akruti" . telugu-akruti) | |
99 ("Kannada-Akruti" . kannada-akruti) | |
100 ("Malayalam-Akruti" . malayalam-akruti) | |
88893
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
101 ("muleindian-2" . indian-2-column) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
102 ("muleindian-1" . indian-1-column) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
103 ("mulelao-1" . mule-lao) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
104 ("muletibetan-2" . tibetan) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
105 ("muletibetan-1" . tibetan-1-column) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
106 ("jisx0213.2000-1" . japanese-jisx0213-1) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
107 ("jisx0213.2000-2" . japanese-jisx0213-2) |
89802
16421a824d49
(font-encoding-alist): Register "JISX0213.2004-1".
Kenichi Handa <handa@m17n.org>
parents:
89800
diff
changeset
|
108 ("jisx0213.2004-1" . japanese-jisx0213.2004-1) |
88893
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
109 ("abobe-symbol" . symbol) |
89825
513b9f207900
(font-encoding-alist): Register "iso10646-2" for unicode-sip.
Kenichi Handa <handa@m17n.org>
parents:
89809
diff
changeset
|
110 ("iso10646-1$" . (unicode-bmp . nil)) |
513b9f207900
(font-encoding-alist): Register "iso10646-2" for unicode-sip.
Kenichi Handa <handa@m17n.org>
parents:
89809
diff
changeset
|
111 ("iso10646.indian-1" . (unicode-bmp . nil)))) |
88893
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
112 |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
113 |
29234
c9a5f356fe77
Set family names of non-latin charsets in default fontset to "*".
Kenichi Handa <handa@m17n.org>
parents:
29168
diff
changeset
|
114 ;; Set standard fontname specification of characters in the default |
88893
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
115 ;; fontset to find an appropriate font for each script/charset. The |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
116 ;; specification has the form ((SCRIPT FONT-SPEC ...) ...), where |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
117 ;; FONT-SPEC is: |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
118 ;; a vector [ FAMILY WEIGHT SLANT ADSTYLE REGISTRY ], |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
119 ;; or a cons (FAMILY . REGISTRY), |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
120 ;; or a string FONT-NAME. |
89483 | 121 ;; |
88893
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
122 ;; FAMILY, WEIGHT, SLANT, and ADSTYLE may be nil, in which case, the |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
123 ;; the corresponding name of default face is used. If REGISTRY |
29234
c9a5f356fe77
Set family names of non-latin charsets in default fontset to "*".
Kenichi Handa <handa@m17n.org>
parents:
29168
diff
changeset
|
124 ;; contains a character `-', the string before that is embedded in |
c9a5f356fe77
Set family names of non-latin charsets in default fontset to "*".
Kenichi Handa <handa@m17n.org>
parents:
29168
diff
changeset
|
125 ;; `CHARSET_REGISTRY' field, and the string after that is embedded in |
c9a5f356fe77
Set family names of non-latin charsets in default fontset to "*".
Kenichi Handa <handa@m17n.org>
parents:
29168
diff
changeset
|
126 ;; `CHARSET_ENCODING' field. If it does not contain `-', the whole |
c9a5f356fe77
Set family names of non-latin charsets in default fontset to "*".
Kenichi Handa <handa@m17n.org>
parents:
29168
diff
changeset
|
127 ;; string is embedded in `CHARSET_REGISTRY' field, and a wild card |
88893
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
128 ;; character `*' is embedded in `CHARSET_ENCODING' field. |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
129 ;; |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
130 ;; SCRIPT is a symbol that appears as an element of the char table |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
131 ;; `char-script-table'. SCRIPT may be a charset specifying the range |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
132 ;; of characters. |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
133 |
49287
5cb7e7103296
Don't setup the default fontset and
Kenichi Handa <handa@m17n.org>
parents:
47711
diff
changeset
|
134 (defun setup-default-fontset () |
5cb7e7103296
Don't setup the default fontset and
Kenichi Handa <handa@m17n.org>
parents:
47711
diff
changeset
|
135 "Setup the default fontset." |
89483 | 136 (new-fontset |
137 "fontset-default" | |
138 '(;; for each script | |
139 (latin (nil . "ISO8859-1") | |
140 (nil . "ISO8859-2") | |
141 (nil . "ISO8859-3") | |
142 (nil . "ISO8859-4") | |
143 (nil . "ISO8859-9") | |
144 (nil . "ISO8859-10") | |
145 (nil . "ISO8859-13") | |
146 (nil . "ISO8859-14") | |
147 (nil . "ISO8859-15") | |
148 (nil . "VISCII1.1-1")) | |
88893
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
149 |
89483 | 150 (thai (nil . "TIS620*") |
151 (nil . "ISO8859-11")) | |
152 | |
153 (devanagari (nil . "iso10646.indian-1")) | |
154 | |
155 (lao (nil . "MuleLao-1")) | |
88893
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
156 |
89483 | 157 ;; both for script and charset. |
158 (tibetan (nil . "muletibetan-2")) | |
89258
b6c2beacc874
("fontset-default"): Add an entry for
Kenichi Handa <handa@m17n.org>
parents:
89143
diff
changeset
|
159 |
89483 | 160 ;; both for script and charset. |
161 (ethiopic (nil . "ethiopic-unicode")) | |
162 | |
163 (greek (nil . "ISO8859-7")) | |
88893
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
164 |
89483 | 165 (cyrillic (nil . "ISO8859-5")) |
166 | |
167 (arabic (nil . "MuleArabic-0") | |
168 (nil . "MuleArabic-1") | |
169 (nil . "MuleArabic-2") | |
170 (nil . "ISO8859-6")) | |
88893
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
171 |
89483 | 172 (hebrew (nil . "ISO8859-8")) |
88893
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
173 |
89483 | 174 (kana (nil . "JISX0208*") |
175 (nil . "GB2312.1980-0") | |
176 (nil . "KSC5601.1987*") | |
89806
960bd3cc1872
(setup-default-fontset): Delete the
Kenichi Handa <handa@m17n.org>
parents:
89802
diff
changeset
|
177 (nil . "JISX0201*") |
960bd3cc1872
(setup-default-fontset): Delete the
Kenichi Handa <handa@m17n.org>
parents:
89802
diff
changeset
|
178 (nil . "JISX0213.2000-1") |
960bd3cc1872
(setup-default-fontset): Delete the
Kenichi Handa <handa@m17n.org>
parents:
89802
diff
changeset
|
179 (nil . "JISX0213.2004-1")) |
88893
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
180 |
89483 | 181 (bopomofo (nil . "sisheng_cwnn-0")) |
88893
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
182 |
89483 | 183 (han (nil . "GB2312.1980-0") |
184 (nil . "JISX0208*") | |
185 (nil . "JISX0212*") | |
186 (nil . "big5*") | |
187 (nil . "KSC5601.1987*") | |
188 (nil . "CNS11643.1992-1") | |
189 (nil . "CNS11643.1992-2") | |
190 (nil . "CNS11643.1992-3") | |
191 (nil . "CNS11643.1992-4") | |
192 (nil . "CNS11643.1992-5") | |
193 (nil . "CNS11643.1992-6") | |
194 (nil . "CNS11643.1992-7") | |
195 (nil . "gbk-0") | |
196 (nil . "JISX0213.2000-1") | |
89800
6458a4233000
(setup-default-fontset): Register "JISX0213.2004-1".
Kenichi Handa <handa@m17n.org>
parents:
89636
diff
changeset
|
197 (nil . "JISX0213.2000-2") |
6458a4233000
(setup-default-fontset): Register "JISX0213.2004-1".
Kenichi Handa <handa@m17n.org>
parents:
89636
diff
changeset
|
198 (nil . "JISX0213.2004-1")) |
17052 | 199 |
89483 | 200 (cjk-misc (nil . "GB2312.1980-0") |
201 (nil . "JISX0208*") | |
202 (nil . "JISX0212*") | |
203 (nil . "big5*") | |
204 (nil . "KSC5601.1987*") | |
205 (nil . "CNS11643.1992-1") | |
206 (nil . "CNS11643.1992-2") | |
207 (nil . "CNS11643.1992-3") | |
208 (nil . "CNS11643.1992-4") | |
209 (nil . "CNS11643.1992-5") | |
210 (nil . "CNS11643.1992-6") | |
211 (nil . "CNS11643.1992-7") | |
212 (nil . "gbk-0") | |
213 (nil . "JISX0213.2000-1") | |
214 (nil . "JISX0213.2000-2")) | |
88405 | 215 |
89483 | 216 (hangul (nil . "KSC5601.1987-0")) |
88893
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
217 |
89483 | 218 ;; for each charset |
219 (ascii (nil . "ISO8859-1")) | |
220 (arabic-digit ("*" . "MuleArabic-0")) | |
221 (arabic-1-column ("*" . "MuleArabic-1")) | |
222 (arabic-2-column ("*" . "MuleArabic-2")) | |
223 (indian-is13194 (nil . "is13194-devanagari")) | |
224 (indian-1-column ("*" . "muleindian-2")) | |
225 ;; Indian CDAC | |
226 (devanagari-cdac (nil . "Devanagari-CDAC")) | |
227 (sanskrit-cdac (nil . "Sanskrit-CDAC")) | |
228 (bengali-cdac (nil . "Bengali-CDAC")) | |
229 (assamese-cdac (nil . "Assamese-CDAC")) | |
230 (punjabi-cdac (nil . "Punjabi-CDAC")) | |
231 (gujarati-cdac (nil . "Gujarati-CDAC")) | |
232 (oriya-cdac (nil . "Oriya-CDAC")) | |
233 (tamil-cdac (nil . "Tamil-CDAC")) | |
234 (telugu-cdac (nil . "Telugu-CDAC")) | |
235 (kannada-cdac (nil . "Kannada-CDAC")) | |
236 (malayalam-cdac (nil . "Malayalam-CDAC")) | |
237 ;; Indian AKRUTI | |
238 (devanagari-akruti (nil . "Devanagari-Akruti")) | |
239 (bengali-akruti (nil . "Bengali-Akruti")) | |
240 (punjabi-akruti (nil . "Punjabi-Akruti")) | |
241 (gujarati-akruti (nil . "Gujarati-Akruti")) | |
242 (oriya-akruti (nil . "Oriya-Akruti")) | |
243 (tamil-akruti (nil . "Tamil-Akruti")) | |
244 (telugu-akruti (nil . "Telugu-Akruti")) | |
245 (kannada-akruti (nil . "Kannada-Akruti")) | |
246 (malayalam-akruti (nil . "Malayalam-Akruti")) | |
247 ;;(devanagari-glyph ("altsys-dv_ttsurekh" . "devanagari-cdac")) | |
248 ;;(malayalam-glyph ("altsys-ml_ttkarthika" . "malayalam-cdac")) | |
249 (ipa (nil . "MuleIPA-1")) | |
89806
960bd3cc1872
(setup-default-fontset): Delete the
Kenichi Handa <handa@m17n.org>
parents:
89802
diff
changeset
|
250 |
960bd3cc1872
(setup-default-fontset): Delete the
Kenichi Handa <handa@m17n.org>
parents:
89802
diff
changeset
|
251 ;; Fallback fonts |
960bd3cc1872
(setup-default-fontset): Delete the
Kenichi Handa <handa@m17n.org>
parents:
89802
diff
changeset
|
252 (nil (nil . "gb2312.1980") |
960bd3cc1872
(setup-default-fontset): Delete the
Kenichi Handa <handa@m17n.org>
parents:
89802
diff
changeset
|
253 (nil . "jisx0208") |
960bd3cc1872
(setup-default-fontset): Delete the
Kenichi Handa <handa@m17n.org>
parents:
89802
diff
changeset
|
254 (nil . "ksc5601.1987") |
89809
c03a2732d0fd
(font-encoding-alist): Add entries for
Kenichi Handa <handa@m17n.org>
parents:
89806
diff
changeset
|
255 (nil . "CNS11643.1992-1") |
c03a2732d0fd
(font-encoding-alist): Add entries for
Kenichi Handa <handa@m17n.org>
parents:
89806
diff
changeset
|
256 (nil . "CNS11643.1992-2") |
c03a2732d0fd
(font-encoding-alist): Add entries for
Kenichi Handa <handa@m17n.org>
parents:
89806
diff
changeset
|
257 (nil . "CNS11643.1992-3") |
c03a2732d0fd
(font-encoding-alist): Add entries for
Kenichi Handa <handa@m17n.org>
parents:
89806
diff
changeset
|
258 (nil . "CNS11643.1992-4") |
c03a2732d0fd
(font-encoding-alist): Add entries for
Kenichi Handa <handa@m17n.org>
parents:
89806
diff
changeset
|
259 (nil . "CNS11643.1992-5") |
c03a2732d0fd
(font-encoding-alist): Add entries for
Kenichi Handa <handa@m17n.org>
parents:
89806
diff
changeset
|
260 (nil . "CNS11643.1992-6") |
c03a2732d0fd
(font-encoding-alist): Add entries for
Kenichi Handa <handa@m17n.org>
parents:
89806
diff
changeset
|
261 (nil . "CNS11643.1992-7") |
89806
960bd3cc1872
(setup-default-fontset): Delete the
Kenichi Handa <handa@m17n.org>
parents:
89802
diff
changeset
|
262 (nil . "big5") |
960bd3cc1872
(setup-default-fontset): Delete the
Kenichi Handa <handa@m17n.org>
parents:
89802
diff
changeset
|
263 (nil . "jisx0213.2000-1") |
960bd3cc1872
(setup-default-fontset): Delete the
Kenichi Handa <handa@m17n.org>
parents:
89802
diff
changeset
|
264 (nil . "jisx0213.2004-1") |
960bd3cc1872
(setup-default-fontset): Delete the
Kenichi Handa <handa@m17n.org>
parents:
89802
diff
changeset
|
265 (nil . "jisx0212")) |
89483 | 266 )) |
88893
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
267 |
89483 | 268 ;; Append Unicode fonts. |
269 ;; This may find fonts with more variants (bold, italic) but which | |
270 ;; don't cover many characters. | |
89806
960bd3cc1872
(setup-default-fontset): Delete the
Kenichi Handa <handa@m17n.org>
parents:
89802
diff
changeset
|
271 (set-fontset-font "fontset-default" nil |
89483 | 272 '(nil . "iso10646-1") nil 'append) |
273 ;; These may find fonts that cover many characters but with fewer | |
274 ;; variants. | |
89806
960bd3cc1872
(setup-default-fontset): Delete the
Kenichi Handa <handa@m17n.org>
parents:
89802
diff
changeset
|
275 (set-fontset-font "fontset-default" nil |
89483 | 276 '("gnu-unifont" . "iso10646-1") nil 'append) |
89806
960bd3cc1872
(setup-default-fontset): Delete the
Kenichi Handa <handa@m17n.org>
parents:
89802
diff
changeset
|
277 (set-fontset-font "fontset-default" nil |
89483 | 278 '("mutt-clearlyu" . "iso10646-1") nil 'append)) |
88893
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
279 |
89274 | 280 ;; These are the registered registries/encodings from |
281 ;; ftp://ftp.x.org/pub/DOCS/registry 2001/06/01 | |
17052 | 282 |
89274 | 283 ;; Name Reference |
284 ;; ---- --------- | |
285 ;; "DEC" [27] | |
286 ;; registry prefix | |
287 ;; "DEC.CNS11643.1986-2" [53] | |
288 ;; CNS11643 2-plane using the encoding | |
289 ;; suggested in that standard | |
290 ;; "DEC.DTSCS.1990-2" [54] | |
291 ;; DEC Taiwan Supplemental Character Set | |
292 ;; "fujitsu.u90x01.1991-0" [87] | |
293 ;; "fujitsu.u90x03.1991-0" [87] | |
294 ;; "GB2312.1980-0" [39],[12] | |
295 ;; China (PRC) Hanzi, GL encoding | |
296 ;; "GB2312.1980-1" [39] | |
297 ;; (deprecated) | |
298 ;; China (PRC) Hanzi, GR encoding | |
299 ;; "HP-Arabic8" [36] | |
300 ;; HPARABIC8 8-bit character set | |
301 ;; "HP-East8" [36] | |
302 ;; HPEAST8 8-bit character set | |
303 ;; "HP-Greek8" [36] | |
304 ;; HPGREEK8 8-bit character set | |
305 ;; "HP-Hebrew8" [36] | |
306 ;; HPHEBREW8 8-bit character set | |
307 ;; "HP-Japanese15" [36] | |
308 ;; HPJAPAN15 15-bit characer set, | |
309 ;; modified from industry defacto | |
310 ;; standard Shift-JIS | |
311 ;; "HP-Kana8" [36] | |
312 ;; HPKANA8 8-bit character set | |
313 ;; "HP-Korean15" [36] | |
314 ;; HPKOREAN15 15-bit character set | |
315 ;; "HP-Roman8" [36] | |
316 ;; HPROMAN8 8-bit character set | |
317 ;; "HP-SChinese15" [36] | |
318 ;; HPSCHINA15 15-bit character set for | |
319 ;; support of Simplified Chinese | |
320 ;; "HP-TChinese15" [36] | |
321 ;; HPTCHINA15 15-bit character set for | |
322 ;; support of Traditional Chinese | |
323 ;; "HP-Turkish8" [36] | |
324 ;; HPTURKISH8 8-bit character set | |
325 ;; "IPSYS" [59] | |
326 ;; registry prefix | |
327 ;; "IPSYS.IE-1" [59] | |
328 ;; "ISO2022"<REG>"-"<ENC> [44] | |
329 ;; "ISO646.1991-IRV" [107] | |
330 ;; ISO 646 International Reference Version | |
331 ;; "ISO8859-1" [15],[12] | |
332 ;; ISO Latin alphabet No. 1 | |
333 ;; "ISO8859-2" [15],[12] | |
334 ;; ISO Latin alphabet No. 2 | |
335 ;; "ISO8859-3" [15],[12] | |
336 ;; ISO Latin alphabet No. 3 | |
337 ;; "ISO8859-4" [15],[12] | |
338 ;; ISO Latin alphabet No. 4 | |
339 ;; "ISO8859-5" [15],[12] | |
340 ;; ISO Latin/Cyrillic alphabet | |
341 ;; "ISO8859-6" [15],[12] | |
342 ;; ISO Latin/Arabic alphabet | |
343 ;; "ISO8859-7" [15],[12] | |
344 ;; ISO Latin/Greek alphabet | |
345 ;; "ISO8859-8" [15],[12] | |
346 ;; ISO Latin/Hebrew alphabet | |
347 ;; "ISO8859-9" [15],[12] | |
348 ;; ISO Latin alphabet No. 5 | |
349 ;; "ISO8859-10" [15],[12] | |
350 ;; ISO Latin alphabet No. 6 | |
351 ;; "ISO8859-13" [15],[12] | |
352 ;; ISO Latin alphabet No. 7 | |
353 ;; "ISO8859-14" [15],[12] | |
354 ;; ISO Latin alphabet No. 8 | |
355 ;; "ISO8859-15" [15],[12] | |
356 ;; ISO Latin alphabet No. 9 | |
357 ;; "FCD8859-15" [7] | |
358 ;; (deprecated) | |
359 ;; ISO Latin alphabet No. 9, Final Committee Draft | |
360 ;; "ISO10646-1" [133] | |
361 ;; Unicode Universal Multiple-Octet Coded Character Set | |
362 ;; "ISO10646-MES" [133] | |
363 ;; (deprecated) | |
364 ;; Unicode Minimum European Subset | |
365 ;; "JISX0201.1976-0" [38],[12] | |
366 ;; 8-Bit Alphanumeric-Katakana Code | |
367 ;; "JISX0208.1983-0" [40],[12] | |
368 ;; Japanese Graphic Character Set, | |
369 ;; GL encoding | |
370 ;; "JISX0208.1990-0" [71] | |
371 ;; Japanese Graphic Character Set, | |
372 ;; GL encoding | |
373 ;; "JISX0208.1983-1" [40] | |
374 ;; (deprecated) | |
375 ;; Japanese Graphic Character Set, | |
376 ;; GR encoding | |
377 ;; "JISX0212.1990-0" [72] | |
378 ;; Supplementary Japanese Graphic Character Set, | |
379 ;; GL encoding | |
380 ;; "KOI8-R" [119] | |
381 ;; Cyrillic alphabet | |
382 ;; "KSC5601.1987-0" [41],[12] | |
383 ;; Korean Graphic Character Set, | |
384 ;; GL encoding | |
385 ;; "KSC5601.1987-1" [41] | |
386 ;; (deprecated) | |
387 ;; Korean Graphic Character Set, | |
388 ;; GR encoding | |
389 ;; "omron_CNS11643-0" [45] | |
390 ;; "omron_CNS11643-1" [45] | |
391 ;; "omron_BIG5-0" [45] | |
392 ;; "omron_BIG5-1" [45] | |
393 ;; "wn.tamil.1993" [103] | |
394 | |
88405 | 395 (defun set-font-encoding (pattern charset) |
89274 | 396 "Set arguments in `font-encoding-alist' (which see)." |
17052 | 397 (let ((slot (assoc pattern font-encoding-alist))) |
398 (if slot | |
88405 | 399 (setcdr slot charset) |
17052 | 400 (setq font-encoding-alist |
88405 | 401 (cons (cons pattern charset) font-encoding-alist))))) |
32646
43edadfecb51
Use registry "MuleTibetan-2" for Tibetan.
Kenichi Handa <handa@m17n.org>
parents:
29427
diff
changeset
|
402 |
17052 | 403 ;; Setting for suppressing XLoadQueryFont on big fonts. |
404 (setq x-pixel-size-width-font-regexp | |
405 "gb2312\\|jisx0208\\|ksc5601\\|cns11643\\|big5") | |
406 | |
28215
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
407 ;; These fonts require vertical centering. |
26886
8a6d8101919e
(vertical-centering-font-regexp): New
Kenichi Handa <handa@m17n.org>
parents:
26013
diff
changeset
|
408 (setq vertical-centering-font-regexp |
28215
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
409 "gb2312\\|jisx0208\\|jisx0212\\|ksc5601\\|cns11643\\|big5") |
26886
8a6d8101919e
(vertical-centering-font-regexp): New
Kenichi Handa <handa@m17n.org>
parents:
26013
diff
changeset
|
410 |
89409 | 411 ;; CDAC fonts are actually smaller than their design sizes. |
412 (setq face-font-rescale-alist | |
413 '(("-cdac$" . 1.3))) | |
89258
b6c2beacc874
("fontset-default"): Add an entry for
Kenichi Handa <handa@m17n.org>
parents:
89143
diff
changeset
|
414 |
88405 | 415 (defvar x-font-name-charset-alist nil |
416 "This variable has no meaning now. Just kept for backward compatibility.") | |
22161
7a4c3fd89dda
(x-font-name-charset-alist): New
Kenichi Handa <handa@m17n.org>
parents:
22128
diff
changeset
|
417 |
17052 | 418 ;;; XLFD (X Logical Font Description) format handler. |
419 | |
420 ;; Define XLFD's field index numbers. ; field name | |
88405 | 421 (defconst xlfd-regexp-family-subnum 0) ; FOUNDRY and FAMILY |
422 (defconst xlfd-regexp-weight-subnum 1) ; WEIGHT_NAME | |
423 (defconst xlfd-regexp-slant-subnum 2) ; SLANT | |
424 (defconst xlfd-regexp-swidth-subnum 3) ; SETWIDTH_NAME | |
425 (defconst xlfd-regexp-adstyle-subnum 4) ; ADD_STYLE_NAME | |
426 (defconst xlfd-regexp-pixelsize-subnum 5) ; PIXEL_SIZE | |
427 (defconst xlfd-regexp-pointsize-subnum 6) ; POINT_SIZE | |
428 (defconst xlfd-regexp-resx-subnum 7) ; RESOLUTION_X | |
429 (defconst xlfd-regexp-resy-subnum 8) ; RESOLUTION_Y | |
430 (defconst xlfd-regexp-spacing-subnum 8) ; SPACING | |
431 (defconst xlfd-regexp-avgwidth-subnum 10) ; AVERAGE_WIDTH | |
432 (defconst xlfd-regexp-registry-subnum 11) ; REGISTRY and ENCODING | |
17052 | 433 |
434 ;; Regular expression matching against a fontname which conforms to | |
435 ;; XLFD (X Logical Font Description). All fields in XLFD should be | |
436 ;; not be omitted (but can be a wild card) to be matched. | |
437 (defconst xlfd-tight-regexp | |
438 "^\ | |
88405 | 439 -\\([^-]*-[^-]*\\)-\\([^-]*\\)-\\([^-]*\\)-\\([^-]*\\)\ |
17052 | 440 -\\([^-]*\\)-\\([^-]*\\)-\\([^-]*\\)-\\([^-]*\\)-\\([^-]*\\)\ |
88405 | 441 -\\([^-]*\\)-\\([^-]*\\)-\\([^-]*-[^-]*\\)$") |
442 | |
443 ;; Regular expression matching against a fontname which conforms to | |
444 ;; XLFD (X Logical Font Description). All fields in XLFD from FOUNDRY | |
89274 | 445 ;; to ADSTYLE, REGISTRY, and ENCODING should be not be omitted (but |
88405 | 446 ;; can be a wild card) to be matched. |
447 (defconst xlfd-style-regexp | |
448 "^\ | |
449 -\\([^-]*-[^-]*\\)-\\([^-]*\\)-\\([^-]*\\)-\\([^-]*\\)-\\([^-]*\\)-.*\ | |
450 -\\([^-]*-[^-]*\\)$") | |
17052 | 451 |
452 ;; List of field numbers of XLFD whose values are numeric. | |
453 (defconst xlfd-regexp-numeric-subnums | |
88405 | 454 (list xlfd-regexp-pixelsize-subnum ;5 |
455 xlfd-regexp-pointsize-subnum ;6 | |
456 xlfd-regexp-resx-subnum ;7 | |
457 xlfd-regexp-resy-subnum ;8 | |
458 xlfd-regexp-avgwidth-subnum ;10 | |
17052 | 459 )) |
460 | |
461 (defun x-decompose-font-name (pattern) | |
89357
8f8c7d4c2e6e
Enable the default fontset to use
Kenichi Handa <handa@m17n.org>
parents:
89325
diff
changeset
|
462 "Decompose PATTERN into XLFD fields and return a vector of the fields. |
88405 | 463 The length of the vector is 12. |
89357
8f8c7d4c2e6e
Enable the default fontset to use
Kenichi Handa <handa@m17n.org>
parents:
89325
diff
changeset
|
464 The FOUNDRY and FAMILY fields are concatinated and stored in the first |
8f8c7d4c2e6e
Enable the default fontset to use
Kenichi Handa <handa@m17n.org>
parents:
89325
diff
changeset
|
465 element of the vector. |
8f8c7d4c2e6e
Enable the default fontset to use
Kenichi Handa <handa@m17n.org>
parents:
89325
diff
changeset
|
466 The REGISTRY and ENCODING fields are concatinated and stored in the last |
8f8c7d4c2e6e
Enable the default fontset to use
Kenichi Handa <handa@m17n.org>
parents:
89325
diff
changeset
|
467 element of the vector. |
23890
fa4839661777
(x-decompose-font-name): If PATTERN
Kenichi Handa <handa@m17n.org>
parents:
23655
diff
changeset
|
468 |
89357
8f8c7d4c2e6e
Enable the default fontset to use
Kenichi Handa <handa@m17n.org>
parents:
89325
diff
changeset
|
469 Return nil if PATTERN doesn't conform to XLFD." |
8f8c7d4c2e6e
Enable the default fontset to use
Kenichi Handa <handa@m17n.org>
parents:
89325
diff
changeset
|
470 (if (string-match xlfd-tight-regexp pattern) |
8f8c7d4c2e6e
Enable the default fontset to use
Kenichi Handa <handa@m17n.org>
parents:
89325
diff
changeset
|
471 (let ((xlfd-fields (make-vector 12 nil))) |
8f8c7d4c2e6e
Enable the default fontset to use
Kenichi Handa <handa@m17n.org>
parents:
89325
diff
changeset
|
472 (dotimes (i 12) |
8f8c7d4c2e6e
Enable the default fontset to use
Kenichi Handa <handa@m17n.org>
parents:
89325
diff
changeset
|
473 (aset xlfd-fields i (match-string (1+ i) pattern))) |
8f8c7d4c2e6e
Enable the default fontset to use
Kenichi Handa <handa@m17n.org>
parents:
89325
diff
changeset
|
474 (dotimes (i 12) |
8f8c7d4c2e6e
Enable the default fontset to use
Kenichi Handa <handa@m17n.org>
parents:
89325
diff
changeset
|
475 (if (string-match "^[*-]+$" (aref xlfd-fields i)) |
8f8c7d4c2e6e
Enable the default fontset to use
Kenichi Handa <handa@m17n.org>
parents:
89325
diff
changeset
|
476 (aset xlfd-fields i nil))) |
8f8c7d4c2e6e
Enable the default fontset to use
Kenichi Handa <handa@m17n.org>
parents:
89325
diff
changeset
|
477 xlfd-fields))) |
17052 | 478 |
22449
c87830c691a5
(instantiate-fontset): Delete
Kenichi Handa <handa@m17n.org>
parents:
22161
diff
changeset
|
479 (defun x-compose-font-name (fields &optional reduce) |
89274 | 480 "Compose X fontname from FIELDS. |
88405 | 481 FIELDS is a vector of XLFD fields, the length 12. |
17177
9e550b522bc0
(x-charset-registries): Change entry for Ethiopic.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
482 If a field is nil, wild-card letter `*' is embedded. |
28215
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
483 Optional argument REDUCE is always ignored. It exists just for |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
484 backward compatibility." |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
485 (concat "-" (mapconcat (lambda (x) (or x "*")) fields "-"))) |
23205
22df54cdb841
(resolved-ascii-font): New variable.
Kenichi Handa <handa@m17n.org>
parents:
23196
diff
changeset
|
486 |
40250
4f3033e5b688
(x-must-resolve-font-name): New
Gerd Moellmann <gerd@gnu.org>
parents:
38414
diff
changeset
|
487 (defun x-must-resolve-font-name (xlfd-fields) |
4f3033e5b688
(x-must-resolve-font-name): New
Gerd Moellmann <gerd@gnu.org>
parents:
38414
diff
changeset
|
488 "Like `x-resolve-font-name', but always return a font name. |
4f3033e5b688
(x-must-resolve-font-name): New
Gerd Moellmann <gerd@gnu.org>
parents:
38414
diff
changeset
|
489 XLFD-FIELDS is a vector of XLFD (X Logical Font Description) fields. |
4f3033e5b688
(x-must-resolve-font-name): New
Gerd Moellmann <gerd@gnu.org>
parents:
38414
diff
changeset
|
490 If no font matching XLFD-FIELDS is available, successively replace |
4f3033e5b688
(x-must-resolve-font-name): New
Gerd Moellmann <gerd@gnu.org>
parents:
38414
diff
changeset
|
491 parts of the font name pattern with \"*\" until some font is found. |
4f3033e5b688
(x-must-resolve-font-name): New
Gerd Moellmann <gerd@gnu.org>
parents:
38414
diff
changeset
|
492 Value is name of that font." |
4f3033e5b688
(x-must-resolve-font-name): New
Gerd Moellmann <gerd@gnu.org>
parents:
38414
diff
changeset
|
493 (let ((ascii-font nil) (index 0)) |
88405 | 494 (while (and (null ascii-font) (<= index xlfd-regexp-registry-subnum)) |
40250
4f3033e5b688
(x-must-resolve-font-name): New
Gerd Moellmann <gerd@gnu.org>
parents:
38414
diff
changeset
|
495 (let ((pattern (x-compose-font-name xlfd-fields))) |
4f3033e5b688
(x-must-resolve-font-name): New
Gerd Moellmann <gerd@gnu.org>
parents:
38414
diff
changeset
|
496 (condition-case nil |
4f3033e5b688
(x-must-resolve-font-name): New
Gerd Moellmann <gerd@gnu.org>
parents:
38414
diff
changeset
|
497 (setq ascii-font (x-resolve-font-name pattern)) |
4f3033e5b688
(x-must-resolve-font-name): New
Gerd Moellmann <gerd@gnu.org>
parents:
38414
diff
changeset
|
498 (error |
4f3033e5b688
(x-must-resolve-font-name): New
Gerd Moellmann <gerd@gnu.org>
parents:
38414
diff
changeset
|
499 (message "Warning: no fonts matching `%s' available" pattern) |
4f3033e5b688
(x-must-resolve-font-name): New
Gerd Moellmann <gerd@gnu.org>
parents:
38414
diff
changeset
|
500 (aset xlfd-fields index "*") |
4f3033e5b688
(x-must-resolve-font-name): New
Gerd Moellmann <gerd@gnu.org>
parents:
38414
diff
changeset
|
501 (setq index (1+ index)))))) |
4f3033e5b688
(x-must-resolve-font-name): New
Gerd Moellmann <gerd@gnu.org>
parents:
38414
diff
changeset
|
502 (unless ascii-font |
50581
4daf1ecf4381
(create-fontset-from-ascii-font): Doc fix.
John Paul Wallington <jpw@pobox.com>
parents:
50516
diff
changeset
|
503 (error "No fonts found")) |
40250
4f3033e5b688
(x-must-resolve-font-name): New
Gerd Moellmann <gerd@gnu.org>
parents:
38414
diff
changeset
|
504 ascii-font)) |
4f3033e5b688
(x-must-resolve-font-name): New
Gerd Moellmann <gerd@gnu.org>
parents:
38414
diff
changeset
|
505 |
4f3033e5b688
(x-must-resolve-font-name): New
Gerd Moellmann <gerd@gnu.org>
parents:
38414
diff
changeset
|
506 |
17052 | 507 (defun x-complement-fontset-spec (xlfd-fields fontlist) |
89357
8f8c7d4c2e6e
Enable the default fontset to use
Kenichi Handa <handa@m17n.org>
parents:
89325
diff
changeset
|
508 "Complement elements of FONTLIST based on XLFD-FIELDS. |
17052 | 509 XLFD-FIELDS is a vector of XLFD (X Logical Font Description) fields. |
89357
8f8c7d4c2e6e
Enable the default fontset to use
Kenichi Handa <handa@m17n.org>
parents:
89325
diff
changeset
|
510 FONTLIST is an alist of script names vs the corresponding font names. |
17052 | 511 |
89357
8f8c7d4c2e6e
Enable the default fontset to use
Kenichi Handa <handa@m17n.org>
parents:
89325
diff
changeset
|
512 The font names are complemented as below. |
28215
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
513 |
89357
8f8c7d4c2e6e
Enable the default fontset to use
Kenichi Handa <handa@m17n.org>
parents:
89325
diff
changeset
|
514 If a font name matches `xlfd-style-regexp', each field of wild card is |
8f8c7d4c2e6e
Enable the default fontset to use
Kenichi Handa <handa@m17n.org>
parents:
89325
diff
changeset
|
515 replaced by the corresponding fields in XLFD-FIELDS." |
8f8c7d4c2e6e
Enable the default fontset to use
Kenichi Handa <handa@m17n.org>
parents:
89325
diff
changeset
|
516 (let ((default-spec (vector (aref xlfd-fields xlfd-regexp-family-subnum) |
8f8c7d4c2e6e
Enable the default fontset to use
Kenichi Handa <handa@m17n.org>
parents:
89325
diff
changeset
|
517 (aref xlfd-fields xlfd-regexp-weight-subnum) |
8f8c7d4c2e6e
Enable the default fontset to use
Kenichi Handa <handa@m17n.org>
parents:
89325
diff
changeset
|
518 (aref xlfd-fields xlfd-regexp-slant-subnum) |
8f8c7d4c2e6e
Enable the default fontset to use
Kenichi Handa <handa@m17n.org>
parents:
89325
diff
changeset
|
519 (aref xlfd-fields xlfd-regexp-swidth-subnum) |
8f8c7d4c2e6e
Enable the default fontset to use
Kenichi Handa <handa@m17n.org>
parents:
89325
diff
changeset
|
520 (aref xlfd-fields xlfd-regexp-adstyle-subnum) |
8f8c7d4c2e6e
Enable the default fontset to use
Kenichi Handa <handa@m17n.org>
parents:
89325
diff
changeset
|
521 (aref xlfd-fields xlfd-regexp-registry-subnum)))) |
88405 | 522 (dolist (elt fontlist) |
88893
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
523 (let ((name (cadr elt)) |
88405 | 524 font-spec) |
89325
58d5f88f985b
(x-complement-fontset-spec): If a fontname doesn't conform to XLFD
Kenichi Handa <handa@m17n.org>
parents:
89274
diff
changeset
|
525 (when (or (string-match xlfd-style-regexp name) |
58d5f88f985b
(x-complement-fontset-spec): If a fontname doesn't conform to XLFD
Kenichi Handa <handa@m17n.org>
parents:
89274
diff
changeset
|
526 (and (setq name (car (x-list-fonts name nil nil 1))) |
58d5f88f985b
(x-complement-fontset-spec): If a fontname doesn't conform to XLFD
Kenichi Handa <handa@m17n.org>
parents:
89274
diff
changeset
|
527 (string-match xlfd-style-regexp name))) |
88405 | 528 (setq font-spec (make-vector 6 nil)) |
529 (dotimes (i 6) | |
530 (aset font-spec i (match-string (1+ i) name))) | |
89900
7ad4af87a4d4
(x-complement-fontset-spec): Don't
Kenichi Handa <handa@m17n.org>
parents:
89830
diff
changeset
|
531 (dotimes (i 5) |
88405 | 532 (if (string-match "^[*-]+$" (aref font-spec i)) |
533 (aset font-spec i (aref default-spec i)))) | |
88893
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
534 (setcar (cdr elt) font-spec)))) |
88405 | 535 |
28215
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
536 fontlist)) |
17052 | 537 |
19049
cad4c032fa26
(fontset-name-p): New function.
Kenichi Handa <handa@m17n.org>
parents:
18719
diff
changeset
|
538 (defun fontset-name-p (fontset) |
cad4c032fa26
(fontset-name-p): New function.
Kenichi Handa <handa@m17n.org>
parents:
18719
diff
changeset
|
539 "Return non-nil if FONTSET is valid as fontset name. |
cad4c032fa26
(fontset-name-p): New function.
Kenichi Handa <handa@m17n.org>
parents:
18719
diff
changeset
|
540 A valid fontset name should conform to XLFD (X Logical Font Description) |
cad4c032fa26
(fontset-name-p): New function.
Kenichi Handa <handa@m17n.org>
parents:
18719
diff
changeset
|
541 with \"fontset\" in `<CHARSET_REGISTRY> field." |
cad4c032fa26
(fontset-name-p): New function.
Kenichi Handa <handa@m17n.org>
parents:
18719
diff
changeset
|
542 (and (string-match xlfd-tight-regexp fontset) |
cad4c032fa26
(fontset-name-p): New function.
Kenichi Handa <handa@m17n.org>
parents:
18719
diff
changeset
|
543 (string= (match-string (1+ xlfd-regexp-registry-subnum) fontset) |
cad4c032fa26
(fontset-name-p): New function.
Kenichi Handa <handa@m17n.org>
parents:
18719
diff
changeset
|
544 "fontset"))) |
cad4c032fa26
(fontset-name-p): New function.
Kenichi Handa <handa@m17n.org>
parents:
18719
diff
changeset
|
545 |
17052 | 546 (defun generate-fontset-menu () |
89274 | 547 "Return list to be appended to `x-fixed-font-alist'. |
548 Done when `mouse-set-font' is called." | |
89127
3e0204a3fcb8
(generate-fontset-menu): Exclude the defualt fontset.
Kenichi Handa <handa@m17n.org>
parents:
89004
diff
changeset
|
549 (let (l) |
3e0204a3fcb8
(generate-fontset-menu): Exclude the defualt fontset.
Kenichi Handa <handa@m17n.org>
parents:
89004
diff
changeset
|
550 (dolist (fontset (fontset-list)) |
3e0204a3fcb8
(generate-fontset-menu): Exclude the defualt fontset.
Kenichi Handa <handa@m17n.org>
parents:
89004
diff
changeset
|
551 (or (string-match "fontset-default$" fontset) |
3e0204a3fcb8
(generate-fontset-menu): Exclude the defualt fontset.
Kenichi Handa <handa@m17n.org>
parents:
89004
diff
changeset
|
552 (push (list (fontset-plain-name fontset) fontset) l))) |
24160
ab814ec4995e
(generate-fontset-menu): Return a
Kenichi Handa <handa@m17n.org>
parents:
24153
diff
changeset
|
553 (cons "Fontset" |
89127
3e0204a3fcb8
(generate-fontset-menu): Exclude the defualt fontset.
Kenichi Handa <handa@m17n.org>
parents:
89004
diff
changeset
|
554 (sort l #'(lambda (x y) (string< (car x) (car y))))))) |
17052 | 555 |
556 (defun fontset-plain-name (fontset) | |
557 "Return a plain and descriptive name of FONTSET." | |
17755
4c82e87c7d7c
(x-decompose-font-name): While seting each field of
Kenichi Handa <handa@m17n.org>
parents:
17339
diff
changeset
|
558 (if (not (setq fontset (query-fontset fontset))) |
4c82e87c7d7c
(x-decompose-font-name): While seting each field of
Kenichi Handa <handa@m17n.org>
parents:
17339
diff
changeset
|
559 (error "Invalid fontset: %s" fontset)) |
17052 | 560 (let ((xlfd-fields (x-decompose-font-name fontset))) |
561 (if xlfd-fields | |
89004
fbd881940a45
(fontset-plain-name): If the fontset
Kenichi Handa <handa@m17n.org>
parents:
88893
diff
changeset
|
562 (let ((family (aref xlfd-fields xlfd-regexp-family-subnum)) |
fbd881940a45
(fontset-plain-name): If the fontset
Kenichi Handa <handa@m17n.org>
parents:
88893
diff
changeset
|
563 (weight (aref xlfd-fields xlfd-regexp-weight-subnum)) |
17052 | 564 (slant (aref xlfd-fields xlfd-regexp-slant-subnum)) |
565 (swidth (aref xlfd-fields xlfd-regexp-swidth-subnum)) | |
566 (size (aref xlfd-fields xlfd-regexp-pixelsize-subnum)) | |
88405 | 567 (nickname (aref xlfd-fields xlfd-regexp-registry-subnum)) |
17052 | 568 name) |
88405 | 569 (if (not (string-match "^fontset-\\(.*\\)$" nickname)) |
89004
fbd881940a45
(fontset-plain-name): If the fontset
Kenichi Handa <handa@m17n.org>
parents:
88893
diff
changeset
|
570 (setq nickname family) |
fbd881940a45
(fontset-plain-name): If the fontset
Kenichi Handa <handa@m17n.org>
parents:
88893
diff
changeset
|
571 (setq nickname (match-string 1 nickname))) |
fbd881940a45
(fontset-plain-name): If the fontset
Kenichi Handa <handa@m17n.org>
parents:
88893
diff
changeset
|
572 (if (and size (> (string-to-int size) 0)) |
fbd881940a45
(fontset-plain-name): If the fontset
Kenichi Handa <handa@m17n.org>
parents:
88893
diff
changeset
|
573 (setq name (format "%s: %s-dot" nickname size)) |
fbd881940a45
(fontset-plain-name): If the fontset
Kenichi Handa <handa@m17n.org>
parents:
88893
diff
changeset
|
574 (setq name nickname)) |
fbd881940a45
(fontset-plain-name): If the fontset
Kenichi Handa <handa@m17n.org>
parents:
88893
diff
changeset
|
575 (and weight |
fbd881940a45
(fontset-plain-name): If the fontset
Kenichi Handa <handa@m17n.org>
parents:
88893
diff
changeset
|
576 (cond ((string-match "^medium$" weight) |
fbd881940a45
(fontset-plain-name): If the fontset
Kenichi Handa <handa@m17n.org>
parents:
88893
diff
changeset
|
577 (setq name (concat name " " "medium"))) |
fbd881940a45
(fontset-plain-name): If the fontset
Kenichi Handa <handa@m17n.org>
parents:
88893
diff
changeset
|
578 ((string-match "^bold$\\|^demibold$" weight) |
fbd881940a45
(fontset-plain-name): If the fontset
Kenichi Handa <handa@m17n.org>
parents:
88893
diff
changeset
|
579 (setq name (concat name " " weight))))) |
fbd881940a45
(fontset-plain-name): If the fontset
Kenichi Handa <handa@m17n.org>
parents:
88893
diff
changeset
|
580 (and slant |
fbd881940a45
(fontset-plain-name): If the fontset
Kenichi Handa <handa@m17n.org>
parents:
88893
diff
changeset
|
581 (cond ((string-match "^i$" slant) |
fbd881940a45
(fontset-plain-name): If the fontset
Kenichi Handa <handa@m17n.org>
parents:
88893
diff
changeset
|
582 (setq name (concat name " " "italic"))) |
fbd881940a45
(fontset-plain-name): If the fontset
Kenichi Handa <handa@m17n.org>
parents:
88893
diff
changeset
|
583 ((string-match "^o$" slant) |
fbd881940a45
(fontset-plain-name): If the fontset
Kenichi Handa <handa@m17n.org>
parents:
88893
diff
changeset
|
584 (setq name (concat name " " "slant"))) |
fbd881940a45
(fontset-plain-name): If the fontset
Kenichi Handa <handa@m17n.org>
parents:
88893
diff
changeset
|
585 ((string-match "^ri$" slant) |
fbd881940a45
(fontset-plain-name): If the fontset
Kenichi Handa <handa@m17n.org>
parents:
88893
diff
changeset
|
586 (setq name (concat name " " "reverse italic"))) |
fbd881940a45
(fontset-plain-name): If the fontset
Kenichi Handa <handa@m17n.org>
parents:
88893
diff
changeset
|
587 ((string-match "^ro$" slant) |
fbd881940a45
(fontset-plain-name): If the fontset
Kenichi Handa <handa@m17n.org>
parents:
88893
diff
changeset
|
588 (setq name (concat name " " "reverse slant"))))) |
fbd881940a45
(fontset-plain-name): If the fontset
Kenichi Handa <handa@m17n.org>
parents:
88893
diff
changeset
|
589 name) |
17052 | 590 fontset))) |
591 | |
88893
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
592 (defvar charset-script-alist |
89143
7b8bd597892a
(charset-script-alist): Fix script names.
Kenichi Handa <handa@m17n.org>
parents:
89127
diff
changeset
|
593 '((ascii . latin) |
88893
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
594 (latin-iso8859-1 . latin) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
595 (latin-iso8859-2 . latin) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
596 (latin-iso8859-3 . latin) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
597 (latin-iso8859-4 . latin) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
598 (latin-iso8859-9 . latin) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
599 (latin-iso8859-10 . latin) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
600 (latin-iso8859-13 . latin) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
601 (latin-iso8859-14 . latin) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
602 (latin-iso8859-15 . latin) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
603 (latin-iso8859-16 . latin) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
604 (latin-jisx0201 . latin) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
605 (thai-tis620 . thai) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
606 (cyrillic-iso8859-5 . cyrillic) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
607 (arabic-iso8859-6 . arabic) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
608 (greek-iso8859-7 . latin) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
609 (hebrew-iso8859-8 . latin) |
89143
7b8bd597892a
(charset-script-alist): Fix script names.
Kenichi Handa <handa@m17n.org>
parents:
89127
diff
changeset
|
610 (katakana-jisx0201 . kana) |
88893
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
611 (chinese-gb2312 . han) |
90005
0c0b009323eb
(font-encoding-alist): Add gbk.
Kenichi Handa <handa@m17n.org>
parents:
89909
diff
changeset
|
612 (chinese-gbk . han) |
88893
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
613 (chinese-big5-1 . han) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
614 (chinese-big5-2 . han) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
615 (chinese-cns11643-1 . han) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
616 (chinese-cns11643-2 . han) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
617 (chinese-cns11643-3 . han) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
618 (chinese-cns11643-4 . han) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
619 (chinese-cns11643-5 . han) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
620 (chinese-cns11643-6 . han) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
621 (chinese-cns11643-7 . han) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
622 (japanese-jisx0208 . han) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
623 (japanese-jisx0208-1978 . han) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
624 (japanese-jisx0212 . han) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
625 (japanese-jisx0213-1 . han) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
626 (japanese-jisx0213-2 . han) |
89143
7b8bd597892a
(charset-script-alist): Fix script names.
Kenichi Handa <handa@m17n.org>
parents:
89127
diff
changeset
|
627 (korean-ksc5601 . hangul) |
88893
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
628 (chinese-sisheng . bopomofo) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
629 (vietnamese-viscii-lower . latin) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
630 (vietnamese-viscii-upper . latin) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
631 (arabic-digit . arabic) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
632 (arabic-1-column . arabic) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
633 (arabic-2-column . arabic) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
634 (indian-is13194 . devanagari) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
635 (indian-glyph . devanagari) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
636 (indian-1-column . devanagari) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
637 (indian-2-column . devanagari) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
638 (tibetan-1-column . tibetan)) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
639 "Alist of charsets vs the corresponding most appropriate scripts. |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
640 |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
641 This alist is used by the function `create-fontset-from-fontset-spec' |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
642 to map charsets to scripts.") |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
643 |
22161
7a4c3fd89dda
(x-font-name-charset-alist): New
Kenichi Handa <handa@m17n.org>
parents:
22128
diff
changeset
|
644 (defun create-fontset-from-fontset-spec (fontset-spec |
22449
c87830c691a5
(instantiate-fontset): Delete
Kenichi Handa <handa@m17n.org>
parents:
22161
diff
changeset
|
645 &optional style-variant noerror) |
17052 | 646 "Create a fontset from fontset specification string FONTSET-SPEC. |
647 FONTSET-SPEC is a string of the format: | |
88893
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
648 FONTSET-NAME,SCRIPT-NAME0:FONT-NAME0,SCRIPT-NAME1:FONT-NAME1, ... |
17755
4c82e87c7d7c
(x-decompose-font-name): While seting each field of
Kenichi Handa <handa@m17n.org>
parents:
17339
diff
changeset
|
649 Any number of SPACE, TAB, and NEWLINE can be put before and after commas. |
22449
c87830c691a5
(instantiate-fontset): Delete
Kenichi Handa <handa@m17n.org>
parents:
22161
diff
changeset
|
650 |
89357
8f8c7d4c2e6e
Enable the default fontset to use
Kenichi Handa <handa@m17n.org>
parents:
89325
diff
changeset
|
651 When a frame uses the fontset as the `font' parameter, the frame's |
8f8c7d4c2e6e
Enable the default fontset to use
Kenichi Handa <handa@m17n.org>
parents:
89325
diff
changeset
|
652 default font name is derived from FONTSET-NAME by substituting |
8f8c7d4c2e6e
Enable the default fontset to use
Kenichi Handa <handa@m17n.org>
parents:
89325
diff
changeset
|
653 \"iso8859-1\" for the tail part \"fontset-XXX\". But, if SCRIPT-NAMEn |
8f8c7d4c2e6e
Enable the default fontset to use
Kenichi Handa <handa@m17n.org>
parents:
89325
diff
changeset
|
654 is \"ascii\", use the corresponding FONT-NAMEn as the default font |
8f8c7d4c2e6e
Enable the default fontset to use
Kenichi Handa <handa@m17n.org>
parents:
89325
diff
changeset
|
655 name. |
22449
c87830c691a5
(instantiate-fontset): Delete
Kenichi Handa <handa@m17n.org>
parents:
22161
diff
changeset
|
656 |
89357
8f8c7d4c2e6e
Enable the default fontset to use
Kenichi Handa <handa@m17n.org>
parents:
89325
diff
changeset
|
657 Optional 2nd and 3rd arguments are ignored. They exist just for |
8f8c7d4c2e6e
Enable the default fontset to use
Kenichi Handa <handa@m17n.org>
parents:
89325
diff
changeset
|
658 backward compatibility. |
22672
9cfa1a788a5a
(create-fontset-from-fontset-spec):
Kenichi Handa <handa@m17n.org>
parents:
22618
diff
changeset
|
659 |
88893
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
660 It returns a name of the created fontset. |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
661 |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
662 For backward compatibility, SCRIPT-NAME may be a charset name, in |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
663 which case, the corresponding script is decided by the variable |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
664 `charset-script-alist' (which see)." |
89357
8f8c7d4c2e6e
Enable the default fontset to use
Kenichi Handa <handa@m17n.org>
parents:
89325
diff
changeset
|
665 (or (string-match "^[^,]+" fontset-spec) |
17755
4c82e87c7d7c
(x-decompose-font-name): While seting each field of
Kenichi Handa <handa@m17n.org>
parents:
17339
diff
changeset
|
666 (error "Invalid fontset spec: %s" fontset-spec)) |
4c82e87c7d7c
(x-decompose-font-name): While seting each field of
Kenichi Handa <handa@m17n.org>
parents:
17339
diff
changeset
|
667 (let ((idx (match-end 0)) |
4c82e87c7d7c
(x-decompose-font-name): While seting each field of
Kenichi Handa <handa@m17n.org>
parents:
17339
diff
changeset
|
668 (name (match-string 0 fontset-spec)) |
89357
8f8c7d4c2e6e
Enable the default fontset to use
Kenichi Handa <handa@m17n.org>
parents:
89325
diff
changeset
|
669 xlfd-fields script fontlist) |
8f8c7d4c2e6e
Enable the default fontset to use
Kenichi Handa <handa@m17n.org>
parents:
89325
diff
changeset
|
670 (setq xlfd-fields (x-decompose-font-name name)) |
8f8c7d4c2e6e
Enable the default fontset to use
Kenichi Handa <handa@m17n.org>
parents:
89325
diff
changeset
|
671 (or xlfd-fields |
8f8c7d4c2e6e
Enable the default fontset to use
Kenichi Handa <handa@m17n.org>
parents:
89325
diff
changeset
|
672 (error "Fontset name \"%s\" not conforming to XLFD" name)) |
22449
c87830c691a5
(instantiate-fontset): Delete
Kenichi Handa <handa@m17n.org>
parents:
22161
diff
changeset
|
673 |
89357
8f8c7d4c2e6e
Enable the default fontset to use
Kenichi Handa <handa@m17n.org>
parents:
89325
diff
changeset
|
674 ;; At first, extract pairs of charset and fontname from FONTSET-SPEC. |
8f8c7d4c2e6e
Enable the default fontset to use
Kenichi Handa <handa@m17n.org>
parents:
89325
diff
changeset
|
675 (while (string-match "[, \t\n]*\\([^:]+\\):\\([^,]+\\)" fontset-spec idx) |
8f8c7d4c2e6e
Enable the default fontset to use
Kenichi Handa <handa@m17n.org>
parents:
89325
diff
changeset
|
676 (setq idx (match-end 0)) |
8f8c7d4c2e6e
Enable the default fontset to use
Kenichi Handa <handa@m17n.org>
parents:
89325
diff
changeset
|
677 (setq script (intern (match-string 1 fontset-spec))) |
8f8c7d4c2e6e
Enable the default fontset to use
Kenichi Handa <handa@m17n.org>
parents:
89325
diff
changeset
|
678 (if (or (eq script 'ascii) |
8f8c7d4c2e6e
Enable the default fontset to use
Kenichi Handa <handa@m17n.org>
parents:
89325
diff
changeset
|
679 (memq script (char-table-extra-slot char-script-table 0)) |
8f8c7d4c2e6e
Enable the default fontset to use
Kenichi Handa <handa@m17n.org>
parents:
89325
diff
changeset
|
680 (setq script (cdr (assq script charset-script-alist)))) |
8f8c7d4c2e6e
Enable the default fontset to use
Kenichi Handa <handa@m17n.org>
parents:
89325
diff
changeset
|
681 (setq fontlist (cons (list script (match-string 2 fontset-spec)) |
8f8c7d4c2e6e
Enable the default fontset to use
Kenichi Handa <handa@m17n.org>
parents:
89325
diff
changeset
|
682 fontlist)))) |
22161
7a4c3fd89dda
(x-font-name-charset-alist): New
Kenichi Handa <handa@m17n.org>
parents:
22128
diff
changeset
|
683 |
89357
8f8c7d4c2e6e
Enable the default fontset to use
Kenichi Handa <handa@m17n.org>
parents:
89325
diff
changeset
|
684 ;; Complement FONTLIST. |
8f8c7d4c2e6e
Enable the default fontset to use
Kenichi Handa <handa@m17n.org>
parents:
89325
diff
changeset
|
685 (setq fontlist (x-complement-fontset-spec xlfd-fields fontlist)) |
28215
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
686 |
89357
8f8c7d4c2e6e
Enable the default fontset to use
Kenichi Handa <handa@m17n.org>
parents:
89325
diff
changeset
|
687 ;; Create a fontset. |
8f8c7d4c2e6e
Enable the default fontset to use
Kenichi Handa <handa@m17n.org>
parents:
89325
diff
changeset
|
688 (new-fontset name fontlist))) |
22672
9cfa1a788a5a
(create-fontset-from-fontset-spec):
Kenichi Handa <handa@m17n.org>
parents:
22618
diff
changeset
|
689 |
9cfa1a788a5a
(create-fontset-from-fontset-spec):
Kenichi Handa <handa@m17n.org>
parents:
22618
diff
changeset
|
690 (defun create-fontset-from-ascii-font (font &optional resolved-font |
9cfa1a788a5a
(create-fontset-from-fontset-spec):
Kenichi Handa <handa@m17n.org>
parents:
22618
diff
changeset
|
691 fontset-name) |
9cfa1a788a5a
(create-fontset-from-fontset-spec):
Kenichi Handa <handa@m17n.org>
parents:
22618
diff
changeset
|
692 "Create a fontset from an ASCII font FONT. |
9cfa1a788a5a
(create-fontset-from-fontset-spec):
Kenichi Handa <handa@m17n.org>
parents:
22618
diff
changeset
|
693 |
9cfa1a788a5a
(create-fontset-from-fontset-spec):
Kenichi Handa <handa@m17n.org>
parents:
22618
diff
changeset
|
694 Optional 1st arg RESOLVED-FONT is a resolved name of FONT. If |
89274 | 695 omitted, `x-resolve-font-name' is called to get the resolved name. At |
696 this time, if FONT is not available, an error is signaled. | |
22672
9cfa1a788a5a
(create-fontset-from-fontset-spec):
Kenichi Handa <handa@m17n.org>
parents:
22618
diff
changeset
|
697 |
9cfa1a788a5a
(create-fontset-from-fontset-spec):
Kenichi Handa <handa@m17n.org>
parents:
22618
diff
changeset
|
698 Optional 2nd arg FONTSET-NAME is a string to be used in |
9cfa1a788a5a
(create-fontset-from-fontset-spec):
Kenichi Handa <handa@m17n.org>
parents:
22618
diff
changeset
|
699 `<CHARSET_ENCODING>' fields of a new fontset name. If it is omitted, |
9cfa1a788a5a
(create-fontset-from-fontset-spec):
Kenichi Handa <handa@m17n.org>
parents:
22618
diff
changeset
|
700 an appropriate name is generated automatically. |
9cfa1a788a5a
(create-fontset-from-fontset-spec):
Kenichi Handa <handa@m17n.org>
parents:
22618
diff
changeset
|
701 |
9cfa1a788a5a
(create-fontset-from-fontset-spec):
Kenichi Handa <handa@m17n.org>
parents:
22618
diff
changeset
|
702 It returns a name of the created fontset." |
28215
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
703 (setq font (downcase font)) |
88893
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
704 (setq resolved-font |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
705 (downcase (or resolved-font (x-resolve-font-name font)))) |
88405 | 706 (let ((xlfd (x-decompose-font-name resolved-font)) |
707 fontset) | |
28215
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
708 (if fontset-name |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
709 (setq fontset-name (downcase fontset-name)) |
89004
fbd881940a45
(fontset-plain-name): If the fontset
Kenichi Handa <handa@m17n.org>
parents:
88893
diff
changeset
|
710 (if (query-fontset "fontset-startup") |
fbd881940a45
(fontset-plain-name): If the fontset
Kenichi Handa <handa@m17n.org>
parents:
88893
diff
changeset
|
711 (setq fontset-name |
fbd881940a45
(fontset-plain-name): If the fontset
Kenichi Handa <handa@m17n.org>
parents:
88893
diff
changeset
|
712 (subst-char-in-string |
fbd881940a45
(fontset-plain-name): If the fontset
Kenichi Handa <handa@m17n.org>
parents:
88893
diff
changeset
|
713 ?- ?_ (aref xlfd xlfd-regexp-registry-subnum) t)) |
fbd881940a45
(fontset-plain-name): If the fontset
Kenichi Handa <handa@m17n.org>
parents:
88893
diff
changeset
|
714 (setq fontset-name "startup"))) |
88405 | 715 (aset xlfd xlfd-regexp-registry-subnum |
716 (format "fontset-%s" fontset-name)) | |
22672
9cfa1a788a5a
(create-fontset-from-fontset-spec):
Kenichi Handa <handa@m17n.org>
parents:
22618
diff
changeset
|
717 (setq fontset (x-compose-font-name xlfd)) |
9cfa1a788a5a
(create-fontset-from-fontset-spec):
Kenichi Handa <handa@m17n.org>
parents:
22618
diff
changeset
|
718 (or (query-fontset fontset) |
28215
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
719 (create-fontset-from-fontset-spec (concat fontset ", ascii:" font))))) |
22161
7a4c3fd89dda
(x-font-name-charset-alist): New
Kenichi Handa <handa@m17n.org>
parents:
22128
diff
changeset
|
720 |
17052 | 721 |
17842
cb1af8ead3df
(standard-fontset-spec): Name changed from
Kenichi Handa <handa@m17n.org>
parents:
17755
diff
changeset
|
722 ;; Create standard fontset from 16 dots fonts which are the most widely |
17989
8a264cfe3768
(x-complement-fontset-spec): Add font names which are
Kenichi Handa <handa@m17n.org>
parents:
17842
diff
changeset
|
723 ;; installed fonts. Fonts for Chinese-GB, Korean, and Chinese-CNS are |
8a264cfe3768
(x-complement-fontset-spec): Add font names which are
Kenichi Handa <handa@m17n.org>
parents:
17842
diff
changeset
|
724 ;; specified here because FAMILY of those fonts are not "fixed" in |
8a264cfe3768
(x-complement-fontset-spec): Add font names which are
Kenichi Handa <handa@m17n.org>
parents:
17842
diff
changeset
|
725 ;; many cases. |
17842
cb1af8ead3df
(standard-fontset-spec): Name changed from
Kenichi Handa <handa@m17n.org>
parents:
17755
diff
changeset
|
726 (defvar standard-fontset-spec |
88405 | 727 (purecopy "-*-fixed-medium-r-normal-*-16-*-*-*-*-*-fontset-standard") |
17842
cb1af8ead3df
(standard-fontset-spec): Name changed from
Kenichi Handa <handa@m17n.org>
parents:
17755
diff
changeset
|
728 "String of fontset spec of the standard fontset. |
cb1af8ead3df
(standard-fontset-spec): Name changed from
Kenichi Handa <handa@m17n.org>
parents:
17755
diff
changeset
|
729 You have the biggest chance to display international characters |
cb1af8ead3df
(standard-fontset-spec): Name changed from
Kenichi Handa <handa@m17n.org>
parents:
17755
diff
changeset
|
730 with correct glyphs by using the standard fontset. |
17052 | 731 See the documentation of `create-fontset-from-fontset-spec' for the format.") |
732 | |
88893
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
733 |
17052 | 734 ;; Create fontsets from X resources of the name `fontset-N (class |
735 ;; Fontset-N)' where N is integer 0, 1, ... | |
736 ;; The values of the resources the string of the same format as | |
17842
cb1af8ead3df
(standard-fontset-spec): Name changed from
Kenichi Handa <handa@m17n.org>
parents:
17755
diff
changeset
|
737 ;; `standard-fontset-spec'. |
17052 | 738 |
739 (defun create-fontset-from-x-resource () | |
740 (let ((idx 0) | |
741 fontset-spec) | |
27534
eeb998860456
(standard-fontset-spec): Purecopy it.
Dave Love <fx@gnu.org>
parents:
26886
diff
changeset
|
742 (while (setq fontset-spec (x-get-resource (format "fontset-%d" idx) |
eeb998860456
(standard-fontset-spec): Purecopy it.
Dave Love <fx@gnu.org>
parents:
26886
diff
changeset
|
743 (format "Fontset-%d" idx))) |
24153
729affdf2ca1
(create-fontset-from-x-resource): Make style variants.
Kenichi Handa <handa@m17n.org>
parents:
23890
diff
changeset
|
744 (create-fontset-from-fontset-spec fontset-spec t 'noerror) |
17052 | 745 (setq idx (1+ idx))))) |
746 | |
747 ;; | |
748 (provide 'fontset) | |
749 | |
89909 | 750 ;;; arch-tag: bb53e629-0234-403c-950e-551e61554849 |
17052 | 751 ;;; fontset.el ends here |