Mercurial > emacs
annotate lisp/international/fontset.el @ 39475:4a1c429dd4e3
(list-input-methods-1): Output
something that's independent of Emacs' version.
author | Gerd Moellmann <gerd@gnu.org> |
---|---|
date | Thu, 27 Sep 2001 09:22:39 +0000 |
parents | 67b464da13ec |
children | 4f3033e5b688 |
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. |
17052 | 5 |
6 ;; Keywords: mule, multilingual, fontset | |
7 | |
8 ;; This file is part of GNU Emacs. | |
9 | |
10 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
11 ;; it under the terms of the GNU General Public License as published by | |
12 ;; the Free Software Foundation; either version 2, or (at your option) | |
13 ;; any later version. | |
14 | |
15 ;; GNU Emacs is distributed in the hope that it will be useful, | |
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 ;; GNU General Public License for more details. | |
19 | |
20 ;; You should have received a copy of the GNU General Public License | |
17071 | 21 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
23 ;; Boston, MA 02111-1307, USA. | |
17052 | 24 |
38414
67b464da13ec
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
36368
diff
changeset
|
25 ;;; Commentary: |
67b464da13ec
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
36368
diff
changeset
|
26 |
17052 | 27 ;;; Code: |
28 | |
29234
c9a5f356fe77
Set family names of non-latin charsets in default fontset to "*".
Kenichi Handa <handa@m17n.org>
parents:
29168
diff
changeset
|
29 ;; Set standard fontname specification of characters in the default |
c9a5f356fe77
Set family names of non-latin charsets in default fontset to "*".
Kenichi Handa <handa@m17n.org>
parents:
29168
diff
changeset
|
30 ;; fontset to find an appropriate font for each charset. This is used |
c9a5f356fe77
Set family names of non-latin charsets in default fontset to "*".
Kenichi Handa <handa@m17n.org>
parents:
29168
diff
changeset
|
31 ;; to generate a font name for a fontset if the fontset doesn't |
c9a5f356fe77
Set family names of non-latin charsets in default fontset to "*".
Kenichi Handa <handa@m17n.org>
parents:
29168
diff
changeset
|
32 ;; specify a font name for a specific character. The specification |
c9a5f356fe77
Set family names of non-latin charsets in default fontset to "*".
Kenichi Handa <handa@m17n.org>
parents:
29168
diff
changeset
|
33 ;; has the form (FAMILY . REGISTRY). FAMILY may be nil, in which |
c9a5f356fe77
Set family names of non-latin charsets in default fontset to "*".
Kenichi Handa <handa@m17n.org>
parents:
29168
diff
changeset
|
34 ;; case, the family name of default face is used. If REGISTRY |
c9a5f356fe77
Set family names of non-latin charsets in default fontset to "*".
Kenichi Handa <handa@m17n.org>
parents:
29168
diff
changeset
|
35 ;; 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
|
36 ;; `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
|
37 ;; `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
|
38 ;; string is embedded in `CHARSET_REGISTRY' field, and a wild card |
c9a5f356fe77
Set family names of non-latin charsets in default fontset to "*".
Kenichi Handa <handa@m17n.org>
parents:
29168
diff
changeset
|
39 ;; character `*' is embedded in `CHARSET_ENCODING' field. The |
c9a5f356fe77
Set family names of non-latin charsets in default fontset to "*".
Kenichi Handa <handa@m17n.org>
parents:
29168
diff
changeset
|
40 ;; REGISTRY for ASCII characters are predefined as "ISO8859-1". |
17052 | 41 |
29234
c9a5f356fe77
Set family names of non-latin charsets in default fontset to "*".
Kenichi Handa <handa@m17n.org>
parents:
29168
diff
changeset
|
42 (let ((l `((latin-iso8859-1 . (nil . "ISO8859-1")) |
c9a5f356fe77
Set family names of non-latin charsets in default fontset to "*".
Kenichi Handa <handa@m17n.org>
parents:
29168
diff
changeset
|
43 (latin-iso8859-2 . (nil . "ISO8859-2")) |
c9a5f356fe77
Set family names of non-latin charsets in default fontset to "*".
Kenichi Handa <handa@m17n.org>
parents:
29168
diff
changeset
|
44 (latin-iso8859-3 . (nil . "ISO8859-3")) |
c9a5f356fe77
Set family names of non-latin charsets in default fontset to "*".
Kenichi Handa <handa@m17n.org>
parents:
29168
diff
changeset
|
45 (latin-iso8859-4 . (nil . "ISO8859-4")) |
c9a5f356fe77
Set family names of non-latin charsets in default fontset to "*".
Kenichi Handa <handa@m17n.org>
parents:
29168
diff
changeset
|
46 (thai-tis620 . ("*" . "TIS620")) |
c9a5f356fe77
Set family names of non-latin charsets in default fontset to "*".
Kenichi Handa <handa@m17n.org>
parents:
29168
diff
changeset
|
47 (greek-iso8859-7 . ("*" . "ISO8859-7")) |
c9a5f356fe77
Set family names of non-latin charsets in default fontset to "*".
Kenichi Handa <handa@m17n.org>
parents:
29168
diff
changeset
|
48 (arabic-iso8859-6 . ("*" . "ISO8859-6")) |
c9a5f356fe77
Set family names of non-latin charsets in default fontset to "*".
Kenichi Handa <handa@m17n.org>
parents:
29168
diff
changeset
|
49 (hebrew-iso8859-8 . ("*" . "ISO8859-8")) |
c9a5f356fe77
Set family names of non-latin charsets in default fontset to "*".
Kenichi Handa <handa@m17n.org>
parents:
29168
diff
changeset
|
50 (katakana-jisx0201 . ("*" . "JISX0201")) |
c9a5f356fe77
Set family names of non-latin charsets in default fontset to "*".
Kenichi Handa <handa@m17n.org>
parents:
29168
diff
changeset
|
51 (latin-jisx0201 . (nil . "JISX0201")) |
c9a5f356fe77
Set family names of non-latin charsets in default fontset to "*".
Kenichi Handa <handa@m17n.org>
parents:
29168
diff
changeset
|
52 (cyrillic-iso8859-5 . ("*" . "ISO8859-5")) |
c9a5f356fe77
Set family names of non-latin charsets in default fontset to "*".
Kenichi Handa <handa@m17n.org>
parents:
29168
diff
changeset
|
53 (latin-iso8859-9 . (nil . "ISO8859-9")) |
c9a5f356fe77
Set family names of non-latin charsets in default fontset to "*".
Kenichi Handa <handa@m17n.org>
parents:
29168
diff
changeset
|
54 (japanese-jisx0208-1978 . ("*" . "JISX0208.1978")) |
34163
faa3e4d4deea
Change the font registries for CJK
Kenichi Handa <handa@m17n.org>
parents:
33048
diff
changeset
|
55 (chinese-gb2312 . ("*" . "GB2312.1980")) |
faa3e4d4deea
Change the font registries for CJK
Kenichi Handa <handa@m17n.org>
parents:
33048
diff
changeset
|
56 (japanese-jisx0208 . ("*" . "JISX0208.1990")) |
faa3e4d4deea
Change the font registries for CJK
Kenichi Handa <handa@m17n.org>
parents:
33048
diff
changeset
|
57 (korean-ksc5601 . ("*" . "KSC5601.1989")) |
29234
c9a5f356fe77
Set family names of non-latin charsets in default fontset to "*".
Kenichi Handa <handa@m17n.org>
parents:
29168
diff
changeset
|
58 (japanese-jisx0212 . ("*" . "JISX0212")) |
c9a5f356fe77
Set family names of non-latin charsets in default fontset to "*".
Kenichi Handa <handa@m17n.org>
parents:
29168
diff
changeset
|
59 (chinese-cns11643-1 . ("*" . "CNS11643.1992-1")) |
c9a5f356fe77
Set family names of non-latin charsets in default fontset to "*".
Kenichi Handa <handa@m17n.org>
parents:
29168
diff
changeset
|
60 (chinese-cns11643-2 . ("*" . "CNS11643.1992-2")) |
c9a5f356fe77
Set family names of non-latin charsets in default fontset to "*".
Kenichi Handa <handa@m17n.org>
parents:
29168
diff
changeset
|
61 (chinese-cns11643-3 . ("*" . "CNS11643.1992-3")) |
c9a5f356fe77
Set family names of non-latin charsets in default fontset to "*".
Kenichi Handa <handa@m17n.org>
parents:
29168
diff
changeset
|
62 (chinese-cns11643-4 . ("*" . "CNS11643.1992-4")) |
c9a5f356fe77
Set family names of non-latin charsets in default fontset to "*".
Kenichi Handa <handa@m17n.org>
parents:
29168
diff
changeset
|
63 (chinese-cns11643-5 . ("*" . "CNS11643.1992-5")) |
c9a5f356fe77
Set family names of non-latin charsets in default fontset to "*".
Kenichi Handa <handa@m17n.org>
parents:
29168
diff
changeset
|
64 (chinese-cns11643-6 . ("*" . "CNS11643.1992-6")) |
c9a5f356fe77
Set family names of non-latin charsets in default fontset to "*".
Kenichi Handa <handa@m17n.org>
parents:
29168
diff
changeset
|
65 (chinese-cns11643-7 . ("*" . "CNS11643.1992-7")) |
c9a5f356fe77
Set family names of non-latin charsets in default fontset to "*".
Kenichi Handa <handa@m17n.org>
parents:
29168
diff
changeset
|
66 (chinese-big5-1 . ("*" . "Big5")) |
c9a5f356fe77
Set family names of non-latin charsets in default fontset to "*".
Kenichi Handa <handa@m17n.org>
parents:
29168
diff
changeset
|
67 (chinese-big5-2 . ("*" . "Big5")) |
c9a5f356fe77
Set family names of non-latin charsets in default fontset to "*".
Kenichi Handa <handa@m17n.org>
parents:
29168
diff
changeset
|
68 (chinese-sisheng . (nil . "sisheng_cwnn")) |
c9a5f356fe77
Set family names of non-latin charsets in default fontset to "*".
Kenichi Handa <handa@m17n.org>
parents:
29168
diff
changeset
|
69 (vietnamese-viscii-lower . (nil . "VISCII1.1")) |
c9a5f356fe77
Set family names of non-latin charsets in default fontset to "*".
Kenichi Handa <handa@m17n.org>
parents:
29168
diff
changeset
|
70 (vietnamese-viscii-upper . (nil . "VISCII1.1")) |
c9a5f356fe77
Set family names of non-latin charsets in default fontset to "*".
Kenichi Handa <handa@m17n.org>
parents:
29168
diff
changeset
|
71 (arabic-digit . ("*" . "MuleArabic-0")) |
c9a5f356fe77
Set family names of non-latin charsets in default fontset to "*".
Kenichi Handa <handa@m17n.org>
parents:
29168
diff
changeset
|
72 (arabic-1-column . ("*" . "MuleArabic-1")) |
c9a5f356fe77
Set family names of non-latin charsets in default fontset to "*".
Kenichi Handa <handa@m17n.org>
parents:
29168
diff
changeset
|
73 (arabic-2-column . ("*" . "MuleArabic-2")) |
c9a5f356fe77
Set family names of non-latin charsets in default fontset to "*".
Kenichi Handa <handa@m17n.org>
parents:
29168
diff
changeset
|
74 (ipa . (nil . "MuleIPA")) |
c9a5f356fe77
Set family names of non-latin charsets in default fontset to "*".
Kenichi Handa <handa@m17n.org>
parents:
29168
diff
changeset
|
75 (ethiopic . ("*" . "Ethiopic-Unicode")) |
c9a5f356fe77
Set family names of non-latin charsets in default fontset to "*".
Kenichi Handa <handa@m17n.org>
parents:
29168
diff
changeset
|
76 (ascii-right-to-left . (nil . "ISO8859-1")) |
c9a5f356fe77
Set family names of non-latin charsets in default fontset to "*".
Kenichi Handa <handa@m17n.org>
parents:
29168
diff
changeset
|
77 (indian-is13194 . ("*" . "IS13194-Devanagari")) |
c9a5f356fe77
Set family names of non-latin charsets in default fontset to "*".
Kenichi Handa <handa@m17n.org>
parents:
29168
diff
changeset
|
78 (indian-2-column . ("*" . "MuleIndian-2")) |
c9a5f356fe77
Set family names of non-latin charsets in default fontset to "*".
Kenichi Handa <handa@m17n.org>
parents:
29168
diff
changeset
|
79 (indian-1-column . ("*" . "MuleIndian-1")) |
c9a5f356fe77
Set family names of non-latin charsets in default fontset to "*".
Kenichi Handa <handa@m17n.org>
parents:
29168
diff
changeset
|
80 (lao . ("*" . "MuleLao-1")) |
32646
43edadfecb51
Use registry "MuleTibetan-2" for Tibetan.
Kenichi Handa <handa@m17n.org>
parents:
29427
diff
changeset
|
81 (tibetan . ("proportional" . "MuleTibetan-2")) |
29234
c9a5f356fe77
Set family names of non-latin charsets in default fontset to "*".
Kenichi Handa <handa@m17n.org>
parents:
29168
diff
changeset
|
82 (tibetan-1-column . ("*" . "MuleTibetan-1")) |
c9a5f356fe77
Set family names of non-latin charsets in default fontset to "*".
Kenichi Handa <handa@m17n.org>
parents:
29168
diff
changeset
|
83 (latin-iso8859-14 . (nil . "ISO8859-14")) |
c9a5f356fe77
Set family names of non-latin charsets in default fontset to "*".
Kenichi Handa <handa@m17n.org>
parents:
29168
diff
changeset
|
84 (latin-iso8859-15 . (nil . "ISO8859-15")) |
c9a5f356fe77
Set family names of non-latin charsets in default fontset to "*".
Kenichi Handa <handa@m17n.org>
parents:
29168
diff
changeset
|
85 (mule-unicode-0100-24ff . (nil . "ISO10646-1")) |
33048
636ac3744ddd
(fontset-default): Modified for mule-unicode-2500-33ff and
Kenichi Handa <handa@m17n.org>
parents:
32646
diff
changeset
|
86 (mule-unicode-2500-33ff . (nil . "ISO10646-1")) |
636ac3744ddd
(fontset-default): Modified for mule-unicode-2500-33ff and
Kenichi Handa <handa@m17n.org>
parents:
32646
diff
changeset
|
87 (mule-unicode-e000-ffff . (nil . "ISO10646-1")) |
34245
b31daef799a1
Correct the font registries for
Kenichi Handa <handa@m17n.org>
parents:
34163
diff
changeset
|
88 (japanese-jisx0213-1 . ("*" . "JISX0213.2000-1")) |
b31daef799a1
Correct the font registries for
Kenichi Handa <handa@m17n.org>
parents:
34163
diff
changeset
|
89 (japanese-jisx0213-2 . ("*" . "JISX0213.2000-2")) |
28215
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
90 )) |
29234
c9a5f356fe77
Set family names of non-latin charsets in default fontset to "*".
Kenichi Handa <handa@m17n.org>
parents:
29168
diff
changeset
|
91 charset font-spec arg) |
17052 | 92 (while l |
29234
c9a5f356fe77
Set family names of non-latin charsets in default fontset to "*".
Kenichi Handa <handa@m17n.org>
parents:
29168
diff
changeset
|
93 (setq charset (car (car l)) font-spec (cdr (car l)) l (cdr l)) |
28215
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
94 (if (symbolp charset) |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
95 (setq arg (make-char charset)) |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
96 (setq arg charset)) |
29234
c9a5f356fe77
Set family names of non-latin charsets in default fontset to "*".
Kenichi Handa <handa@m17n.org>
parents:
29168
diff
changeset
|
97 (set-fontset-font "fontset-default" arg font-spec))) |
17052 | 98 |
99 ;; Set arguments in `font-encoding-alist' (which see). | |
100 (defun set-font-encoding (pattern charset encoding) | |
101 (let ((slot (assoc pattern font-encoding-alist))) | |
102 (if slot | |
103 (let ((place (assq charset (cdr slot)))) | |
104 (if place | |
105 (setcdr place encoding) | |
106 (setcdr slot (cons (cons charset encoding) (cdr slot))))) | |
107 (setq font-encoding-alist | |
108 (cons (list pattern (cons charset encoding)) font-encoding-alist))) | |
109 )) | |
110 | |
111 (set-font-encoding "ISO8859-1" 'ascii 0) | |
112 (set-font-encoding "JISX0201" 'latin-jisx0201 0) | |
113 | |
33048
636ac3744ddd
(fontset-default): Modified for mule-unicode-2500-33ff and
Kenichi Handa <handa@m17n.org>
parents:
32646
diff
changeset
|
114 (define-ccl-program ccl-encode-unicode-font |
32646
43edadfecb51
Use registry "MuleTibetan-2" for Tibetan.
Kenichi Handa <handa@m17n.org>
parents:
29427
diff
changeset
|
115 `(0 |
33048
636ac3744ddd
(fontset-default): Modified for mule-unicode-2500-33ff and
Kenichi Handa <handa@m17n.org>
parents:
32646
diff
changeset
|
116 (if (r0 == ,(charset-id 'ascii)) |
636ac3744ddd
(fontset-default): Modified for mule-unicode-2500-33ff and
Kenichi Handa <handa@m17n.org>
parents:
32646
diff
changeset
|
117 ((r2 = r1) |
636ac3744ddd
(fontset-default): Modified for mule-unicode-2500-33ff and
Kenichi Handa <handa@m17n.org>
parents:
32646
diff
changeset
|
118 (r1 = 0)) |
636ac3744ddd
(fontset-default): Modified for mule-unicode-2500-33ff and
Kenichi Handa <handa@m17n.org>
parents:
32646
diff
changeset
|
119 (if (r0 == ,(charset-id 'latin-iso8859-1)) |
636ac3744ddd
(fontset-default): Modified for mule-unicode-2500-33ff and
Kenichi Handa <handa@m17n.org>
parents:
32646
diff
changeset
|
120 ((r2 = (r1 + 128)) |
636ac3744ddd
(fontset-default): Modified for mule-unicode-2500-33ff and
Kenichi Handa <handa@m17n.org>
parents:
32646
diff
changeset
|
121 (r1 = 0)) |
636ac3744ddd
(fontset-default): Modified for mule-unicode-2500-33ff and
Kenichi Handa <handa@m17n.org>
parents:
32646
diff
changeset
|
122 (if (r0 == ,(charset-id 'mule-unicode-0100-24ff)) |
636ac3744ddd
(fontset-default): Modified for mule-unicode-2500-33ff and
Kenichi Handa <handa@m17n.org>
parents:
32646
diff
changeset
|
123 ((r1 *= 96) |
636ac3744ddd
(fontset-default): Modified for mule-unicode-2500-33ff and
Kenichi Handa <handa@m17n.org>
parents:
32646
diff
changeset
|
124 (r1 += r2) |
636ac3744ddd
(fontset-default): Modified for mule-unicode-2500-33ff and
Kenichi Handa <handa@m17n.org>
parents:
32646
diff
changeset
|
125 (r1 += ,(- #x100 (* 32 96) 32)) |
636ac3744ddd
(fontset-default): Modified for mule-unicode-2500-33ff and
Kenichi Handa <handa@m17n.org>
parents:
32646
diff
changeset
|
126 (r1 >8= 0) |
636ac3744ddd
(fontset-default): Modified for mule-unicode-2500-33ff and
Kenichi Handa <handa@m17n.org>
parents:
32646
diff
changeset
|
127 (r2 = r7)) |
636ac3744ddd
(fontset-default): Modified for mule-unicode-2500-33ff and
Kenichi Handa <handa@m17n.org>
parents:
32646
diff
changeset
|
128 (if (r0 == ,(charset-id 'mule-unicode-2500-33ff)) |
636ac3744ddd
(fontset-default): Modified for mule-unicode-2500-33ff and
Kenichi Handa <handa@m17n.org>
parents:
32646
diff
changeset
|
129 ((r1 *= 96) |
636ac3744ddd
(fontset-default): Modified for mule-unicode-2500-33ff and
Kenichi Handa <handa@m17n.org>
parents:
32646
diff
changeset
|
130 (r1 += r2) |
636ac3744ddd
(fontset-default): Modified for mule-unicode-2500-33ff and
Kenichi Handa <handa@m17n.org>
parents:
32646
diff
changeset
|
131 (r1 += ,(- #x2500 (* 32 96) 32)) |
636ac3744ddd
(fontset-default): Modified for mule-unicode-2500-33ff and
Kenichi Handa <handa@m17n.org>
parents:
32646
diff
changeset
|
132 (r1 >8= 0) |
636ac3744ddd
(fontset-default): Modified for mule-unicode-2500-33ff and
Kenichi Handa <handa@m17n.org>
parents:
32646
diff
changeset
|
133 (r2 = r7)) |
636ac3744ddd
(fontset-default): Modified for mule-unicode-2500-33ff and
Kenichi Handa <handa@m17n.org>
parents:
32646
diff
changeset
|
134 (if (r0 == ,(charset-id 'mule-unicode-e000-ffff)) |
636ac3744ddd
(fontset-default): Modified for mule-unicode-2500-33ff and
Kenichi Handa <handa@m17n.org>
parents:
32646
diff
changeset
|
135 ((r1 *= 96) |
636ac3744ddd
(fontset-default): Modified for mule-unicode-2500-33ff and
Kenichi Handa <handa@m17n.org>
parents:
32646
diff
changeset
|
136 (r1 += r2) |
636ac3744ddd
(fontset-default): Modified for mule-unicode-2500-33ff and
Kenichi Handa <handa@m17n.org>
parents:
32646
diff
changeset
|
137 (r1 += ,(- #xe000 (* 32 96) 32)) |
636ac3744ddd
(fontset-default): Modified for mule-unicode-2500-33ff and
Kenichi Handa <handa@m17n.org>
parents:
32646
diff
changeset
|
138 (r1 >8= 0) |
636ac3744ddd
(fontset-default): Modified for mule-unicode-2500-33ff and
Kenichi Handa <handa@m17n.org>
parents:
32646
diff
changeset
|
139 (r2 = r7))))))))) |
32646
43edadfecb51
Use registry "MuleTibetan-2" for Tibetan.
Kenichi Handa <handa@m17n.org>
parents:
29427
diff
changeset
|
140 |
43edadfecb51
Use registry "MuleTibetan-2" for Tibetan.
Kenichi Handa <handa@m17n.org>
parents:
29427
diff
changeset
|
141 (setq font-ccl-encoder-alist |
33048
636ac3744ddd
(fontset-default): Modified for mule-unicode-2500-33ff and
Kenichi Handa <handa@m17n.org>
parents:
32646
diff
changeset
|
142 (cons '("ISO10646-1" . ccl-encode-unicode-font) |
32646
43edadfecb51
Use registry "MuleTibetan-2" for Tibetan.
Kenichi Handa <handa@m17n.org>
parents:
29427
diff
changeset
|
143 font-ccl-encoder-alist)) |
43edadfecb51
Use registry "MuleTibetan-2" for Tibetan.
Kenichi Handa <handa@m17n.org>
parents:
29427
diff
changeset
|
144 |
17052 | 145 ;; Setting for suppressing XLoadQueryFont on big fonts. |
146 (setq x-pixel-size-width-font-regexp | |
147 "gb2312\\|jisx0208\\|ksc5601\\|cns11643\\|big5") | |
148 | |
28215
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
149 ;; These fonts require vertical centering. |
26886
8a6d8101919e
(vertical-centering-font-regexp): New
Kenichi Handa <handa@m17n.org>
parents:
26013
diff
changeset
|
150 (setq vertical-centering-font-regexp |
28215
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
151 "gb2312\\|jisx0208\\|jisx0212\\|ksc5601\\|cns11643\\|big5") |
26886
8a6d8101919e
(vertical-centering-font-regexp): New
Kenichi Handa <handa@m17n.org>
parents:
26013
diff
changeset
|
152 |
22161
7a4c3fd89dda
(x-font-name-charset-alist): New
Kenichi Handa <handa@m17n.org>
parents:
22128
diff
changeset
|
153 (defvar x-font-name-charset-alist |
7a4c3fd89dda
(x-font-name-charset-alist): New
Kenichi Handa <handa@m17n.org>
parents:
22128
diff
changeset
|
154 '(("iso8859-1" ascii latin-iso8859-1) |
7a4c3fd89dda
(x-font-name-charset-alist): New
Kenichi Handa <handa@m17n.org>
parents:
22128
diff
changeset
|
155 ("iso8859-2" ascii latin-iso8859-2) |
7a4c3fd89dda
(x-font-name-charset-alist): New
Kenichi Handa <handa@m17n.org>
parents:
22128
diff
changeset
|
156 ("iso8859-3" ascii latin-iso8859-3) |
7a4c3fd89dda
(x-font-name-charset-alist): New
Kenichi Handa <handa@m17n.org>
parents:
22128
diff
changeset
|
157 ("iso8859-4" ascii latin-iso8859-4) |
7a4c3fd89dda
(x-font-name-charset-alist): New
Kenichi Handa <handa@m17n.org>
parents:
22128
diff
changeset
|
158 ("iso8859-5" ascii cyrillic-iso8859-5) |
7a4c3fd89dda
(x-font-name-charset-alist): New
Kenichi Handa <handa@m17n.org>
parents:
22128
diff
changeset
|
159 ("iso8859-6" ascii arabic-iso8859-6) |
7a4c3fd89dda
(x-font-name-charset-alist): New
Kenichi Handa <handa@m17n.org>
parents:
22128
diff
changeset
|
160 ("iso8859-7" ascii greek-iso8859-7) |
7a4c3fd89dda
(x-font-name-charset-alist): New
Kenichi Handa <handa@m17n.org>
parents:
22128
diff
changeset
|
161 ("iso8859-8" ascii hebrew-iso8859-8) |
26013 | 162 ("iso8859-14" ascii latin-iso8859-14) |
163 ("iso8859-15" ascii latin-iso8859-15) | |
22161
7a4c3fd89dda
(x-font-name-charset-alist): New
Kenichi Handa <handa@m17n.org>
parents:
22128
diff
changeset
|
164 ("tis620" ascii thai-tis620) |
7a4c3fd89dda
(x-font-name-charset-alist): New
Kenichi Handa <handa@m17n.org>
parents:
22128
diff
changeset
|
165 ("koi8" ascii cyrillic-iso8859-5) |
7a4c3fd89dda
(x-font-name-charset-alist): New
Kenichi Handa <handa@m17n.org>
parents:
22128
diff
changeset
|
166 ("viscii" ascii vietnamese-viscii-upper vietnamese-viscii-lower) |
7a4c3fd89dda
(x-font-name-charset-alist): New
Kenichi Handa <handa@m17n.org>
parents:
22128
diff
changeset
|
167 ("vscii" ascii vietnamese-viscii-upper vietnamese-viscii-lower) |
32646
43edadfecb51
Use registry "MuleTibetan-2" for Tibetan.
Kenichi Handa <handa@m17n.org>
parents:
29427
diff
changeset
|
168 ("mulelao-1" ascii lao) |
33048
636ac3744ddd
(fontset-default): Modified for mule-unicode-2500-33ff and
Kenichi Handa <handa@m17n.org>
parents:
32646
diff
changeset
|
169 ("iso10646-1" ascii latin-iso8859-1 mule-unicode-0100-24ff |
636ac3744ddd
(fontset-default): Modified for mule-unicode-2500-33ff and
Kenichi Handa <handa@m17n.org>
parents:
32646
diff
changeset
|
170 mule-unicode-2500-33ff mule-unicode-e000-ffff)) |
22161
7a4c3fd89dda
(x-font-name-charset-alist): New
Kenichi Handa <handa@m17n.org>
parents:
22128
diff
changeset
|
171 "Alist of font names vs list of charsets the font can display. |
7a4c3fd89dda
(x-font-name-charset-alist): New
Kenichi Handa <handa@m17n.org>
parents:
22128
diff
changeset
|
172 |
7a4c3fd89dda
(x-font-name-charset-alist): New
Kenichi Handa <handa@m17n.org>
parents:
22128
diff
changeset
|
173 When a font name which matches some element of this alist is given as |
7a4c3fd89dda
(x-font-name-charset-alist): New
Kenichi Handa <handa@m17n.org>
parents:
22128
diff
changeset
|
174 `-fn' command line argument or is specified by X resource, a fontset |
7a4c3fd89dda
(x-font-name-charset-alist): New
Kenichi Handa <handa@m17n.org>
parents:
22128
diff
changeset
|
175 which uses the specified font for the corresponding charsets are |
7a4c3fd89dda
(x-font-name-charset-alist): New
Kenichi Handa <handa@m17n.org>
parents:
22128
diff
changeset
|
176 created and used for the initial frame.") |
7a4c3fd89dda
(x-font-name-charset-alist): New
Kenichi Handa <handa@m17n.org>
parents:
22128
diff
changeset
|
177 |
17052 | 178 ;;; XLFD (X Logical Font Description) format handler. |
179 | |
180 ;; Define XLFD's field index numbers. ; field name | |
181 (defconst xlfd-regexp-foundry-subnum 0) ; FOUNDRY | |
182 (defconst xlfd-regexp-family-subnum 1) ; FAMILY_NAME | |
183 (defconst xlfd-regexp-weight-subnum 2) ; WEIGHT_NAME | |
184 (defconst xlfd-regexp-slant-subnum 3) ; SLANT | |
185 (defconst xlfd-regexp-swidth-subnum 4) ; SETWIDTH_NAME | |
186 (defconst xlfd-regexp-adstyle-subnum 5) ; ADD_STYLE_NAME | |
187 (defconst xlfd-regexp-pixelsize-subnum 6) ; PIXEL_SIZE | |
188 (defconst xlfd-regexp-pointsize-subnum 7) ; POINT_SIZE | |
189 (defconst xlfd-regexp-resx-subnum 8) ; RESOLUTION_X | |
190 (defconst xlfd-regexp-resy-subnum 9) ; RESOLUTION_Y | |
191 (defconst xlfd-regexp-spacing-subnum 10) ; SPACING | |
192 (defconst xlfd-regexp-avgwidth-subnum 11) ; AVERAGE_WIDTH | |
193 (defconst xlfd-regexp-registry-subnum 12) ; CHARSET_REGISTRY | |
194 (defconst xlfd-regexp-encoding-subnum 13) ; CHARSET_ENCODING | |
195 | |
196 ;; Regular expression matching against a fontname which conforms to | |
197 ;; XLFD (X Logical Font Description). All fields in XLFD should be | |
198 ;; not be omitted (but can be a wild card) to be matched. | |
199 (defconst xlfd-tight-regexp | |
200 "^\ | |
201 -\\([^-]*\\)-\\([^-]*\\)-\\([^-]*\\)-\\([^-]*\\)-\\([^-]*\\)\ | |
202 -\\([^-]*\\)-\\([^-]*\\)-\\([^-]*\\)-\\([^-]*\\)-\\([^-]*\\)\ | |
203 -\\([^-]*\\)-\\([^-]*\\)-\\([^-]*\\)-\\([^-]*\\)$") | |
204 | |
205 ;; List of field numbers of XLFD whose values are numeric. | |
206 (defconst xlfd-regexp-numeric-subnums | |
207 (list xlfd-regexp-pixelsize-subnum ;6 | |
208 xlfd-regexp-pointsize-subnum ;7 | |
209 xlfd-regexp-resx-subnum ;8 | |
210 xlfd-regexp-resy-subnum ;9 | |
211 xlfd-regexp-avgwidth-subnum ;11 | |
212 )) | |
213 | |
214 (defun x-decompose-font-name (pattern) | |
215 "Decompose PATTERN into XLFD's fields and return vector of the fields. | |
216 The length of the vector is 14. | |
217 | |
218 If PATTERN doesn't conform to XLFD, try to get a full XLFD name from | |
219 X server and use the information of the full name to decompose | |
220 PATTERN. If no full XLFD name is gotten, return nil." | |
221 (let (xlfd-fields fontname) | |
222 (if (string-match xlfd-tight-regexp pattern) | |
223 (let ((i 0)) | |
224 (setq xlfd-fields (make-vector 14 nil)) | |
225 (while (< i 14) | |
226 (aset xlfd-fields i (match-string (1+ i) pattern)) | |
227 (setq i (1+ i))) | |
228 xlfd-fields) | |
229 (setq fontname (condition-case nil | |
230 (x-resolve-font-name pattern) | |
231 (error))) | |
232 (if (and fontname | |
233 (string-match xlfd-tight-regexp fontname)) | |
23890
fa4839661777
(x-decompose-font-name): If PATTERN
Kenichi Handa <handa@m17n.org>
parents:
23655
diff
changeset
|
234 ;; We get a full XLFD name. |
17052 | 235 (let ((len (length pattern)) |
236 (i 0) | |
237 l) | |
23890
fa4839661777
(x-decompose-font-name): If PATTERN
Kenichi Handa <handa@m17n.org>
parents:
23655
diff
changeset
|
238 ;; 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
|
239 ;; should be a cons of matched index and matched string. |
17052 | 240 (setq xlfd-fields (make-vector 14 nil)) |
241 (while (< i 14) | |
242 (aset xlfd-fields i | |
243 (cons (match-beginning (1+ i)) | |
244 (match-string (1+ i) fontname))) | |
245 (setq i (1+ i))) | |
23890
fa4839661777
(x-decompose-font-name): If PATTERN
Kenichi Handa <handa@m17n.org>
parents:
23655
diff
changeset
|
246 |
fa4839661777
(x-decompose-font-name): If PATTERN
Kenichi Handa <handa@m17n.org>
parents:
23655
diff
changeset
|
247 ;; Replace wild cards in PATTERN by regexp codes. |
17052 | 248 (setq i 0) |
249 (while (< i len) | |
250 (let ((ch (aref pattern i))) | |
251 (if (= ch ??) | |
252 (setq pattern (concat (substring pattern 0 i) | |
253 "\\(.\\)" | |
254 (substring pattern (1+ i))) | |
255 len (+ len 4) | |
256 i (+ i 4)) | |
257 (if (= ch ?*) | |
258 (setq pattern (concat (substring pattern 0 i) | |
259 "\\(.*\\)" | |
260 (substring pattern (1+ i))) | |
261 len (+ len 5) | |
262 i (+ i 5)) | |
263 (setq i (1+ i)))))) | |
23890
fa4839661777
(x-decompose-font-name): If PATTERN
Kenichi Handa <handa@m17n.org>
parents:
23655
diff
changeset
|
264 |
fa4839661777
(x-decompose-font-name): If PATTERN
Kenichi Handa <handa@m17n.org>
parents:
23655
diff
changeset
|
265 ;; 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
|
266 (if (string-match pattern fontname) |
fa4839661777
(x-decompose-font-name): If PATTERN
Kenichi Handa <handa@m17n.org>
parents:
23655
diff
changeset
|
267 ;; The regular expression PATTERN matchs the full XLFD |
fa4839661777
(x-decompose-font-name): If PATTERN
Kenichi Handa <handa@m17n.org>
parents:
23655
diff
changeset
|
268 ;; name. Set elements that correspond to a wild card |
fa4839661777
(x-decompose-font-name): If PATTERN
Kenichi Handa <handa@m17n.org>
parents:
23655
diff
changeset
|
269 ;; in PATTERN to "*", set the other elements to the |
fa4839661777
(x-decompose-font-name): If PATTERN
Kenichi Handa <handa@m17n.org>
parents:
23655
diff
changeset
|
270 ;; exact strings in PATTERN. |
fa4839661777
(x-decompose-font-name): If PATTERN
Kenichi Handa <handa@m17n.org>
parents:
23655
diff
changeset
|
271 (let ((l (cdr (cdr (match-data))))) |
fa4839661777
(x-decompose-font-name): If PATTERN
Kenichi Handa <handa@m17n.org>
parents:
23655
diff
changeset
|
272 (setq i 0) |
fa4839661777
(x-decompose-font-name): If PATTERN
Kenichi Handa <handa@m17n.org>
parents:
23655
diff
changeset
|
273 (while (< i 14) |
fa4839661777
(x-decompose-font-name): If PATTERN
Kenichi Handa <handa@m17n.org>
parents:
23655
diff
changeset
|
274 (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
|
275 (progn |
fa4839661777
(x-decompose-font-name): If PATTERN
Kenichi Handa <handa@m17n.org>
parents:
23655
diff
changeset
|
276 (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
|
277 (setq i (1+ i))) |
fa4839661777
(x-decompose-font-name): If PATTERN
Kenichi Handa <handa@m17n.org>
parents:
23655
diff
changeset
|
278 (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
|
279 (progn |
fa4839661777
(x-decompose-font-name): If PATTERN
Kenichi Handa <handa@m17n.org>
parents:
23655
diff
changeset
|
280 (aset xlfd-fields i "*") |
fa4839661777
(x-decompose-font-name): If PATTERN
Kenichi Handa <handa@m17n.org>
parents:
23655
diff
changeset
|
281 (setq i (1+ i))) |
fa4839661777
(x-decompose-font-name): If PATTERN
Kenichi Handa <handa@m17n.org>
parents:
23655
diff
changeset
|
282 (setq l (cdr (cdr l))))))) |
fa4839661777
(x-decompose-font-name): If PATTERN
Kenichi Handa <handa@m17n.org>
parents:
23655
diff
changeset
|
283 ;; 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
|
284 ;; in the corresonding fields in full XLFD name. |
fa4839661777
(x-decompose-font-name): If PATTERN
Kenichi Handa <handa@m17n.org>
parents:
23655
diff
changeset
|
285 (setq i 0) |
fa4839661777
(x-decompose-font-name): If PATTERN
Kenichi Handa <handa@m17n.org>
parents:
23655
diff
changeset
|
286 (while (< i 14) |
fa4839661777
(x-decompose-font-name): If PATTERN
Kenichi Handa <handa@m17n.org>
parents:
23655
diff
changeset
|
287 (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
|
288 (setq i (1+ i)))) |
17052 | 289 xlfd-fields))))) |
290 | |
17177
9e550b522bc0
(x-charset-registries): Change entry for Ethiopic.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
291 ;; Replace consecutive wild-cards (`*') in NAME to one. |
9e550b522bc0
(x-charset-registries): Change entry for Ethiopic.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
292 ;; Ex. (x-reduce-font-name "-*-*-*-iso8859-1") => "-*-iso8859-1" |
9e550b522bc0
(x-charset-registries): Change entry for Ethiopic.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
293 (defsubst x-reduce-font-name (name) |
9e550b522bc0
(x-charset-registries): Change entry for Ethiopic.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
294 (while (string-match "-\\*-\\(\\*-\\)+" name) |
9e550b522bc0
(x-charset-registries): Change entry for Ethiopic.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
295 (setq name (replace-match "-*-" t t name))) |
9e550b522bc0
(x-charset-registries): Change entry for Ethiopic.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
296 name) |
9e550b522bc0
(x-charset-registries): Change entry for Ethiopic.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
297 |
22449
c87830c691a5
(instantiate-fontset): Delete
Kenichi Handa <handa@m17n.org>
parents:
22161
diff
changeset
|
298 (defun x-compose-font-name (fields &optional reduce) |
17052 | 299 "Compose X's fontname from FIELDS. |
22449
c87830c691a5
(instantiate-fontset): Delete
Kenichi Handa <handa@m17n.org>
parents:
22161
diff
changeset
|
300 FIELDS is a vector of XLFD fields, the length 14. |
17177
9e550b522bc0
(x-charset-registries): Change entry for Ethiopic.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
301 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
|
302 Optional argument REDUCE is always ignored. It exists just for |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
303 backward compatibility." |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
304 (concat "-" (mapconcat (lambda (x) (or x "*")) fields "-"))) |
23205
22df54cdb841
(resolved-ascii-font): New variable.
Kenichi Handa <handa@m17n.org>
parents:
23196
diff
changeset
|
305 |
17052 | 306 (defun x-complement-fontset-spec (xlfd-fields fontlist) |
28215
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
307 "Complement FONTLIST for charsets based on XLFD-FIELDS and return it. |
17052 | 308 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
|
309 FONTLIST is an alist of charsets vs the corresponding font names. |
17052 | 310 |
28215
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
311 The fonts are complemented as below. |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
312 |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
313 If FONTLIST doesn't specify a font for ASCII charset, generate a font |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
314 name for the charset from XLFD-FIELDS, and add that information to |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
315 FONTLIST. |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
316 |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
317 If a font specifid for ASCII supports the other charsets (see the |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
318 variable `x-font-name-charset-alist'), add that information to FONTLIST." |
34917
989f2f0c8a7e
(x-complement-fontset-spec): Resolve
Kenichi Handa <handa@m17n.org>
parents:
34245
diff
changeset
|
319 (let* ((slot (assq 'ascii fontlist)) |
36368
dbd54e46ee03
(x-complement-fontset-spec): In the
Kenichi Handa <handa@m17n.org>
parents:
34917
diff
changeset
|
320 (ascii-font (cdr slot)) |
dbd54e46ee03
(x-complement-fontset-spec): In the
Kenichi Handa <handa@m17n.org>
parents:
34917
diff
changeset
|
321 ascii-font-spec) |
34917
989f2f0c8a7e
(x-complement-fontset-spec): Resolve
Kenichi Handa <handa@m17n.org>
parents:
34245
diff
changeset
|
322 (if ascii-font |
989f2f0c8a7e
(x-complement-fontset-spec): Resolve
Kenichi Handa <handa@m17n.org>
parents:
34245
diff
changeset
|
323 (setcdr slot (setq ascii-font (x-resolve-font-name ascii-font))) |
989f2f0c8a7e
(x-complement-fontset-spec): Resolve
Kenichi Handa <handa@m17n.org>
parents:
34245
diff
changeset
|
324 ;; If font for ASCII is not specified, add it. |
29234
c9a5f356fe77
Set family names of non-latin charsets in default fontset to "*".
Kenichi Handa <handa@m17n.org>
parents:
29168
diff
changeset
|
325 (aset xlfd-fields xlfd-regexp-registry-subnum "iso8859") |
c9a5f356fe77
Set family names of non-latin charsets in default fontset to "*".
Kenichi Handa <handa@m17n.org>
parents:
29168
diff
changeset
|
326 (aset xlfd-fields xlfd-regexp-encoding-subnum "1") |
34917
989f2f0c8a7e
(x-complement-fontset-spec): Resolve
Kenichi Handa <handa@m17n.org>
parents:
34245
diff
changeset
|
327 (setq ascii-font (x-resolve-font-name (x-compose-font-name xlfd-fields))) |
29234
c9a5f356fe77
Set family names of non-latin charsets in default fontset to "*".
Kenichi Handa <handa@m17n.org>
parents:
29168
diff
changeset
|
328 (setq fontlist (cons (cons 'ascii ascii-font) fontlist))) |
18350
3f4364889538
(x-charset-registries): Name changed for consistency:
Kenichi Handa <handa@m17n.org>
parents:
17989
diff
changeset
|
329 |
28215
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
330 ;; If the font for ASCII also supports the other charsets, and |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
331 ;; they are not specified in FONTLIST, add them. |
36368
dbd54e46ee03
(x-complement-fontset-spec): In the
Kenichi Handa <handa@m17n.org>
parents:
34917
diff
changeset
|
332 (setq xlfd-fields (x-decompose-font-name ascii-font)) |
dbd54e46ee03
(x-complement-fontset-spec): In the
Kenichi Handa <handa@m17n.org>
parents:
34917
diff
changeset
|
333 (if (not xlfd-fields) |
dbd54e46ee03
(x-complement-fontset-spec): In the
Kenichi Handa <handa@m17n.org>
parents:
34917
diff
changeset
|
334 (setq ascii-font-spec ascii-font) |
dbd54e46ee03
(x-complement-fontset-spec): In the
Kenichi Handa <handa@m17n.org>
parents:
34917
diff
changeset
|
335 (setq ascii-font-spec |
dbd54e46ee03
(x-complement-fontset-spec): In the
Kenichi Handa <handa@m17n.org>
parents:
34917
diff
changeset
|
336 (cons (format "%s-%s" |
dbd54e46ee03
(x-complement-fontset-spec): In the
Kenichi Handa <handa@m17n.org>
parents:
34917
diff
changeset
|
337 (aref xlfd-fields xlfd-regexp-foundry-subnum) |
dbd54e46ee03
(x-complement-fontset-spec): In the
Kenichi Handa <handa@m17n.org>
parents:
34917
diff
changeset
|
338 (aref xlfd-fields xlfd-regexp-family-subnum)) |
dbd54e46ee03
(x-complement-fontset-spec): In the
Kenichi Handa <handa@m17n.org>
parents:
34917
diff
changeset
|
339 (format "%s-%s" |
dbd54e46ee03
(x-complement-fontset-spec): In the
Kenichi Handa <handa@m17n.org>
parents:
34917
diff
changeset
|
340 (aref xlfd-fields xlfd-regexp-registry-subnum) |
dbd54e46ee03
(x-complement-fontset-spec): In the
Kenichi Handa <handa@m17n.org>
parents:
34917
diff
changeset
|
341 (aref xlfd-fields xlfd-regexp-encoding-subnum))))) |
28215
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
342 (let ((tail x-font-name-charset-alist) |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
343 elt) |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
344 (while tail |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
345 (setq elt (car tail) tail (cdr tail)) |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
346 (if (string-match (car elt) ascii-font) |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
347 (let ((charsets (cdr elt)) |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
348 charset) |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
349 (while charsets |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
350 (setq charset (car charsets) charsets (cdr charsets)) |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
351 (or (assq charset fontlist) |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
352 (setq fontlist |
36368
dbd54e46ee03
(x-complement-fontset-spec): In the
Kenichi Handa <handa@m17n.org>
parents:
34917
diff
changeset
|
353 (cons (cons charset ascii-font-spec) fontlist)))))))) |
28215
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
354 |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
355 fontlist)) |
17052 | 356 |
19049
cad4c032fa26
(fontset-name-p): New function.
Kenichi Handa <handa@m17n.org>
parents:
18719
diff
changeset
|
357 (defun fontset-name-p (fontset) |
cad4c032fa26
(fontset-name-p): New function.
Kenichi Handa <handa@m17n.org>
parents:
18719
diff
changeset
|
358 "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
|
359 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
|
360 with \"fontset\" in `<CHARSET_REGISTRY> field." |
cad4c032fa26
(fontset-name-p): New function.
Kenichi Handa <handa@m17n.org>
parents:
18719
diff
changeset
|
361 (and (string-match xlfd-tight-regexp fontset) |
cad4c032fa26
(fontset-name-p): New function.
Kenichi Handa <handa@m17n.org>
parents:
18719
diff
changeset
|
362 (string= (match-string (1+ xlfd-regexp-registry-subnum) fontset) |
cad4c032fa26
(fontset-name-p): New function.
Kenichi Handa <handa@m17n.org>
parents:
18719
diff
changeset
|
363 "fontset"))) |
cad4c032fa26
(fontset-name-p): New function.
Kenichi Handa <handa@m17n.org>
parents:
18719
diff
changeset
|
364 |
17052 | 365 ;; Return a list to be appended to `x-fixed-font-alist' when |
366 ;; `mouse-set-font' is called. | |
367 (defun generate-fontset-menu () | |
28215
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
368 (let ((fontsets (fontset-list)) |
17052 | 369 fontset-name |
370 l) | |
371 (while fontsets | |
28215
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
372 (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
|
373 (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
|
374 (cons "Fontset" |
ab814ec4995e
(generate-fontset-menu): Return a
Kenichi Handa <handa@m17n.org>
parents:
24153
diff
changeset
|
375 (sort l (function (lambda (x y) (string< (car x) (car y)))))))) |
17052 | 376 |
377 (defun fontset-plain-name (fontset) | |
378 "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
|
379 (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
|
380 (error "Invalid fontset: %s" fontset)) |
17052 | 381 (let ((xlfd-fields (x-decompose-font-name fontset))) |
382 (if xlfd-fields | |
383 (let ((weight (aref xlfd-fields xlfd-regexp-weight-subnum)) | |
384 (slant (aref xlfd-fields xlfd-regexp-slant-subnum)) | |
385 (swidth (aref xlfd-fields xlfd-regexp-swidth-subnum)) | |
386 (size (aref xlfd-fields xlfd-regexp-pixelsize-subnum)) | |
17755
4c82e87c7d7c
(x-decompose-font-name): While seting each field of
Kenichi Handa <handa@m17n.org>
parents:
17339
diff
changeset
|
387 (charset (aref xlfd-fields xlfd-regexp-registry-subnum)) |
4c82e87c7d7c
(x-decompose-font-name): While seting each field of
Kenichi Handa <handa@m17n.org>
parents:
17339
diff
changeset
|
388 (nickname (aref xlfd-fields xlfd-regexp-encoding-subnum)) |
17052 | 389 name) |
17755
4c82e87c7d7c
(x-decompose-font-name): While seting each field of
Kenichi Handa <handa@m17n.org>
parents:
17339
diff
changeset
|
390 (if (not (string= "fontset" charset)) |
17052 | 391 fontset |
17755
4c82e87c7d7c
(x-decompose-font-name): While seting each field of
Kenichi Handa <handa@m17n.org>
parents:
17339
diff
changeset
|
392 (if (> (string-to-int size) 0) |
4c82e87c7d7c
(x-decompose-font-name): While seting each field of
Kenichi Handa <handa@m17n.org>
parents:
17339
diff
changeset
|
393 (setq name (format "%s: %s-dot" nickname size)) |
4c82e87c7d7c
(x-decompose-font-name): While seting each field of
Kenichi Handa <handa@m17n.org>
parents:
17339
diff
changeset
|
394 (setq name nickname)) |
4c82e87c7d7c
(x-decompose-font-name): While seting each field of
Kenichi Handa <handa@m17n.org>
parents:
17339
diff
changeset
|
395 (cond ((string-match "^medium$" weight) |
4c82e87c7d7c
(x-decompose-font-name): While seting each field of
Kenichi Handa <handa@m17n.org>
parents:
17339
diff
changeset
|
396 (setq name (concat name " " "medium"))) |
4c82e87c7d7c
(x-decompose-font-name): While seting each field of
Kenichi Handa <handa@m17n.org>
parents:
17339
diff
changeset
|
397 ((string-match "^bold$\\|^demibold$" weight) |
4c82e87c7d7c
(x-decompose-font-name): While seting each field of
Kenichi Handa <handa@m17n.org>
parents:
17339
diff
changeset
|
398 (setq name (concat name " " weight)))) |
4c82e87c7d7c
(x-decompose-font-name): While seting each field of
Kenichi Handa <handa@m17n.org>
parents:
17339
diff
changeset
|
399 (cond ((string-match "^i$" slant) |
4c82e87c7d7c
(x-decompose-font-name): While seting each field of
Kenichi Handa <handa@m17n.org>
parents:
17339
diff
changeset
|
400 (setq name (concat name " " "italic"))) |
4c82e87c7d7c
(x-decompose-font-name): While seting each field of
Kenichi Handa <handa@m17n.org>
parents:
17339
diff
changeset
|
401 ((string-match "^o$" slant) |
4c82e87c7d7c
(x-decompose-font-name): While seting each field of
Kenichi Handa <handa@m17n.org>
parents:
17339
diff
changeset
|
402 (setq name (concat name " " "slant"))) |
4c82e87c7d7c
(x-decompose-font-name): While seting each field of
Kenichi Handa <handa@m17n.org>
parents:
17339
diff
changeset
|
403 ((string-match "^ri$" slant) |
4c82e87c7d7c
(x-decompose-font-name): While seting each field of
Kenichi Handa <handa@m17n.org>
parents:
17339
diff
changeset
|
404 (setq name (concat name " " "reverse italic"))) |
4c82e87c7d7c
(x-decompose-font-name): While seting each field of
Kenichi Handa <handa@m17n.org>
parents:
17339
diff
changeset
|
405 ((string-match "^ro$" slant) |
4c82e87c7d7c
(x-decompose-font-name): While seting each field of
Kenichi Handa <handa@m17n.org>
parents:
17339
diff
changeset
|
406 (setq name (concat name " " "reverse slant")))) |
17052 | 407 name)) |
408 fontset))) | |
409 | |
22128
8f7a59fc78db
(create-fontset-from-fontset-spec): Add autoload cookie.
Richard M. Stallman <rms@gnu.org>
parents:
19771
diff
changeset
|
410 ;;;###autoload |
22161
7a4c3fd89dda
(x-font-name-charset-alist): New
Kenichi Handa <handa@m17n.org>
parents:
22128
diff
changeset
|
411 (defun create-fontset-from-fontset-spec (fontset-spec |
22449
c87830c691a5
(instantiate-fontset): Delete
Kenichi Handa <handa@m17n.org>
parents:
22161
diff
changeset
|
412 &optional style-variant noerror) |
17052 | 413 "Create a fontset from fontset specification string FONTSET-SPEC. |
414 FONTSET-SPEC is a string of the format: | |
415 FONTSET-NAME,CHARSET-NAME0:FONT-NAME0,CHARSET-NAME1:FONT-NAME1, ... | |
17755
4c82e87c7d7c
(x-decompose-font-name): While seting each field of
Kenichi Handa <handa@m17n.org>
parents:
17339
diff
changeset
|
416 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
|
417 |
28215
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
418 Optional 2nd argument is ignored. It exists just for backward |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
419 compatibility. |
22449
c87830c691a5
(instantiate-fontset): Delete
Kenichi Handa <handa@m17n.org>
parents:
22161
diff
changeset
|
420 |
18719
de8249499f33
(create-fontset-from-fontset-spec): Typo in doc-string fixed.
Kenichi Handa <handa@m17n.org>
parents:
18714
diff
changeset
|
421 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
|
422 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
|
423 |
9cfa1a788a5a
(create-fontset-from-fontset-spec):
Kenichi Handa <handa@m17n.org>
parents:
22618
diff
changeset
|
424 It returns a name of the created fontset." |
17755
4c82e87c7d7c
(x-decompose-font-name): While seting each field of
Kenichi Handa <handa@m17n.org>
parents:
17339
diff
changeset
|
425 (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
|
426 (error "Invalid fontset spec: %s" fontset-spec)) |
28215
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
427 (setq fontset-spec (downcase fontset-spec)) |
17755
4c82e87c7d7c
(x-decompose-font-name): While seting each field of
Kenichi Handa <handa@m17n.org>
parents:
17339
diff
changeset
|
428 (let ((idx (match-end 0)) |
4c82e87c7d7c
(x-decompose-font-name): While seting each field of
Kenichi Handa <handa@m17n.org>
parents:
17339
diff
changeset
|
429 (name (match-string 0 fontset-spec)) |
28215
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
430 xlfd-fields charset fontlist ascii-font) |
22161
7a4c3fd89dda
(x-font-name-charset-alist): New
Kenichi Handa <handa@m17n.org>
parents:
22128
diff
changeset
|
431 (if (query-fontset name) |
7a4c3fd89dda
(x-font-name-charset-alist): New
Kenichi Handa <handa@m17n.org>
parents:
22128
diff
changeset
|
432 (or noerror |
23655
8aa7d51024b2
(create-fontset-from-fontset-spec): Give correct arg to `error'.
Kenichi Handa <handa@m17n.org>
parents:
23205
diff
changeset
|
433 (error "Fontset \"%s\" already exists" name)) |
28215
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
434 (setq xlfd-fields (x-decompose-font-name name)) |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
435 (or xlfd-fields |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
436 (error "Fontset \"%s\" not conforming to XLFD" name)) |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
437 |
22161
7a4c3fd89dda
(x-font-name-charset-alist): New
Kenichi Handa <handa@m17n.org>
parents:
22128
diff
changeset
|
438 ;; 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
|
439 (while (string-match "[, \t\n]*\\([^:]+\\):\\([^,]+\\)" fontset-spec idx) |
7a4c3fd89dda
(x-font-name-charset-alist): New
Kenichi Handa <handa@m17n.org>
parents:
22128
diff
changeset
|
440 (setq idx (match-end 0)) |
7a4c3fd89dda
(x-font-name-charset-alist): New
Kenichi Handa <handa@m17n.org>
parents:
22128
diff
changeset
|
441 (setq charset (intern (match-string 1 fontset-spec))) |
7a4c3fd89dda
(x-font-name-charset-alist): New
Kenichi Handa <handa@m17n.org>
parents:
22128
diff
changeset
|
442 (if (charsetp charset) |
7a4c3fd89dda
(x-font-name-charset-alist): New
Kenichi Handa <handa@m17n.org>
parents:
22128
diff
changeset
|
443 (setq fontlist (cons (cons charset (match-string 2 fontset-spec)) |
7a4c3fd89dda
(x-font-name-charset-alist): New
Kenichi Handa <handa@m17n.org>
parents:
22128
diff
changeset
|
444 fontlist)))) |
34917
989f2f0c8a7e
(x-complement-fontset-spec): Resolve
Kenichi Handa <handa@m17n.org>
parents:
34245
diff
changeset
|
445 (setq ascii-font (cdr (assq 'ascii fontlist))) |
22449
c87830c691a5
(instantiate-fontset): Delete
Kenichi Handa <handa@m17n.org>
parents:
22161
diff
changeset
|
446 |
28215
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
447 ;; Complement FONTLIST. |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
448 (setq fontlist (x-complement-fontset-spec xlfd-fields fontlist)) |
22449
c87830c691a5
(instantiate-fontset): Delete
Kenichi Handa <handa@m17n.org>
parents:
22161
diff
changeset
|
449 |
28215
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
450 (new-fontset name fontlist) |
22161
7a4c3fd89dda
(x-font-name-charset-alist): New
Kenichi Handa <handa@m17n.org>
parents:
22128
diff
changeset
|
451 |
28215
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
452 ;; Define the short name alias. |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
453 (if (and (string-match "fontset-.*$" name) |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
454 (not (assoc name fontset-alias-alist))) |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
455 (let ((alias (match-string 0 name))) |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
456 (or (rassoc alias fontset-alias-alist) |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
457 (setq fontset-alias-alist |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
458 (cons (cons name alias) fontset-alias-alist))))) |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
459 |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
460 ;; Define the ASCII font name alias. |
34917
989f2f0c8a7e
(x-complement-fontset-spec): Resolve
Kenichi Handa <handa@m17n.org>
parents:
34245
diff
changeset
|
461 (or ascii-font |
989f2f0c8a7e
(x-complement-fontset-spec): Resolve
Kenichi Handa <handa@m17n.org>
parents:
34245
diff
changeset
|
462 (setq ascii-font (cdr (assq 'ascii fontlist)))) |
28215
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
463 (or (rassoc ascii-font fontset-alias-alist) |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
464 (setq fontset-alias-alist |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
465 (cons (cons name ascii-font) |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
466 fontset-alias-alist)))) |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
467 |
22672
9cfa1a788a5a
(create-fontset-from-fontset-spec):
Kenichi Handa <handa@m17n.org>
parents:
22618
diff
changeset
|
468 name)) |
9cfa1a788a5a
(create-fontset-from-fontset-spec):
Kenichi Handa <handa@m17n.org>
parents:
22618
diff
changeset
|
469 |
9cfa1a788a5a
(create-fontset-from-fontset-spec):
Kenichi Handa <handa@m17n.org>
parents:
22618
diff
changeset
|
470 (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
|
471 fontset-name) |
9cfa1a788a5a
(create-fontset-from-fontset-spec):
Kenichi Handa <handa@m17n.org>
parents:
22618
diff
changeset
|
472 "Create a fontset from an ASCII font FONT. |
9cfa1a788a5a
(create-fontset-from-fontset-spec):
Kenichi Handa <handa@m17n.org>
parents:
22618
diff
changeset
|
473 |
9cfa1a788a5a
(create-fontset-from-fontset-spec):
Kenichi Handa <handa@m17n.org>
parents:
22618
diff
changeset
|
474 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
|
475 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
|
476 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
|
477 |
9cfa1a788a5a
(create-fontset-from-fontset-spec):
Kenichi Handa <handa@m17n.org>
parents:
22618
diff
changeset
|
478 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
|
479 `<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
|
480 an appropriate name is generated automatically. |
9cfa1a788a5a
(create-fontset-from-fontset-spec):
Kenichi Handa <handa@m17n.org>
parents:
22618
diff
changeset
|
481 |
9cfa1a788a5a
(create-fontset-from-fontset-spec):
Kenichi Handa <handa@m17n.org>
parents:
22618
diff
changeset
|
482 It returns a name of the created fontset." |
28215
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
483 (setq font (downcase font)) |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
484 (if resolved-font |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
485 (setq resolved-font (downcase resolved-font)) |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
486 (setq resolved-font (downcase (x-resolve-font-name font)))) |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
487 (let ((xlfd (x-decompose-font-name font)) |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
488 (resolved-xlfd (x-decompose-font-name resolved-font)) |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
489 fontset fontset-spec) |
22672
9cfa1a788a5a
(create-fontset-from-fontset-spec):
Kenichi Handa <handa@m17n.org>
parents:
22618
diff
changeset
|
490 (aset xlfd xlfd-regexp-foundry-subnum nil) |
9cfa1a788a5a
(create-fontset-from-fontset-spec):
Kenichi Handa <handa@m17n.org>
parents:
22618
diff
changeset
|
491 (aset xlfd xlfd-regexp-family-subnum nil) |
9cfa1a788a5a
(create-fontset-from-fontset-spec):
Kenichi Handa <handa@m17n.org>
parents:
22618
diff
changeset
|
492 (aset xlfd xlfd-regexp-registry-subnum "fontset") |
28215
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
493 (if fontset-name |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
494 (setq fontset-name (downcase fontset-name)) |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
495 (setq fontset-name |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
496 (format "%s_%s_%s" |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
497 (aref resolved-xlfd xlfd-regexp-registry-subnum) |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
498 (aref resolved-xlfd xlfd-regexp-encoding-subnum) |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
499 (aref resolved-xlfd xlfd-regexp-pixelsize-subnum)))) |
22672
9cfa1a788a5a
(create-fontset-from-fontset-spec):
Kenichi Handa <handa@m17n.org>
parents:
22618
diff
changeset
|
500 (aset xlfd xlfd-regexp-encoding-subnum fontset-name) |
9cfa1a788a5a
(create-fontset-from-fontset-spec):
Kenichi Handa <handa@m17n.org>
parents:
22618
diff
changeset
|
501 (setq fontset (x-compose-font-name xlfd)) |
9cfa1a788a5a
(create-fontset-from-fontset-spec):
Kenichi Handa <handa@m17n.org>
parents:
22618
diff
changeset
|
502 (or (query-fontset fontset) |
28215
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
503 (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
|
504 |
17052 | 505 |
17842
cb1af8ead3df
(standard-fontset-spec): Name changed from
Kenichi Handa <handa@m17n.org>
parents:
17755
diff
changeset
|
506 ;; 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
|
507 ;; 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
|
508 ;; 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
|
509 ;; many cases. |
17842
cb1af8ead3df
(standard-fontset-spec): Name changed from
Kenichi Handa <handa@m17n.org>
parents:
17755
diff
changeset
|
510 (defvar standard-fontset-spec |
27534
eeb998860456
(standard-fontset-spec): Purecopy it.
Dave Love <fx@gnu.org>
parents:
26886
diff
changeset
|
511 (purecopy "-*-fixed-medium-r-normal-*-16-*-*-*-*-*-fontset-standard, |
17052 | 512 chinese-gb2312:-*-medium-r-normal-*-16-*-gb2312*-*, |
513 korean-ksc5601:-*-medium-r-normal-*-16-*-ksc5601*-*, | |
514 chinese-cns11643-1:-*-medium-r-normal-*-16-*-cns11643*-1, | |
515 chinese-cns11643-2:-*-medium-r-normal-*-16-*-cns11643*-2, | |
516 chinese-cns11643-3:-*-medium-r-normal-*-16-*-cns11643*-3, | |
517 chinese-cns11643-4:-*-medium-r-normal-*-16-*-cns11643*-4, | |
518 chinese-cns11643-5:-*-medium-r-normal-*-16-*-cns11643*-5, | |
519 chinese-cns11643-6:-*-medium-r-normal-*-16-*-cns11643*-6, | |
27534
eeb998860456
(standard-fontset-spec): Purecopy it.
Dave Love <fx@gnu.org>
parents:
26886
diff
changeset
|
520 chinese-cns11643-7:-*-medium-r-normal-*-16-*-cns11643*-7") |
17842
cb1af8ead3df
(standard-fontset-spec): Name changed from
Kenichi Handa <handa@m17n.org>
parents:
17755
diff
changeset
|
521 "String of fontset spec of the standard fontset. |
cb1af8ead3df
(standard-fontset-spec): Name changed from
Kenichi Handa <handa@m17n.org>
parents:
17755
diff
changeset
|
522 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
|
523 with correct glyphs by using the standard fontset. |
17052 | 524 See the documentation of `create-fontset-from-fontset-spec' for the format.") |
525 | |
526 ;; Create fontsets from X resources of the name `fontset-N (class | |
527 ;; Fontset-N)' where N is integer 0, 1, ... | |
528 ;; 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
|
529 ;; `standard-fontset-spec'. |
17052 | 530 |
531 (defun create-fontset-from-x-resource () | |
532 (let ((idx 0) | |
533 fontset-spec) | |
27534
eeb998860456
(standard-fontset-spec): Purecopy it.
Dave Love <fx@gnu.org>
parents:
26886
diff
changeset
|
534 (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
|
535 (format "Fontset-%d" idx))) |
24153
729affdf2ca1
(create-fontset-from-x-resource): Make style variants.
Kenichi Handa <handa@m17n.org>
parents:
23890
diff
changeset
|
536 (create-fontset-from-fontset-spec fontset-spec t 'noerror) |
17052 | 537 (setq idx (1+ idx))))) |
538 | |
539 ;; | |
540 (provide 'fontset) | |
541 | |
542 ;;; fontset.el ends here |