Mercurial > emacs
annotate lisp/international/fontset.el @ 89091:d520353b835a
(emacs-mule, iso-2022-7bit)
(iso-2022-7bit-ss2, iso-2022-7bit-lock, iso-2022-8bit-ss2)
(compound-text, ctext-no-compositions): Remove :charset-list.
author | Dave Love <fx@gnu.org> |
---|---|
date | Sun, 08 Sep 2002 19:47:56 +0000 |
parents | fbd881940a45 |
children | 3e0204a3fcb8 |
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. |
8b4a66c66dd6
Change copyright notice.
Richard M. Stallman <rms@gnu.org>
parents:
18350
diff
changeset
|
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. |
17052 | 6 |
7 ;; Keywords: mule, multilingual, fontset | |
8 | |
9 ;; This file is part of GNU Emacs. | |
10 | |
11 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
12 ;; it under the terms of the GNU General Public License as published by | |
13 ;; the Free Software Foundation; either version 2, or (at your option) | |
14 ;; any later version. | |
15 | |
16 ;; GNU Emacs is distributed in the hope that it will be useful, | |
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 ;; GNU General Public License for more details. | |
20 | |
21 ;; You should have received a copy of the GNU General Public License | |
17071 | 22 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
24 ;; Boston, MA 02111-1307, USA. | |
17052 | 25 |
38414
67b464da13ec
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
36368
diff
changeset
|
26 ;;; Commentary: |
67b464da13ec
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
36368
diff
changeset
|
27 |
17052 | 28 ;;; Code: |
29 | |
88893
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
30 ;; 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
|
31 |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
32 (setq font-encoding-alist |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
33 '(("iso8859-1$" . iso-8859-1) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
34 ("iso8859-2$" . iso-8859-2) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
35 ("iso8859-3$" . iso-8859-3) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
36 ("iso8859-4$" . iso-8859-4) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
37 ("iso8859-5$" . iso-8859-5) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
38 ("iso8859-6$" . iso-8859-6) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
39 ("iso8859-7$" . iso-8859-7) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
40 ("iso8859-8$" . iso-8859-8) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
41 ("iso8859-9$" . iso-8859-9) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
42 ("iso8859-10$" . iso-8859-10) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
43 ("iso8859-11$" . iso-8859-11) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
44 ("iso8859-13$" . iso-8859-13) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
45 ("iso8859-14$" . iso-8859-14) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
46 ("iso8859-15$" . iso-8859-15) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
47 ("gb2312.1980" . chinese-gb2312) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
48 ("jisx0208.1978" . japanese-jisx0208-1978) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
49 ("jisx0208" . japanese-jisx0208) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
50 ("jisx0201" . jisx0201) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
51 ("jisx0212" . japanese-jisx0212) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
52 ("ksc5601.1987" . korean-ksc5601) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
53 ("cns11643.1992.*1" . chinese-cns11643-1) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
54 ("cns11643.1992.*2" . chinese-cns11643-2) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
55 ("cns11643.1992.*3" . chinese-cns11643-3) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
56 ("cns11643.1992.*4" . chinese-cns11643-4) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
57 ("cns11643.1992.*5" . chinese-cns11643-5) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
58 ("cns11643.1992.*6" . chinese-cns11643-6) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
59 ("cns11643.1992.*7" . chinese-cns11643-7) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
60 ("big5" . big5) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
61 ("sisheng_cwnn" . chinese-sisheng) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
62 ("viscii" . viscii) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
63 ("tis620" . tis620-2533) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
64 ("mulearabic-0" . arabic-digit) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
65 ("mulearabic-1" . arabic-1-column) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
66 ("mulearabic-2" . arabic-2-column) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
67 ("muleipa" . ipa) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
68 ("ethiopic-unicode" . ethiopic) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
69 ("is13194-devanagari" . indian-is13194) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
70 ("devanagari-cdac" . devanagari-glyph) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
71 ("muleindian-2" . indian-2-column) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
72 ("muleindian-1" . indian-1-column) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
73 ("mulelao-1" . mule-lao) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
74 ("muletibetan-2" . tibetan) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
75 ("muletibetan-1" . tibetan-1-column) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
76 ("jisx0213.2000-1" . japanese-jisx0213-1) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
77 ("jisx0213.2000-2" . japanese-jisx0213-2) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
78 ("abobe-symbol" . symbol) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
79 ("iso10646-1" . (unicode . nil)) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
80 ("iso10646.indian-1" . (unicode . nil)))) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
81 |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
82 |
29234
c9a5f356fe77
Set family names of non-latin charsets in default fontset to "*".
Kenichi Handa <handa@m17n.org>
parents:
29168
diff
changeset
|
83 ;; 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
|
84 ;; 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
|
85 ;; 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
|
86 ;; FONT-SPEC is: |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
87 ;; a vector [ FAMILY WEIGHT SLANT ADSTYLE REGISTRY ], |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
88 ;; or a cons (FAMILY . REGISTRY), |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
89 ;; or a string FONT-NAME. |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
90 ;; |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
91 ;; 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
|
92 ;; 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
|
93 ;; 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
|
94 ;; `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
|
95 ;; `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
|
96 ;; 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
|
97 ;; character `*' is embedded in `CHARSET_ENCODING' field. |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
98 ;; |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
99 ;; 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
|
100 ;; `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
|
101 ;; of characters. |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
102 |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
103 (new-fontset |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
104 "fontset-default" |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
105 '( ;; for each script |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
106 (latin (nil . "ISO8859-1") |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
107 (nil . "ISO8859-2") |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
108 (nil . "ISO8859-3") |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
109 (nil . "ISO8859-4") |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
110 (nil . "ISO8859-9") |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
111 (nil . "ISO8859-10") |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
112 (nil . "ISO8859-13") |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
113 (nil . "ISO8859-14") |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
114 (nil . "VISCII1.1-1")) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
115 |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
116 (thai (nil . "TIS620*") |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
117 (nil . "ISO8859-11")) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
118 |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
119 (lao (nil . "MuleLao-1")) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
120 |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
121 ;; both for script and charset. |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
122 (tibetan (nil . "muletibetan-2")) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
123 |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
124 ;; both for script and charset. |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
125 (ethiopic (nil . "ethiopic-unicode")) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
126 |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
127 (greek (nil . "ISO8859-7")) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
128 |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
129 (cyrillic (nil . "ISO8859-5")) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
130 |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
131 (arabic (nil . "MuleArabic-0") |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
132 (nil . "MuleArabic-1") |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
133 (nil . "MuleArabic-2") |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
134 (nil . "ISO8859-6")) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
135 |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
136 (hebrew (nil . "ISO8859-8")) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
137 |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
138 (kana (nil . "JISX0208*") |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
139 (nil . "GB2312.1980-0") |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
140 (nil . "KSC5601.1987*") |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
141 (nil . "JISX0201*")) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
142 |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
143 (bopomofo (nil . "sisheng_cwnn-0")) |
17052 | 144 |
88893
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
145 (han (nil . "GB2312.1980-0") |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
146 (nil . "JISX0208*") |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
147 (nil . "JISX0212*") |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
148 (nil . "big5*") |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
149 (nil . "KSC5601.1987*") |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
150 (nil . "CNS11643.1992-1") |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
151 (nil . "CNS11643.1992-2") |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
152 (nil . "CNS11643.1992-3") |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
153 (nil . "CNS11643.1992-4") |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
154 (nil . "CNS11643.1992-5") |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
155 (nil . "CNS11643.1992-6") |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
156 (nil . "CNS11643.1992-7") |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
157 (nil . "gbk-0") |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
158 (nil . "JISX0213.2000-1") |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
159 (nil . "JISX0213.2000-2")) |
88405 | 160 |
88893
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
161 (cjk-misc (nil . "GB2312.1980-0") |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
162 (nil . "JISX0208*") |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
163 (nil . "JISX0212*") |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
164 (nil . "big5*") |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
165 (nil . "KSC5601.1987*") |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
166 (nil . "CNS11643.1992-1") |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
167 (nil . "CNS11643.1992-2") |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
168 (nil . "CNS11643.1992-3") |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
169 (nil . "CNS11643.1992-4") |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
170 (nil . "CNS11643.1992-5") |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
171 (nil . "CNS11643.1992-6") |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
172 (nil . "CNS11643.1992-7") |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
173 (nil . "gbk-0") |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
174 (nil . "JISX0213.2000-1") |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
175 (nil . "JISX0213.2000-2")) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
176 |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
177 (hangul (nil . "KSC5601.1987-0")) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
178 |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
179 ;; for each charset |
89004
fbd881940a45
(fontset-plain-name): If the fontset
Kenichi Handa <handa@m17n.org>
parents:
88893
diff
changeset
|
180 (ascii (nil . "ISO8859-1")) |
88893
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
181 (arabic-digit ("*" . "MuleArabic-0")) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
182 (arabic-1-column ("*" . "MuleArabic-1")) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
183 (arabic-2-column ("*" . "MuleArabic-2")) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
184 (indian-1-column ("*" . "muleindian-2")) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
185 (devanagari-glyph ("altsys-dv_ttsurekh" . "devanagari-cdac")) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
186 (ipa (nil . "MuleIPA-1")) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
187 )) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
188 |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
189 ;; Append Unicode fonts. |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
190 ;; This may find fonts of more varients (bold, italic) but don't cover |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
191 ;; many characters. |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
192 (set-fontset-font "fontset-default" '(#x00A0 . #xFFFF) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
193 '(nil . "iso10646-1") nil 'append) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
194 ;; These may find fonts that covers many characters but less varients. |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
195 (set-fontset-font "fontset-default" '(#x00A0 . #xFFFF) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
196 '("gnu-unifont" . "iso10646-1") nil 'append) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
197 (set-fontset-font "fontset-default" '(#x00A0 . #xFFFF) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
198 '("mutt-clearlyu" . "iso10646-1") nil 'append) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
199 |
17052 | 200 |
201 ;; Set arguments in `font-encoding-alist' (which see). | |
88405 | 202 (defun set-font-encoding (pattern charset) |
17052 | 203 (let ((slot (assoc pattern font-encoding-alist))) |
204 (if slot | |
88405 | 205 (setcdr slot charset) |
17052 | 206 (setq font-encoding-alist |
88405 | 207 (cons (cons pattern charset) font-encoding-alist))))) |
32646
43edadfecb51
Use registry "MuleTibetan-2" for Tibetan.
Kenichi Handa <handa@m17n.org>
parents:
29427
diff
changeset
|
208 |
17052 | 209 ;; Setting for suppressing XLoadQueryFont on big fonts. |
210 (setq x-pixel-size-width-font-regexp | |
211 "gb2312\\|jisx0208\\|ksc5601\\|cns11643\\|big5") | |
212 | |
28215
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
213 ;; These fonts require vertical centering. |
26886
8a6d8101919e
(vertical-centering-font-regexp): New
Kenichi Handa <handa@m17n.org>
parents:
26013
diff
changeset
|
214 (setq vertical-centering-font-regexp |
28215
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
215 "gb2312\\|jisx0208\\|jisx0212\\|ksc5601\\|cns11643\\|big5") |
26886
8a6d8101919e
(vertical-centering-font-regexp): New
Kenichi Handa <handa@m17n.org>
parents:
26013
diff
changeset
|
216 |
88405 | 217 (defvar x-font-name-charset-alist nil |
218 "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
|
219 |
17052 | 220 ;;; XLFD (X Logical Font Description) format handler. |
221 | |
222 ;; Define XLFD's field index numbers. ; field name | |
88405 | 223 (defconst xlfd-regexp-family-subnum 0) ; FOUNDRY and FAMILY |
224 (defconst xlfd-regexp-weight-subnum 1) ; WEIGHT_NAME | |
225 (defconst xlfd-regexp-slant-subnum 2) ; SLANT | |
226 (defconst xlfd-regexp-swidth-subnum 3) ; SETWIDTH_NAME | |
227 (defconst xlfd-regexp-adstyle-subnum 4) ; ADD_STYLE_NAME | |
228 (defconst xlfd-regexp-pixelsize-subnum 5) ; PIXEL_SIZE | |
229 (defconst xlfd-regexp-pointsize-subnum 6) ; POINT_SIZE | |
230 (defconst xlfd-regexp-resx-subnum 7) ; RESOLUTION_X | |
231 (defconst xlfd-regexp-resy-subnum 8) ; RESOLUTION_Y | |
232 (defconst xlfd-regexp-spacing-subnum 8) ; SPACING | |
233 (defconst xlfd-regexp-avgwidth-subnum 10) ; AVERAGE_WIDTH | |
234 (defconst xlfd-regexp-registry-subnum 11) ; REGISTRY and ENCODING | |
17052 | 235 |
236 ;; Regular expression matching against a fontname which conforms to | |
237 ;; XLFD (X Logical Font Description). All fields in XLFD should be | |
238 ;; not be omitted (but can be a wild card) to be matched. | |
239 (defconst xlfd-tight-regexp | |
240 "^\ | |
88405 | 241 -\\([^-]*-[^-]*\\)-\\([^-]*\\)-\\([^-]*\\)-\\([^-]*\\)\ |
17052 | 242 -\\([^-]*\\)-\\([^-]*\\)-\\([^-]*\\)-\\([^-]*\\)-\\([^-]*\\)\ |
88405 | 243 -\\([^-]*\\)-\\([^-]*\\)-\\([^-]*-[^-]*\\)$") |
244 | |
245 ;; Regular expression matching against a fontname which conforms to | |
246 ;; XLFD (X Logical Font Description). All fields in XLFD from FOUNDRY | |
247 ;; to ADSTYLE, REGSITRY, and ENCODING should be not be omitted (but | |
248 ;; can be a wild card) to be matched. | |
249 (defconst xlfd-style-regexp | |
250 "^\ | |
251 -\\([^-]*-[^-]*\\)-\\([^-]*\\)-\\([^-]*\\)-\\([^-]*\\)-\\([^-]*\\)-.*\ | |
252 -\\([^-]*-[^-]*\\)$") | |
17052 | 253 |
254 ;; List of field numbers of XLFD whose values are numeric. | |
255 (defconst xlfd-regexp-numeric-subnums | |
88405 | 256 (list xlfd-regexp-pixelsize-subnum ;5 |
257 xlfd-regexp-pointsize-subnum ;6 | |
258 xlfd-regexp-resx-subnum ;7 | |
259 xlfd-regexp-resy-subnum ;8 | |
260 xlfd-regexp-avgwidth-subnum ;10 | |
17052 | 261 )) |
262 | |
263 (defun x-decompose-font-name (pattern) | |
264 "Decompose PATTERN into XLFD's fields and return vector of the fields. | |
88405 | 265 The length of the vector is 12. |
17052 | 266 |
267 If PATTERN doesn't conform to XLFD, try to get a full XLFD name from | |
268 X server and use the information of the full name to decompose | |
269 PATTERN. If no full XLFD name is gotten, return nil." | |
270 (let (xlfd-fields fontname) | |
271 (if (string-match xlfd-tight-regexp pattern) | |
88405 | 272 (progn |
273 (setq xlfd-fields (make-vector 12 nil)) | |
274 (dotimes (i 12) | |
275 (aset xlfd-fields i (match-string (1+ i) pattern))) | |
276 (dotimes (i 12) | |
277 (if (string-match "^[*-]+$" (aref xlfd-fields i)) | |
278 (aset xlfd-fields i nil))) | |
17052 | 279 xlfd-fields) |
280 (setq fontname (condition-case nil | |
281 (x-resolve-font-name pattern) | |
282 (error))) | |
283 (if (and fontname | |
284 (string-match xlfd-tight-regexp fontname)) | |
23890
fa4839661777
(x-decompose-font-name): If PATTERN
Kenichi Handa <handa@m17n.org>
parents:
23655
diff
changeset
|
285 ;; We get a full XLFD name. |
17052 | 286 (let ((len (length pattern)) |
287 (i 0) | |
288 l) | |
23890
fa4839661777
(x-decompose-font-name): If PATTERN
Kenichi Handa <handa@m17n.org>
parents:
23655
diff
changeset
|
289 ;; Setup xlfd-fields by the full XLFD name. Each element |
fa4839661777
(x-decompose-font-name): If PATTERN
Kenichi Handa <handa@m17n.org>
parents:
23655
diff
changeset
|
290 ;; should be a cons of matched index and matched string. |
88405 | 291 (setq xlfd-fields (make-vector 12 nil)) |
292 (dotimes (i 12) | |
17052 | 293 (aset xlfd-fields i |
294 (cons (match-beginning (1+ i)) | |
88405 | 295 (match-string (1+ i) fontname)))) |
23890
fa4839661777
(x-decompose-font-name): If PATTERN
Kenichi Handa <handa@m17n.org>
parents:
23655
diff
changeset
|
296 |
fa4839661777
(x-decompose-font-name): If PATTERN
Kenichi Handa <handa@m17n.org>
parents:
23655
diff
changeset
|
297 ;; Replace wild cards in PATTERN by regexp codes. |
17052 | 298 (setq i 0) |
299 (while (< i len) | |
300 (let ((ch (aref pattern i))) | |
301 (if (= ch ??) | |
302 (setq pattern (concat (substring pattern 0 i) | |
303 "\\(.\\)" | |
304 (substring pattern (1+ i))) | |
305 len (+ len 4) | |
306 i (+ i 4)) | |
307 (if (= ch ?*) | |
308 (setq pattern (concat (substring pattern 0 i) | |
309 "\\(.*\\)" | |
310 (substring pattern (1+ i))) | |
311 len (+ len 5) | |
312 i (+ i 5)) | |
313 (setq i (1+ i)))))) | |
23890
fa4839661777
(x-decompose-font-name): If PATTERN
Kenichi Handa <handa@m17n.org>
parents:
23655
diff
changeset
|
314 |
fa4839661777
(x-decompose-font-name): If PATTERN
Kenichi Handa <handa@m17n.org>
parents:
23655
diff
changeset
|
315 ;; Set each element of xlfd-fields to proper strings. |
fa4839661777
(x-decompose-font-name): If PATTERN
Kenichi Handa <handa@m17n.org>
parents:
23655
diff
changeset
|
316 (if (string-match pattern fontname) |
fa4839661777
(x-decompose-font-name): If PATTERN
Kenichi Handa <handa@m17n.org>
parents:
23655
diff
changeset
|
317 ;; The regular expression PATTERN matchs the full XLFD |
fa4839661777
(x-decompose-font-name): If PATTERN
Kenichi Handa <handa@m17n.org>
parents:
23655
diff
changeset
|
318 ;; name. Set elements that correspond to a wild card |
88405 | 319 ;; in PATTERN to nil, set the other elements to the |
23890
fa4839661777
(x-decompose-font-name): If PATTERN
Kenichi Handa <handa@m17n.org>
parents:
23655
diff
changeset
|
320 ;; exact strings in PATTERN. |
fa4839661777
(x-decompose-font-name): If PATTERN
Kenichi Handa <handa@m17n.org>
parents:
23655
diff
changeset
|
321 (let ((l (cdr (cdr (match-data))))) |
fa4839661777
(x-decompose-font-name): If PATTERN
Kenichi Handa <handa@m17n.org>
parents:
23655
diff
changeset
|
322 (setq i 0) |
88405 | 323 (while (< i 12) |
23890
fa4839661777
(x-decompose-font-name): If PATTERN
Kenichi Handa <handa@m17n.org>
parents:
23655
diff
changeset
|
324 (if (or (null l) (< (car (aref xlfd-fields i)) (car l))) |
fa4839661777
(x-decompose-font-name): If PATTERN
Kenichi Handa <handa@m17n.org>
parents:
23655
diff
changeset
|
325 (progn |
fa4839661777
(x-decompose-font-name): If PATTERN
Kenichi Handa <handa@m17n.org>
parents:
23655
diff
changeset
|
326 (aset xlfd-fields i (cdr (aref xlfd-fields i))) |
fa4839661777
(x-decompose-font-name): If PATTERN
Kenichi Handa <handa@m17n.org>
parents:
23655
diff
changeset
|
327 (setq i (1+ i))) |
fa4839661777
(x-decompose-font-name): If PATTERN
Kenichi Handa <handa@m17n.org>
parents:
23655
diff
changeset
|
328 (if (< (car (aref xlfd-fields i)) (car (cdr l))) |
fa4839661777
(x-decompose-font-name): If PATTERN
Kenichi Handa <handa@m17n.org>
parents:
23655
diff
changeset
|
329 (progn |
88405 | 330 (aset xlfd-fields i nil) |
23890
fa4839661777
(x-decompose-font-name): If PATTERN
Kenichi Handa <handa@m17n.org>
parents:
23655
diff
changeset
|
331 (setq i (1+ i))) |
fa4839661777
(x-decompose-font-name): If PATTERN
Kenichi Handa <handa@m17n.org>
parents:
23655
diff
changeset
|
332 (setq l (cdr (cdr l))))))) |
fa4839661777
(x-decompose-font-name): If PATTERN
Kenichi Handa <handa@m17n.org>
parents:
23655
diff
changeset
|
333 ;; Set each element of xlfd-fields to the exact string |
fa4839661777
(x-decompose-font-name): If PATTERN
Kenichi Handa <handa@m17n.org>
parents:
23655
diff
changeset
|
334 ;; in the corresonding fields in full XLFD name. |
88405 | 335 (dotimes (i 12) |
336 (aset xlfd-fields i (cdr (aref xlfd-fields i))))) | |
17052 | 337 xlfd-fields))))) |
338 | |
22449
c87830c691a5
(instantiate-fontset): Delete
Kenichi Handa <handa@m17n.org>
parents:
22161
diff
changeset
|
339 (defun x-compose-font-name (fields &optional reduce) |
17052 | 340 "Compose X's fontname from FIELDS. |
88405 | 341 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
|
342 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
|
343 Optional argument REDUCE is always ignored. It exists just for |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
344 backward compatibility." |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
345 (concat "-" (mapconcat (lambda (x) (or x "*")) fields "-"))) |
23205
22df54cdb841
(resolved-ascii-font): New variable.
Kenichi Handa <handa@m17n.org>
parents:
23196
diff
changeset
|
346 |
40250
4f3033e5b688
(x-must-resolve-font-name): New
Gerd Moellmann <gerd@gnu.org>
parents:
38414
diff
changeset
|
347 (defun x-must-resolve-font-name (xlfd-fields) |
4f3033e5b688
(x-must-resolve-font-name): New
Gerd Moellmann <gerd@gnu.org>
parents:
38414
diff
changeset
|
348 "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
|
349 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
|
350 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
|
351 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
|
352 Value is name of that font." |
4f3033e5b688
(x-must-resolve-font-name): New
Gerd Moellmann <gerd@gnu.org>
parents:
38414
diff
changeset
|
353 (let ((ascii-font nil) (index 0)) |
88405 | 354 (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
|
355 (let ((pattern (x-compose-font-name xlfd-fields))) |
4f3033e5b688
(x-must-resolve-font-name): New
Gerd Moellmann <gerd@gnu.org>
parents:
38414
diff
changeset
|
356 (condition-case nil |
4f3033e5b688
(x-must-resolve-font-name): New
Gerd Moellmann <gerd@gnu.org>
parents:
38414
diff
changeset
|
357 (setq ascii-font (x-resolve-font-name pattern)) |
4f3033e5b688
(x-must-resolve-font-name): New
Gerd Moellmann <gerd@gnu.org>
parents:
38414
diff
changeset
|
358 (error |
4f3033e5b688
(x-must-resolve-font-name): New
Gerd Moellmann <gerd@gnu.org>
parents:
38414
diff
changeset
|
359 (message "Warning: no fonts matching `%s' available" pattern) |
4f3033e5b688
(x-must-resolve-font-name): New
Gerd Moellmann <gerd@gnu.org>
parents:
38414
diff
changeset
|
360 (aset xlfd-fields index "*") |
4f3033e5b688
(x-must-resolve-font-name): New
Gerd Moellmann <gerd@gnu.org>
parents:
38414
diff
changeset
|
361 (setq index (1+ index)))))) |
4f3033e5b688
(x-must-resolve-font-name): New
Gerd Moellmann <gerd@gnu.org>
parents:
38414
diff
changeset
|
362 (unless ascii-font |
4f3033e5b688
(x-must-resolve-font-name): New
Gerd Moellmann <gerd@gnu.org>
parents:
38414
diff
changeset
|
363 (error "No fonts founds")) |
4f3033e5b688
(x-must-resolve-font-name): New
Gerd Moellmann <gerd@gnu.org>
parents:
38414
diff
changeset
|
364 ascii-font)) |
4f3033e5b688
(x-must-resolve-font-name): New
Gerd Moellmann <gerd@gnu.org>
parents:
38414
diff
changeset
|
365 |
4f3033e5b688
(x-must-resolve-font-name): New
Gerd Moellmann <gerd@gnu.org>
parents:
38414
diff
changeset
|
366 |
17052 | 367 (defun x-complement-fontset-spec (xlfd-fields fontlist) |
28215
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
368 "Complement FONTLIST for charsets based on XLFD-FIELDS and return it. |
17052 | 369 XLFD-FIELDS is a vector of XLFD (X Logical Font Description) fields. |
22161
7a4c3fd89dda
(x-font-name-charset-alist): New
Kenichi Handa <handa@m17n.org>
parents:
22128
diff
changeset
|
370 FONTLIST is an alist of charsets vs the corresponding font names. |
17052 | 371 |
28215
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
372 The fonts are complemented as below. |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
373 |
88405 | 374 At first, if FONTLIST doesn't specify a font for ASCII charset, |
375 generate a font name for the charset from XLFD-FIELDS, and add that | |
376 information to FONTLIST. | |
28215
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
377 |
88405 | 378 Then, replace font names with the corresponding XLFD field vectors |
379 while substituting default field names for wild cards if they match | |
380 `xlfd-style-regexp'. The default field names are decided by | |
381 XLFD-FIELDS." | |
382 (let* ((default-spec (vector (aref xlfd-fields xlfd-regexp-family-subnum) | |
383 (aref xlfd-fields xlfd-regexp-weight-subnum) | |
384 (aref xlfd-fields xlfd-regexp-slant-subnum) | |
385 (aref xlfd-fields xlfd-regexp-swidth-subnum) | |
386 (aref xlfd-fields xlfd-regexp-adstyle-subnum) | |
387 (aref xlfd-fields xlfd-regexp-registry-subnum))) | |
388 (slot (assq 'ascii fontlist)) | |
88893
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
389 (ascii-font (cadr slot)) |
88405 | 390 xlfd-ascii) |
34917
989f2f0c8a7e
(x-complement-fontset-spec): Resolve
Kenichi Handa <handa@m17n.org>
parents:
34245
diff
changeset
|
391 (if ascii-font |
88405 | 392 (progn |
88893
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
393 (setq ascii-font (x-resolve-font-name ascii-font)) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
394 (setcar (cdr slot) ascii-font) |
88405 | 395 (setq xlfd-ascii (x-decompose-font-name ascii-font)) |
396 (dotimes (i 11) | |
397 (or (aref xlfd-fields i) | |
398 (aset xlfd-fields i (aref xlfd-ascii i))))) | |
34917
989f2f0c8a7e
(x-complement-fontset-spec): Resolve
Kenichi Handa <handa@m17n.org>
parents:
34245
diff
changeset
|
399 ;; If font for ASCII is not specified, add it. |
88405 | 400 (setq xlfd-ascii (copy-sequence xlfd-fields)) |
401 (aset xlfd-ascii xlfd-regexp-registry-subnum "iso8859-1") | |
402 (setq ascii-font (x-must-resolve-font-name xlfd-ascii)) | |
88893
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
403 (setq fontlist (cons (list 'ascii ascii-font) fontlist))) |
18350
3f4364889538
(x-charset-registries): Name changed for consistency:
Kenichi Handa <handa@m17n.org>
parents:
17989
diff
changeset
|
404 |
88405 | 405 (dolist (elt fontlist) |
88893
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
406 (let ((name (cadr elt)) |
88405 | 407 font-spec) |
408 (when (string-match xlfd-style-regexp name) | |
409 (setq font-spec (make-vector 6 nil)) | |
410 (dotimes (i 6) | |
411 (aset font-spec i (match-string (1+ i) name))) | |
412 (dotimes (i 6) | |
413 (if (string-match "^[*-]+$" (aref font-spec i)) | |
414 (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
|
415 (setcar (cdr elt) font-spec)))) |
88405 | 416 |
28215
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
417 fontlist)) |
17052 | 418 |
19049
cad4c032fa26
(fontset-name-p): New function.
Kenichi Handa <handa@m17n.org>
parents:
18719
diff
changeset
|
419 (defun fontset-name-p (fontset) |
cad4c032fa26
(fontset-name-p): New function.
Kenichi Handa <handa@m17n.org>
parents:
18719
diff
changeset
|
420 "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
|
421 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
|
422 with \"fontset\" in `<CHARSET_REGISTRY> field." |
cad4c032fa26
(fontset-name-p): New function.
Kenichi Handa <handa@m17n.org>
parents:
18719
diff
changeset
|
423 (and (string-match xlfd-tight-regexp fontset) |
cad4c032fa26
(fontset-name-p): New function.
Kenichi Handa <handa@m17n.org>
parents:
18719
diff
changeset
|
424 (string= (match-string (1+ xlfd-regexp-registry-subnum) fontset) |
cad4c032fa26
(fontset-name-p): New function.
Kenichi Handa <handa@m17n.org>
parents:
18719
diff
changeset
|
425 "fontset"))) |
cad4c032fa26
(fontset-name-p): New function.
Kenichi Handa <handa@m17n.org>
parents:
18719
diff
changeset
|
426 |
17052 | 427 ;; Return a list to be appended to `x-fixed-font-alist' when |
428 ;; `mouse-set-font' is called. | |
429 (defun generate-fontset-menu () | |
28215
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
430 (let ((fontsets (fontset-list)) |
17052 | 431 fontset-name |
432 l) | |
433 (while fontsets | |
28215
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
434 (setq fontset-name (car fontsets) fontsets (cdr fontsets)) |
17755
4c82e87c7d7c
(x-decompose-font-name): While seting each field of
Kenichi Handa <handa@m17n.org>
parents:
17339
diff
changeset
|
435 (setq l (cons (list (fontset-plain-name fontset-name) fontset-name) l))) |
24160
ab814ec4995e
(generate-fontset-menu): Return a
Kenichi Handa <handa@m17n.org>
parents:
24153
diff
changeset
|
436 (cons "Fontset" |
ab814ec4995e
(generate-fontset-menu): Return a
Kenichi Handa <handa@m17n.org>
parents:
24153
diff
changeset
|
437 (sort l (function (lambda (x y) (string< (car x) (car y)))))))) |
17052 | 438 |
439 (defun fontset-plain-name (fontset) | |
440 "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
|
441 (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
|
442 (error "Invalid fontset: %s" fontset)) |
17052 | 443 (let ((xlfd-fields (x-decompose-font-name fontset))) |
444 (if xlfd-fields | |
89004
fbd881940a45
(fontset-plain-name): If the fontset
Kenichi Handa <handa@m17n.org>
parents:
88893
diff
changeset
|
445 (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
|
446 (weight (aref xlfd-fields xlfd-regexp-weight-subnum)) |
17052 | 447 (slant (aref xlfd-fields xlfd-regexp-slant-subnum)) |
448 (swidth (aref xlfd-fields xlfd-regexp-swidth-subnum)) | |
449 (size (aref xlfd-fields xlfd-regexp-pixelsize-subnum)) | |
88405 | 450 (nickname (aref xlfd-fields xlfd-regexp-registry-subnum)) |
17052 | 451 name) |
88405 | 452 (if (not (string-match "^fontset-\\(.*\\)$" nickname)) |
89004
fbd881940a45
(fontset-plain-name): If the fontset
Kenichi Handa <handa@m17n.org>
parents:
88893
diff
changeset
|
453 (setq nickname family) |
fbd881940a45
(fontset-plain-name): If the fontset
Kenichi Handa <handa@m17n.org>
parents:
88893
diff
changeset
|
454 (setq nickname (match-string 1 nickname))) |
fbd881940a45
(fontset-plain-name): If the fontset
Kenichi Handa <handa@m17n.org>
parents:
88893
diff
changeset
|
455 (if (and size (> (string-to-int size) 0)) |
fbd881940a45
(fontset-plain-name): If the fontset
Kenichi Handa <handa@m17n.org>
parents:
88893
diff
changeset
|
456 (setq name (format "%s: %s-dot" nickname size)) |
fbd881940a45
(fontset-plain-name): If the fontset
Kenichi Handa <handa@m17n.org>
parents:
88893
diff
changeset
|
457 (setq name nickname)) |
fbd881940a45
(fontset-plain-name): If the fontset
Kenichi Handa <handa@m17n.org>
parents:
88893
diff
changeset
|
458 (and weight |
fbd881940a45
(fontset-plain-name): If the fontset
Kenichi Handa <handa@m17n.org>
parents:
88893
diff
changeset
|
459 (cond ((string-match "^medium$" weight) |
fbd881940a45
(fontset-plain-name): If the fontset
Kenichi Handa <handa@m17n.org>
parents:
88893
diff
changeset
|
460 (setq name (concat name " " "medium"))) |
fbd881940a45
(fontset-plain-name): If the fontset
Kenichi Handa <handa@m17n.org>
parents:
88893
diff
changeset
|
461 ((string-match "^bold$\\|^demibold$" weight) |
fbd881940a45
(fontset-plain-name): If the fontset
Kenichi Handa <handa@m17n.org>
parents:
88893
diff
changeset
|
462 (setq name (concat name " " weight))))) |
fbd881940a45
(fontset-plain-name): If the fontset
Kenichi Handa <handa@m17n.org>
parents:
88893
diff
changeset
|
463 (and slant |
fbd881940a45
(fontset-plain-name): If the fontset
Kenichi Handa <handa@m17n.org>
parents:
88893
diff
changeset
|
464 (cond ((string-match "^i$" slant) |
fbd881940a45
(fontset-plain-name): If the fontset
Kenichi Handa <handa@m17n.org>
parents:
88893
diff
changeset
|
465 (setq name (concat name " " "italic"))) |
fbd881940a45
(fontset-plain-name): If the fontset
Kenichi Handa <handa@m17n.org>
parents:
88893
diff
changeset
|
466 ((string-match "^o$" slant) |
fbd881940a45
(fontset-plain-name): If the fontset
Kenichi Handa <handa@m17n.org>
parents:
88893
diff
changeset
|
467 (setq name (concat name " " "slant"))) |
fbd881940a45
(fontset-plain-name): If the fontset
Kenichi Handa <handa@m17n.org>
parents:
88893
diff
changeset
|
468 ((string-match "^ri$" slant) |
fbd881940a45
(fontset-plain-name): If the fontset
Kenichi Handa <handa@m17n.org>
parents:
88893
diff
changeset
|
469 (setq name (concat name " " "reverse italic"))) |
fbd881940a45
(fontset-plain-name): If the fontset
Kenichi Handa <handa@m17n.org>
parents:
88893
diff
changeset
|
470 ((string-match "^ro$" slant) |
fbd881940a45
(fontset-plain-name): If the fontset
Kenichi Handa <handa@m17n.org>
parents:
88893
diff
changeset
|
471 (setq name (concat name " " "reverse slant"))))) |
fbd881940a45
(fontset-plain-name): If the fontset
Kenichi Handa <handa@m17n.org>
parents:
88893
diff
changeset
|
472 name) |
17052 | 473 fontset))) |
474 | |
88893
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
475 (defvar charset-script-alist |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
476 '((ascii . ascii) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
477 (latin-iso8859-1 . latin) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
478 (latin-iso8859-2 . latin) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
479 (latin-iso8859-3 . latin) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
480 (latin-iso8859-4 . latin) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
481 (latin-iso8859-9 . latin) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
482 (latin-iso8859-10 . latin) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
483 (latin-iso8859-13 . latin) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
484 (latin-iso8859-14 . latin) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
485 (latin-iso8859-15 . latin) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
486 (latin-iso8859-16 . latin) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
487 (latin-jisx0201 . latin) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
488 (thai-tis620 . thai) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
489 (cyrillic-iso8859-5 . cyrillic) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
490 (arabic-iso8859-6 . arabic) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
491 (greek-iso8859-7 . latin) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
492 (hebrew-iso8859-8 . latin) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
493 (katakana-jisx0201 . katakana-halfwidth) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
494 (chinese-gb2312 . han) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
495 (chinese-big5-1 . han) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
496 (chinese-big5-2 . han) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
497 (chinese-cns11643-1 . han) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
498 (chinese-cns11643-2 . han) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
499 (chinese-cns11643-3 . han) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
500 (chinese-cns11643-4 . han) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
501 (chinese-cns11643-5 . han) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
502 (chinese-cns11643-6 . han) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
503 (chinese-cns11643-7 . han) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
504 (japanese-jisx0208 . han) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
505 (japanese-jisx0208-1978 . han) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
506 (japanese-jisx0212 . han) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
507 (japanese-jisx0213-1 . han) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
508 (japanese-jisx0213-2 . han) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
509 (korean-ksc5601 . hangul-syllable) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
510 (chinese-sisheng . bopomofo) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
511 (vietnamese-viscii-lower . latin) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
512 (vietnamese-viscii-upper . latin) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
513 (arabic-digit . arabic) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
514 (arabic-1-column . arabic) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
515 (arabic-2-column . arabic) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
516 (indian-is13194 . devanagari) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
517 (indian-glyph . devanagari) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
518 (indian-1-column . devanagari) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
519 (indian-2-column . devanagari) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
520 (tibetan-1-column . tibetan)) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
521 "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
|
522 |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
523 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
|
524 to map charsets to scripts.") |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
525 |
22128
8f7a59fc78db
(create-fontset-from-fontset-spec): Add autoload cookie.
Richard M. Stallman <rms@gnu.org>
parents:
19771
diff
changeset
|
526 ;;;###autoload |
22161
7a4c3fd89dda
(x-font-name-charset-alist): New
Kenichi Handa <handa@m17n.org>
parents:
22128
diff
changeset
|
527 (defun create-fontset-from-fontset-spec (fontset-spec |
22449
c87830c691a5
(instantiate-fontset): Delete
Kenichi Handa <handa@m17n.org>
parents:
22161
diff
changeset
|
528 &optional style-variant noerror) |
17052 | 529 "Create a fontset from fontset specification string FONTSET-SPEC. |
530 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
|
531 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
|
532 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
|
533 |
28215
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
534 Optional 2nd argument is ignored. It exists just for backward |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
535 compatibility. |
22449
c87830c691a5
(instantiate-fontset): Delete
Kenichi Handa <handa@m17n.org>
parents:
22161
diff
changeset
|
536 |
18719
de8249499f33
(create-fontset-from-fontset-spec): Typo in doc-string fixed.
Kenichi Handa <handa@m17n.org>
parents:
18714
diff
changeset
|
537 If this function attempts to create already existing fontset, error is |
22672
9cfa1a788a5a
(create-fontset-from-fontset-spec):
Kenichi Handa <handa@m17n.org>
parents:
22618
diff
changeset
|
538 signaled unless the optional 3rd argument NOERROR is non-nil. |
9cfa1a788a5a
(create-fontset-from-fontset-spec):
Kenichi Handa <handa@m17n.org>
parents:
22618
diff
changeset
|
539 |
88893
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
540 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
|
541 |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
542 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
|
543 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
|
544 `charset-script-alist' (which see)." |
17755
4c82e87c7d7c
(x-decompose-font-name): While seting each field of
Kenichi Handa <handa@m17n.org>
parents:
17339
diff
changeset
|
545 (if (not (string-match "^[^,]+" fontset-spec)) |
4c82e87c7d7c
(x-decompose-font-name): While seting each field of
Kenichi Handa <handa@m17n.org>
parents:
17339
diff
changeset
|
546 (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
|
547 (let ((idx (match-end 0)) |
4c82e87c7d7c
(x-decompose-font-name): While seting each field of
Kenichi Handa <handa@m17n.org>
parents:
17339
diff
changeset
|
548 (name (match-string 0 fontset-spec)) |
88893
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
549 xlfd-fields script fontlist ascii-font) |
22161
7a4c3fd89dda
(x-font-name-charset-alist): New
Kenichi Handa <handa@m17n.org>
parents:
22128
diff
changeset
|
550 (if (query-fontset name) |
7a4c3fd89dda
(x-font-name-charset-alist): New
Kenichi Handa <handa@m17n.org>
parents:
22128
diff
changeset
|
551 (or noerror |
23655
8aa7d51024b2
(create-fontset-from-fontset-spec): Give correct arg to `error'.
Kenichi Handa <handa@m17n.org>
parents:
23205
diff
changeset
|
552 (error "Fontset \"%s\" already exists" name)) |
28215
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
553 (setq xlfd-fields (x-decompose-font-name name)) |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
554 (or xlfd-fields |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
555 (error "Fontset \"%s\" not conforming to XLFD" name)) |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
556 |
22161
7a4c3fd89dda
(x-font-name-charset-alist): New
Kenichi Handa <handa@m17n.org>
parents:
22128
diff
changeset
|
557 ;; At first, extract pairs of charset and fontname from FONTSET-SPEC. |
7a4c3fd89dda
(x-font-name-charset-alist): New
Kenichi Handa <handa@m17n.org>
parents:
22128
diff
changeset
|
558 (while (string-match "[, \t\n]*\\([^:]+\\):\\([^,]+\\)" fontset-spec idx) |
7a4c3fd89dda
(x-font-name-charset-alist): New
Kenichi Handa <handa@m17n.org>
parents:
22128
diff
changeset
|
559 (setq idx (match-end 0)) |
88893
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
560 (setq script (intern (match-string 1 fontset-spec))) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
561 (if (or (memq script (char-table-extra-slot char-script-table 0)) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
562 (setq script (cdr (assq script charset-script-alist)))) |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
563 (setq fontlist (cons (list script (match-string 2 fontset-spec)) |
22161
7a4c3fd89dda
(x-font-name-charset-alist): New
Kenichi Handa <handa@m17n.org>
parents:
22128
diff
changeset
|
564 fontlist)))) |
88893
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
565 (setq ascii-font (cadr (assq 'ascii fontlist))) |
22449
c87830c691a5
(instantiate-fontset): Delete
Kenichi Handa <handa@m17n.org>
parents:
22161
diff
changeset
|
566 |
28215
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
567 ;; Complement FONTLIST. |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
568 (setq fontlist (x-complement-fontset-spec xlfd-fields fontlist)) |
88405 | 569 (setq name (x-compose-font-name xlfd-fields)) |
28215
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
570 (new-fontset name fontlist) |
22161
7a4c3fd89dda
(x-font-name-charset-alist): New
Kenichi Handa <handa@m17n.org>
parents:
22128
diff
changeset
|
571 |
28215
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
572 ;; Define the short name alias. |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
573 (if (and (string-match "fontset-.*$" name) |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
574 (not (assoc name fontset-alias-alist))) |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
575 (let ((alias (match-string 0 name))) |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
576 (or (rassoc alias fontset-alias-alist) |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
577 (setq fontset-alias-alist |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
578 (cons (cons name alias) fontset-alias-alist))))) |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
579 |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
580 ;; Define the ASCII font name alias. |
34917
989f2f0c8a7e
(x-complement-fontset-spec): Resolve
Kenichi Handa <handa@m17n.org>
parents:
34245
diff
changeset
|
581 (or ascii-font |
989f2f0c8a7e
(x-complement-fontset-spec): Resolve
Kenichi Handa <handa@m17n.org>
parents:
34245
diff
changeset
|
582 (setq ascii-font (cdr (assq 'ascii fontlist)))) |
28215
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
583 (or (rassoc ascii-font fontset-alias-alist) |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
584 (setq fontset-alias-alist |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
585 (cons (cons name ascii-font) |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
586 fontset-alias-alist)))) |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
587 |
22672
9cfa1a788a5a
(create-fontset-from-fontset-spec):
Kenichi Handa <handa@m17n.org>
parents:
22618
diff
changeset
|
588 name)) |
9cfa1a788a5a
(create-fontset-from-fontset-spec):
Kenichi Handa <handa@m17n.org>
parents:
22618
diff
changeset
|
589 |
9cfa1a788a5a
(create-fontset-from-fontset-spec):
Kenichi Handa <handa@m17n.org>
parents:
22618
diff
changeset
|
590 (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
|
591 fontset-name) |
9cfa1a788a5a
(create-fontset-from-fontset-spec):
Kenichi Handa <handa@m17n.org>
parents:
22618
diff
changeset
|
592 "Create a fontset from an ASCII font FONT. |
9cfa1a788a5a
(create-fontset-from-fontset-spec):
Kenichi Handa <handa@m17n.org>
parents:
22618
diff
changeset
|
593 |
9cfa1a788a5a
(create-fontset-from-fontset-spec):
Kenichi Handa <handa@m17n.org>
parents:
22618
diff
changeset
|
594 Optional 1st arg RESOLVED-FONT is a resolved name of FONT. If |
9cfa1a788a5a
(create-fontset-from-fontset-spec):
Kenichi Handa <handa@m17n.org>
parents:
22618
diff
changeset
|
595 omitted, x-resolve-font-name is called to get the resolved name. At |
22720
ab4f30149aa0
(x-complement-fontset-spec): Typo fixed.
Kenichi Handa <handa@m17n.org>
parents:
22672
diff
changeset
|
596 this time, if FONT is not available, error is signaled. |
22672
9cfa1a788a5a
(create-fontset-from-fontset-spec):
Kenichi Handa <handa@m17n.org>
parents:
22618
diff
changeset
|
597 |
9cfa1a788a5a
(create-fontset-from-fontset-spec):
Kenichi Handa <handa@m17n.org>
parents:
22618
diff
changeset
|
598 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
|
599 `<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
|
600 an appropriate name is generated automatically. |
9cfa1a788a5a
(create-fontset-from-fontset-spec):
Kenichi Handa <handa@m17n.org>
parents:
22618
diff
changeset
|
601 |
9cfa1a788a5a
(create-fontset-from-fontset-spec):
Kenichi Handa <handa@m17n.org>
parents:
22618
diff
changeset
|
602 It returns a name of the created fontset." |
28215
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
603 (setq font (downcase font)) |
88893
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
604 (setq resolved-font |
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
605 (downcase (or resolved-font (x-resolve-font-name font)))) |
88405 | 606 (let ((xlfd (x-decompose-font-name resolved-font)) |
607 fontset) | |
28215
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
608 (if fontset-name |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
609 (setq fontset-name (downcase fontset-name)) |
89004
fbd881940a45
(fontset-plain-name): If the fontset
Kenichi Handa <handa@m17n.org>
parents:
88893
diff
changeset
|
610 (if (query-fontset "fontset-startup") |
fbd881940a45
(fontset-plain-name): If the fontset
Kenichi Handa <handa@m17n.org>
parents:
88893
diff
changeset
|
611 (setq fontset-name |
fbd881940a45
(fontset-plain-name): If the fontset
Kenichi Handa <handa@m17n.org>
parents:
88893
diff
changeset
|
612 (subst-char-in-string |
fbd881940a45
(fontset-plain-name): If the fontset
Kenichi Handa <handa@m17n.org>
parents:
88893
diff
changeset
|
613 ?- ?_ (aref xlfd xlfd-regexp-registry-subnum) t)) |
fbd881940a45
(fontset-plain-name): If the fontset
Kenichi Handa <handa@m17n.org>
parents:
88893
diff
changeset
|
614 (setq fontset-name "startup"))) |
88405 | 615 (aset xlfd xlfd-regexp-registry-subnum |
616 (format "fontset-%s" fontset-name)) | |
22672
9cfa1a788a5a
(create-fontset-from-fontset-spec):
Kenichi Handa <handa@m17n.org>
parents:
22618
diff
changeset
|
617 (setq fontset (x-compose-font-name xlfd)) |
9cfa1a788a5a
(create-fontset-from-fontset-spec):
Kenichi Handa <handa@m17n.org>
parents:
22618
diff
changeset
|
618 (or (query-fontset fontset) |
28215
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
619 (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
|
620 |
17052 | 621 |
17842
cb1af8ead3df
(standard-fontset-spec): Name changed from
Kenichi Handa <handa@m17n.org>
parents:
17755
diff
changeset
|
622 ;; 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
|
623 ;; 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
|
624 ;; 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
|
625 ;; many cases. |
17842
cb1af8ead3df
(standard-fontset-spec): Name changed from
Kenichi Handa <handa@m17n.org>
parents:
17755
diff
changeset
|
626 (defvar standard-fontset-spec |
88405 | 627 (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
|
628 "String of fontset spec of the standard fontset. |
cb1af8ead3df
(standard-fontset-spec): Name changed from
Kenichi Handa <handa@m17n.org>
parents:
17755
diff
changeset
|
629 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
|
630 with correct glyphs by using the standard fontset. |
17052 | 631 See the documentation of `create-fontset-from-fontset-spec' for the format.") |
632 | |
88893
86354924a790
Setup the default fontset by the new
Kenichi Handa <handa@m17n.org>
parents:
88694
diff
changeset
|
633 |
17052 | 634 ;; Create fontsets from X resources of the name `fontset-N (class |
635 ;; Fontset-N)' where N is integer 0, 1, ... | |
636 ;; 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
|
637 ;; `standard-fontset-spec'. |
17052 | 638 |
639 (defun create-fontset-from-x-resource () | |
640 (let ((idx 0) | |
641 fontset-spec) | |
27534
eeb998860456
(standard-fontset-spec): Purecopy it.
Dave Love <fx@gnu.org>
parents:
26886
diff
changeset
|
642 (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
|
643 (format "Fontset-%d" idx))) |
24153
729affdf2ca1
(create-fontset-from-x-resource): Make style variants.
Kenichi Handa <handa@m17n.org>
parents:
23890
diff
changeset
|
644 (create-fontset-from-fontset-spec fontset-spec t 'noerror) |
17052 | 645 (setq idx (1+ idx))))) |
646 | |
647 ;; | |
648 (provide 'fontset) | |
649 | |
650 ;;; fontset.el ends here |