Mercurial > emacs
annotate lisp/international/fontset.el @ 85663:6969c5ba7fd1
(Equality Predicates): Null strings are uniquified.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Fri, 26 Oct 2007 09:49:45 +0000 |
parents | 2daf9c28b3a4 |
children | b6fdfff4ae81 f55f9811f5d7 |
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 |
74544 | 3 ;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, |
75347 | 4 ;; 2005, 2006, 2007 Free Software Foundation, Inc. |
74605
6ee41fdd69ff
Update AIST copyright years.
Kenichi Handa <handa@m17n.org>
parents:
74544
diff
changeset
|
5 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, |
75347 | 6 ;; 2005, 2006, 2007 |
62274 | 7 ;; National Institute of Advanced Industrial Science and Technology (AIST) |
8 ;; Registration Number H14PRO021 | |
17052 | 9 |
10 ;; Keywords: mule, multilingual, fontset | |
11 | |
12 ;; This file is part of GNU Emacs. | |
13 | |
14 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
15 ;; it under the terms of the GNU General Public License as published by | |
78310
2daf9c28b3a4
Restore comma mistakenly removed in last change.
Glenn Morris <rgm@gnu.org>
parents:
78301
diff
changeset
|
16 ;; the Free Software Foundation; either version 3, or (at your option) |
17052 | 17 ;; any later version. |
18 | |
19 ;; GNU Emacs is distributed in the hope that it will be useful, | |
20 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
21 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
22 ;; GNU General Public License for more details. | |
23 | |
24 ;; You should have received a copy of the GNU General Public License | |
17071 | 25 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
64085 | 26 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
27 ;; Boston, MA 02110-1301, USA. | |
17052 | 28 |
38414
67b464da13ec
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
36368
diff
changeset
|
29 ;;; Commentary: |
67b464da13ec
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
36368
diff
changeset
|
30 |
17052 | 31 ;;; Code: |
32 | |
29234
c9a5f356fe77
Set family names of non-latin charsets in default fontset to "*".
Kenichi Handa <handa@m17n.org>
parents:
29168
diff
changeset
|
33 ;; 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
|
34 ;; 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
|
35 ;; 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
|
36 ;; 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
|
37 ;; 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
|
38 ;; 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
|
39 ;; 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
|
40 ;; `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
|
41 ;; `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
|
42 ;; 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
|
43 ;; 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
|
44 ;; REGISTRY for ASCII characters are predefined as "ISO8859-1". |
17052 | 45 |
49287
5cb7e7103296
Don't setup the default fontset and
Kenichi Handa <handa@m17n.org>
parents:
47711
diff
changeset
|
46 (defun setup-default-fontset () |
5cb7e7103296
Don't setup the default fontset and
Kenichi Handa <handa@m17n.org>
parents:
47711
diff
changeset
|
47 "Setup the default fontset." |
50257
19c37f19c706
(setup-default-fontset): Use
Kenichi Handa <handa@m17n.org>
parents:
49598
diff
changeset
|
48 (dolist (elt |
19c37f19c706
(setup-default-fontset): Use
Kenichi Handa <handa@m17n.org>
parents:
49598
diff
changeset
|
49 `((latin-iso8859-1 . (nil . "ISO8859-1")) |
19c37f19c706
(setup-default-fontset): Use
Kenichi Handa <handa@m17n.org>
parents:
49598
diff
changeset
|
50 (latin-iso8859-2 . (nil . "ISO8859-2")) |
19c37f19c706
(setup-default-fontset): Use
Kenichi Handa <handa@m17n.org>
parents:
49598
diff
changeset
|
51 (latin-iso8859-3 . (nil . "ISO8859-3")) |
19c37f19c706
(setup-default-fontset): Use
Kenichi Handa <handa@m17n.org>
parents:
49598
diff
changeset
|
52 (latin-iso8859-4 . (nil . "ISO8859-4")) |
52396
1acdbb1fae7d
(setup-default-fontset): For Thai font, specify "*" family.
Kenichi Handa <handa@m17n.org>
parents:
52201
diff
changeset
|
53 ;; Setting "*" family is for a workaround of the problem |
1acdbb1fae7d
(setup-default-fontset): For Thai font, specify "*" family.
Kenichi Handa <handa@m17n.org>
parents:
52201
diff
changeset
|
54 ;; that a font of wrong size is preferred if the font |
1acdbb1fae7d
(setup-default-fontset): For Thai font, specify "*" family.
Kenichi Handa <handa@m17n.org>
parents:
52201
diff
changeset
|
55 ;; family matches with a requested one. |
1acdbb1fae7d
(setup-default-fontset): For Thai font, specify "*" family.
Kenichi Handa <handa@m17n.org>
parents:
52201
diff
changeset
|
56 (thai-tis620 . ("*" . "TIS620")) |
52201
6790b6f59b3a
(setup-default-fontset): Change "*" to
Kenichi Handa <handa@m17n.org>
parents:
52084
diff
changeset
|
57 (greek-iso8859-7 . (nil . "ISO8859-7")) |
6790b6f59b3a
(setup-default-fontset): Change "*" to
Kenichi Handa <handa@m17n.org>
parents:
52084
diff
changeset
|
58 (arabic-iso8859-6 . (nil . "ISO8859-6")) |
6790b6f59b3a
(setup-default-fontset): Change "*" to
Kenichi Handa <handa@m17n.org>
parents:
52084
diff
changeset
|
59 (hebrew-iso8859-8 . (nil . "ISO8859-8")) |
6790b6f59b3a
(setup-default-fontset): Change "*" to
Kenichi Handa <handa@m17n.org>
parents:
52084
diff
changeset
|
60 (katakana-jisx0201 . (nil . "JISX0201")) |
50257
19c37f19c706
(setup-default-fontset): Use
Kenichi Handa <handa@m17n.org>
parents:
49598
diff
changeset
|
61 (latin-jisx0201 . (nil . "JISX0201")) |
52201
6790b6f59b3a
(setup-default-fontset): Change "*" to
Kenichi Handa <handa@m17n.org>
parents:
52084
diff
changeset
|
62 (cyrillic-iso8859-5 . (nil . "ISO8859-5")) |
50257
19c37f19c706
(setup-default-fontset): Use
Kenichi Handa <handa@m17n.org>
parents:
49598
diff
changeset
|
63 (latin-iso8859-9 . (nil . "ISO8859-9")) |
52201
6790b6f59b3a
(setup-default-fontset): Change "*" to
Kenichi Handa <handa@m17n.org>
parents:
52084
diff
changeset
|
64 (japanese-jisx0208-1978 . (nil . "JISX0208.1978")) |
6790b6f59b3a
(setup-default-fontset): Change "*" to
Kenichi Handa <handa@m17n.org>
parents:
52084
diff
changeset
|
65 (chinese-gb2312 . (nil . "GB2312.1980")) |
6790b6f59b3a
(setup-default-fontset): Change "*" to
Kenichi Handa <handa@m17n.org>
parents:
52084
diff
changeset
|
66 (japanese-jisx0208 . (nil . "JISX0208.1990")) |
6790b6f59b3a
(setup-default-fontset): Change "*" to
Kenichi Handa <handa@m17n.org>
parents:
52084
diff
changeset
|
67 (korean-ksc5601 . (nil . "KSC5601.1989")) |
6790b6f59b3a
(setup-default-fontset): Change "*" to
Kenichi Handa <handa@m17n.org>
parents:
52084
diff
changeset
|
68 (japanese-jisx0212 . (nil . "JISX0212")) |
6790b6f59b3a
(setup-default-fontset): Change "*" to
Kenichi Handa <handa@m17n.org>
parents:
52084
diff
changeset
|
69 (chinese-cns11643-1 . (nil . "CNS11643.1992-1")) |
6790b6f59b3a
(setup-default-fontset): Change "*" to
Kenichi Handa <handa@m17n.org>
parents:
52084
diff
changeset
|
70 (chinese-cns11643-2 . (nil . "CNS11643.1992-2")) |
6790b6f59b3a
(setup-default-fontset): Change "*" to
Kenichi Handa <handa@m17n.org>
parents:
52084
diff
changeset
|
71 (chinese-cns11643-3 . (nil . "CNS11643.1992-3")) |
6790b6f59b3a
(setup-default-fontset): Change "*" to
Kenichi Handa <handa@m17n.org>
parents:
52084
diff
changeset
|
72 (chinese-cns11643-4 . (nil . "CNS11643.1992-4")) |
6790b6f59b3a
(setup-default-fontset): Change "*" to
Kenichi Handa <handa@m17n.org>
parents:
52084
diff
changeset
|
73 (chinese-cns11643-5 . (nil . "CNS11643.1992-5")) |
6790b6f59b3a
(setup-default-fontset): Change "*" to
Kenichi Handa <handa@m17n.org>
parents:
52084
diff
changeset
|
74 (chinese-cns11643-6 . (nil . "CNS11643.1992-6")) |
6790b6f59b3a
(setup-default-fontset): Change "*" to
Kenichi Handa <handa@m17n.org>
parents:
52084
diff
changeset
|
75 (chinese-cns11643-7 . (nil . "CNS11643.1992-7")) |
6790b6f59b3a
(setup-default-fontset): Change "*" to
Kenichi Handa <handa@m17n.org>
parents:
52084
diff
changeset
|
76 (chinese-big5-1 . (nil . "Big5")) |
6790b6f59b3a
(setup-default-fontset): Change "*" to
Kenichi Handa <handa@m17n.org>
parents:
52084
diff
changeset
|
77 (chinese-big5-2 . (nil . "Big5")) |
50257
19c37f19c706
(setup-default-fontset): Use
Kenichi Handa <handa@m17n.org>
parents:
49598
diff
changeset
|
78 (chinese-sisheng . (nil . "sisheng_cwnn")) |
19c37f19c706
(setup-default-fontset): Use
Kenichi Handa <handa@m17n.org>
parents:
49598
diff
changeset
|
79 (vietnamese-viscii-lower . (nil . "VISCII1.1")) |
19c37f19c706
(setup-default-fontset): Use
Kenichi Handa <handa@m17n.org>
parents:
49598
diff
changeset
|
80 (vietnamese-viscii-upper . (nil . "VISCII1.1")) |
52201
6790b6f59b3a
(setup-default-fontset): Change "*" to
Kenichi Handa <handa@m17n.org>
parents:
52084
diff
changeset
|
81 (arabic-digit . (nil . "MuleArabic-0")) |
6790b6f59b3a
(setup-default-fontset): Change "*" to
Kenichi Handa <handa@m17n.org>
parents:
52084
diff
changeset
|
82 (arabic-1-column . (nil . "MuleArabic-1")) |
6790b6f59b3a
(setup-default-fontset): Change "*" to
Kenichi Handa <handa@m17n.org>
parents:
52084
diff
changeset
|
83 (arabic-2-column . (nil . "MuleArabic-2")) |
50257
19c37f19c706
(setup-default-fontset): Use
Kenichi Handa <handa@m17n.org>
parents:
49598
diff
changeset
|
84 (ipa . (nil . "MuleIPA")) |
52201
6790b6f59b3a
(setup-default-fontset): Change "*" to
Kenichi Handa <handa@m17n.org>
parents:
52084
diff
changeset
|
85 (ethiopic . (nil . "Ethiopic-Unicode")) |
50257
19c37f19c706
(setup-default-fontset): Use
Kenichi Handa <handa@m17n.org>
parents:
49598
diff
changeset
|
86 (ascii-right-to-left . (nil . "ISO8859-1")) |
52201
6790b6f59b3a
(setup-default-fontset): Change "*" to
Kenichi Handa <handa@m17n.org>
parents:
52084
diff
changeset
|
87 (indian-is13194 . (nil . "IS13194-Devanagari")) |
6790b6f59b3a
(setup-default-fontset): Change "*" to
Kenichi Handa <handa@m17n.org>
parents:
52084
diff
changeset
|
88 (indian-2-column . (nil . "MuleIndian-2")) |
6790b6f59b3a
(setup-default-fontset): Change "*" to
Kenichi Handa <handa@m17n.org>
parents:
52084
diff
changeset
|
89 (lao . (nil . "MuleLao-1")) |
50257
19c37f19c706
(setup-default-fontset): Use
Kenichi Handa <handa@m17n.org>
parents:
49598
diff
changeset
|
90 (tibetan . ("proportional" . "MuleTibetan-2")) |
52201
6790b6f59b3a
(setup-default-fontset): Change "*" to
Kenichi Handa <handa@m17n.org>
parents:
52084
diff
changeset
|
91 (tibetan-1-column . (nil . "MuleTibetan-1")) |
50257
19c37f19c706
(setup-default-fontset): Use
Kenichi Handa <handa@m17n.org>
parents:
49598
diff
changeset
|
92 (latin-iso8859-14 . (nil . "ISO8859-14")) |
19c37f19c706
(setup-default-fontset): Use
Kenichi Handa <handa@m17n.org>
parents:
49598
diff
changeset
|
93 (latin-iso8859-15 . (nil . "ISO8859-15")) |
19c37f19c706
(setup-default-fontset): Use
Kenichi Handa <handa@m17n.org>
parents:
49598
diff
changeset
|
94 (mule-unicode-0100-24ff . (nil . "ISO10646-1")) |
19c37f19c706
(setup-default-fontset): Use
Kenichi Handa <handa@m17n.org>
parents:
49598
diff
changeset
|
95 (mule-unicode-2500-33ff . (nil . "ISO10646-1")) |
19c37f19c706
(setup-default-fontset): Use
Kenichi Handa <handa@m17n.org>
parents:
49598
diff
changeset
|
96 (mule-unicode-e000-ffff . (nil . "ISO10646-1")) |
52201
6790b6f59b3a
(setup-default-fontset): Change "*" to
Kenichi Handa <handa@m17n.org>
parents:
52084
diff
changeset
|
97 (japanese-jisx0213-1 . (nil . "JISX0213.2000-1")) |
6790b6f59b3a
(setup-default-fontset): Change "*" to
Kenichi Handa <handa@m17n.org>
parents:
52084
diff
changeset
|
98 (japanese-jisx0213-2 . (nil . "JISX0213.2000-2")) |
50257
19c37f19c706
(setup-default-fontset): Use
Kenichi Handa <handa@m17n.org>
parents:
49598
diff
changeset
|
99 ;; unicode |
19c37f19c706
(setup-default-fontset): Use
Kenichi Handa <handa@m17n.org>
parents:
49598
diff
changeset
|
100 ((,(decode-char 'ucs #x0900) . ,(decode-char 'ucs #x097F)) |
52201
6790b6f59b3a
(setup-default-fontset): Change "*" to
Kenichi Handa <handa@m17n.org>
parents:
52084
diff
changeset
|
101 . (nil . "ISO10646.indian-1")) |
50257
19c37f19c706
(setup-default-fontset): Use
Kenichi Handa <handa@m17n.org>
parents:
49598
diff
changeset
|
102 ;; Indian CDAC |
19c37f19c706
(setup-default-fontset): Use
Kenichi Handa <handa@m17n.org>
parents:
49598
diff
changeset
|
103 (,(indian-font-char-range 'cdac:dv-ttsurekh) |
52201
6790b6f59b3a
(setup-default-fontset): Change "*" to
Kenichi Handa <handa@m17n.org>
parents:
52084
diff
changeset
|
104 . (nil . "Devanagari-CDAC")) |
50257
19c37f19c706
(setup-default-fontset): Use
Kenichi Handa <handa@m17n.org>
parents:
49598
diff
changeset
|
105 (,(indian-font-char-range 'cdac:sd-ttsurekh) |
52201
6790b6f59b3a
(setup-default-fontset): Change "*" to
Kenichi Handa <handa@m17n.org>
parents:
52084
diff
changeset
|
106 . (nil . "Sanskrit-CDAC")) |
50257
19c37f19c706
(setup-default-fontset): Use
Kenichi Handa <handa@m17n.org>
parents:
49598
diff
changeset
|
107 (,(indian-font-char-range 'cdac:bn-ttdurga) |
52201
6790b6f59b3a
(setup-default-fontset): Change "*" to
Kenichi Handa <handa@m17n.org>
parents:
52084
diff
changeset
|
108 . (nil . "Bengali-CDAC")) |
50257
19c37f19c706
(setup-default-fontset): Use
Kenichi Handa <handa@m17n.org>
parents:
49598
diff
changeset
|
109 (,(indian-font-char-range 'cdac:as-ttdurga) |
52201
6790b6f59b3a
(setup-default-fontset): Change "*" to
Kenichi Handa <handa@m17n.org>
parents:
52084
diff
changeset
|
110 . (nil . "Assamese-CDAC")) |
50257
19c37f19c706
(setup-default-fontset): Use
Kenichi Handa <handa@m17n.org>
parents:
49598
diff
changeset
|
111 (,(indian-font-char-range 'cdac:pn-ttamar) |
52201
6790b6f59b3a
(setup-default-fontset): Change "*" to
Kenichi Handa <handa@m17n.org>
parents:
52084
diff
changeset
|
112 . (nil . "Punjabi-CDAC")) |
50257
19c37f19c706
(setup-default-fontset): Use
Kenichi Handa <handa@m17n.org>
parents:
49598
diff
changeset
|
113 (,(indian-font-char-range 'cdac:gj-ttavantika) |
52201
6790b6f59b3a
(setup-default-fontset): Change "*" to
Kenichi Handa <handa@m17n.org>
parents:
52084
diff
changeset
|
114 . (nil . "Gujarati-CDAC")) |
50257
19c37f19c706
(setup-default-fontset): Use
Kenichi Handa <handa@m17n.org>
parents:
49598
diff
changeset
|
115 (,(indian-font-char-range 'cdac:or-ttsarala) |
52201
6790b6f59b3a
(setup-default-fontset): Change "*" to
Kenichi Handa <handa@m17n.org>
parents:
52084
diff
changeset
|
116 . (nil . "Oriya-CDAC")) |
50257
19c37f19c706
(setup-default-fontset): Use
Kenichi Handa <handa@m17n.org>
parents:
49598
diff
changeset
|
117 (,(indian-font-char-range 'cdac:tm-ttvalluvar) |
52201
6790b6f59b3a
(setup-default-fontset): Change "*" to
Kenichi Handa <handa@m17n.org>
parents:
52084
diff
changeset
|
118 . (nil . "Tamil-CDAC")) |
50257
19c37f19c706
(setup-default-fontset): Use
Kenichi Handa <handa@m17n.org>
parents:
49598
diff
changeset
|
119 (,(indian-font-char-range 'cdac:tl-tthemalatha) |
52201
6790b6f59b3a
(setup-default-fontset): Change "*" to
Kenichi Handa <handa@m17n.org>
parents:
52084
diff
changeset
|
120 . (nil . "Telugu-CDAC")) |
50257
19c37f19c706
(setup-default-fontset): Use
Kenichi Handa <handa@m17n.org>
parents:
49598
diff
changeset
|
121 (,(indian-font-char-range 'cdac:kn-ttuma) |
52201
6790b6f59b3a
(setup-default-fontset): Change "*" to
Kenichi Handa <handa@m17n.org>
parents:
52084
diff
changeset
|
122 . (nil . "Kannada-CDAC")) |
50257
19c37f19c706
(setup-default-fontset): Use
Kenichi Handa <handa@m17n.org>
parents:
49598
diff
changeset
|
123 (,(indian-font-char-range 'cdac:ml-ttkarthika) |
52201
6790b6f59b3a
(setup-default-fontset): Change "*" to
Kenichi Handa <handa@m17n.org>
parents:
52084
diff
changeset
|
124 . (nil . "Malayalam-CDAC")) |
50257
19c37f19c706
(setup-default-fontset): Use
Kenichi Handa <handa@m17n.org>
parents:
49598
diff
changeset
|
125 ;; Indian AKRUTI |
19c37f19c706
(setup-default-fontset): Use
Kenichi Handa <handa@m17n.org>
parents:
49598
diff
changeset
|
126 (,(indian-font-char-range 'akruti:dev) |
52201
6790b6f59b3a
(setup-default-fontset): Change "*" to
Kenichi Handa <handa@m17n.org>
parents:
52084
diff
changeset
|
127 . (nil . "Devanagari-Akruti")) |
50257
19c37f19c706
(setup-default-fontset): Use
Kenichi Handa <handa@m17n.org>
parents:
49598
diff
changeset
|
128 (,(indian-font-char-range 'akruti:bng) |
52201
6790b6f59b3a
(setup-default-fontset): Change "*" to
Kenichi Handa <handa@m17n.org>
parents:
52084
diff
changeset
|
129 . (nil . "Bengali-Akruti")) |
50257
19c37f19c706
(setup-default-fontset): Use
Kenichi Handa <handa@m17n.org>
parents:
49598
diff
changeset
|
130 (,(indian-font-char-range 'akruti:pnj) |
52201
6790b6f59b3a
(setup-default-fontset): Change "*" to
Kenichi Handa <handa@m17n.org>
parents:
52084
diff
changeset
|
131 . (nil . "Punjabi-Akruti")) |
50257
19c37f19c706
(setup-default-fontset): Use
Kenichi Handa <handa@m17n.org>
parents:
49598
diff
changeset
|
132 (,(indian-font-char-range 'akruti:guj) |
52201
6790b6f59b3a
(setup-default-fontset): Change "*" to
Kenichi Handa <handa@m17n.org>
parents:
52084
diff
changeset
|
133 . (nil . "Gujarati-Akruti")) |
50257
19c37f19c706
(setup-default-fontset): Use
Kenichi Handa <handa@m17n.org>
parents:
49598
diff
changeset
|
134 (,(indian-font-char-range 'akruti:ori) |
71457
d4044fb56644
(setup-default-fontset): Fix a typo in the "Oriya-Akruti" registry name.
Eli Zaretskii <eliz@gnu.org>
parents:
69294
diff
changeset
|
135 . (nil . "Oriya-Akruti")) |
50257
19c37f19c706
(setup-default-fontset): Use
Kenichi Handa <handa@m17n.org>
parents:
49598
diff
changeset
|
136 (,(indian-font-char-range 'akruti:tml) |
52201
6790b6f59b3a
(setup-default-fontset): Change "*" to
Kenichi Handa <handa@m17n.org>
parents:
52084
diff
changeset
|
137 . (nil . "Tamil-Akruti")) |
50257
19c37f19c706
(setup-default-fontset): Use
Kenichi Handa <handa@m17n.org>
parents:
49598
diff
changeset
|
138 (,(indian-font-char-range 'akruti:tlg) |
52201
6790b6f59b3a
(setup-default-fontset): Change "*" to
Kenichi Handa <handa@m17n.org>
parents:
52084
diff
changeset
|
139 . (nil . "Telugu-Akruti")) |
50257
19c37f19c706
(setup-default-fontset): Use
Kenichi Handa <handa@m17n.org>
parents:
49598
diff
changeset
|
140 (,(indian-font-char-range 'akruti:knd) |
52201
6790b6f59b3a
(setup-default-fontset): Change "*" to
Kenichi Handa <handa@m17n.org>
parents:
52084
diff
changeset
|
141 . (nil . "Kannada-Akruti")) |
50257
19c37f19c706
(setup-default-fontset): Use
Kenichi Handa <handa@m17n.org>
parents:
49598
diff
changeset
|
142 (,(indian-font-char-range 'akruti:mal) |
52201
6790b6f59b3a
(setup-default-fontset): Change "*" to
Kenichi Handa <handa@m17n.org>
parents:
52084
diff
changeset
|
143 . (nil . "Malayalam-Akruti")) |
50257
19c37f19c706
(setup-default-fontset): Use
Kenichi Handa <handa@m17n.org>
parents:
49598
diff
changeset
|
144 )) |
49287
5cb7e7103296
Don't setup the default fontset and
Kenichi Handa <handa@m17n.org>
parents:
47711
diff
changeset
|
145 (set-fontset-font "fontset-default" (car elt) (cdr elt)))) |
17052 | 146 |
147 ;; Set arguments in `font-encoding-alist' (which see). | |
148 (defun set-font-encoding (pattern charset encoding) | |
149 (let ((slot (assoc pattern font-encoding-alist))) | |
150 (if slot | |
151 (let ((place (assq charset (cdr slot)))) | |
152 (if place | |
153 (setcdr place encoding) | |
154 (setcdr slot (cons (cons charset encoding) (cdr slot))))) | |
155 (setq font-encoding-alist | |
156 (cons (list pattern (cons charset encoding)) font-encoding-alist))) | |
157 )) | |
158 | |
47711
d99378556333
(ucs-mule-to-mule-unicode): Define this
Kenichi Handa <handa@m17n.org>
parents:
42329
diff
changeset
|
159 ;; Allow display of arbitrary characters with an iso-10646-encoded |
d99378556333
(ucs-mule-to-mule-unicode): Define this
Kenichi Handa <handa@m17n.org>
parents:
42329
diff
changeset
|
160 ;; (`Unicode') font. |
d99378556333
(ucs-mule-to-mule-unicode): Define this
Kenichi Handa <handa@m17n.org>
parents:
42329
diff
changeset
|
161 (define-translation-table 'ucs-mule-to-mule-unicode |
d99378556333
(ucs-mule-to-mule-unicode): Define this
Kenichi Handa <handa@m17n.org>
parents:
42329
diff
changeset
|
162 ucs-mule-to-mule-unicode) |
d99378556333
(ucs-mule-to-mule-unicode): Define this
Kenichi Handa <handa@m17n.org>
parents:
42329
diff
changeset
|
163 (define-translation-hash-table 'ucs-mule-cjk-to-unicode |
d99378556333
(ucs-mule-to-mule-unicode): Define this
Kenichi Handa <handa@m17n.org>
parents:
42329
diff
changeset
|
164 ucs-mule-cjk-to-unicode) |
d99378556333
(ucs-mule-to-mule-unicode): Define this
Kenichi Handa <handa@m17n.org>
parents:
42329
diff
changeset
|
165 |
33048
636ac3744ddd
(fontset-default): Modified for mule-unicode-2500-33ff and
Kenichi Handa <handa@m17n.org>
parents:
32646
diff
changeset
|
166 (define-ccl-program ccl-encode-unicode-font |
32646
43edadfecb51
Use registry "MuleTibetan-2" for Tibetan.
Kenichi Handa <handa@m17n.org>
parents:
29427
diff
changeset
|
167 `(0 |
47711
d99378556333
(ucs-mule-to-mule-unicode): Define this
Kenichi Handa <handa@m17n.org>
parents:
42329
diff
changeset
|
168 ;; r0: charset-id |
d99378556333
(ucs-mule-to-mule-unicode): Define this
Kenichi Handa <handa@m17n.org>
parents:
42329
diff
changeset
|
169 ;; r1: 1st position code |
d99378556333
(ucs-mule-to-mule-unicode): Define this
Kenichi Handa <handa@m17n.org>
parents:
42329
diff
changeset
|
170 ;; r2: 2nd position code (if r0 is 2D charset) |
d99378556333
(ucs-mule-to-mule-unicode): Define this
Kenichi Handa <handa@m17n.org>
parents:
42329
diff
changeset
|
171 ((if (r0 == ,(charset-id 'ascii)) |
d99378556333
(ucs-mule-to-mule-unicode): Define this
Kenichi Handa <handa@m17n.org>
parents:
42329
diff
changeset
|
172 ((r2 = r1) |
d99378556333
(ucs-mule-to-mule-unicode): Define this
Kenichi Handa <handa@m17n.org>
parents:
42329
diff
changeset
|
173 (r1 = 0)) |
d99378556333
(ucs-mule-to-mule-unicode): Define this
Kenichi Handa <handa@m17n.org>
parents:
42329
diff
changeset
|
174 ;; At first, try to get a Unicode code point directly. |
d99378556333
(ucs-mule-to-mule-unicode): Define this
Kenichi Handa <handa@m17n.org>
parents:
42329
diff
changeset
|
175 ((if (r2 >= 0) |
d99378556333
(ucs-mule-to-mule-unicode): Define this
Kenichi Handa <handa@m17n.org>
parents:
42329
diff
changeset
|
176 ;; This is a 2D charset. |
d99378556333
(ucs-mule-to-mule-unicode): Define this
Kenichi Handa <handa@m17n.org>
parents:
42329
diff
changeset
|
177 (r1 = ((r1 << 7) | r2))) |
66059
17f02a9e1c99
(ccl-encode-unicode-font): Lookup
Kenichi Handa <handa@m17n.org>
parents:
64085
diff
changeset
|
178 (lookup-character utf-subst-table-for-encode r0 r1) |
47711
d99378556333
(ucs-mule-to-mule-unicode): Define this
Kenichi Handa <handa@m17n.org>
parents:
42329
diff
changeset
|
179 (if r7 |
d99378556333
(ucs-mule-to-mule-unicode): Define this
Kenichi Handa <handa@m17n.org>
parents:
42329
diff
changeset
|
180 ;; We got it! |
d99378556333
(ucs-mule-to-mule-unicode): Define this
Kenichi Handa <handa@m17n.org>
parents:
42329
diff
changeset
|
181 ((r1 = (r0 >> 8)) |
d99378556333
(ucs-mule-to-mule-unicode): Define this
Kenichi Handa <handa@m17n.org>
parents:
42329
diff
changeset
|
182 (r2 = (r0 & #xFF))) |
d99378556333
(ucs-mule-to-mule-unicode): Define this
Kenichi Handa <handa@m17n.org>
parents:
42329
diff
changeset
|
183 ;; Look for a translation for non-ASCII chars. |
d99378556333
(ucs-mule-to-mule-unicode): Define this
Kenichi Handa <handa@m17n.org>
parents:
42329
diff
changeset
|
184 ((translate-character ucs-mule-to-mule-unicode r0 r1) |
66059
17f02a9e1c99
(ccl-encode-unicode-font): Lookup
Kenichi Handa <handa@m17n.org>
parents:
64085
diff
changeset
|
185 (if (r0 == ,(charset-id 'ascii)) |
17f02a9e1c99
(ccl-encode-unicode-font): Lookup
Kenichi Handa <handa@m17n.org>
parents:
64085
diff
changeset
|
186 ((r2 = r1) |
47711
d99378556333
(ucs-mule-to-mule-unicode): Define this
Kenichi Handa <handa@m17n.org>
parents:
42329
diff
changeset
|
187 (r1 = 0)) |
66059
17f02a9e1c99
(ccl-encode-unicode-font): Lookup
Kenichi Handa <handa@m17n.org>
parents:
64085
diff
changeset
|
188 ((if (r0 == ,(charset-id 'latin-iso8859-1)) |
17f02a9e1c99
(ccl-encode-unicode-font): Lookup
Kenichi Handa <handa@m17n.org>
parents:
64085
diff
changeset
|
189 ((r2 = (r1 + 128)) |
17f02a9e1c99
(ccl-encode-unicode-font): Lookup
Kenichi Handa <handa@m17n.org>
parents:
64085
diff
changeset
|
190 (r1 = 0)) |
17f02a9e1c99
(ccl-encode-unicode-font): Lookup
Kenichi Handa <handa@m17n.org>
parents:
64085
diff
changeset
|
191 ((r2 = (r1 & #x7F)) |
17f02a9e1c99
(ccl-encode-unicode-font): Lookup
Kenichi Handa <handa@m17n.org>
parents:
64085
diff
changeset
|
192 (r1 >>= 7) |
17f02a9e1c99
(ccl-encode-unicode-font): Lookup
Kenichi Handa <handa@m17n.org>
parents:
64085
diff
changeset
|
193 (if (r0 == ,(charset-id 'mule-unicode-0100-24ff)) |
17f02a9e1c99
(ccl-encode-unicode-font): Lookup
Kenichi Handa <handa@m17n.org>
parents:
64085
diff
changeset
|
194 ((r1 *= 96) |
17f02a9e1c99
(ccl-encode-unicode-font): Lookup
Kenichi Handa <handa@m17n.org>
parents:
64085
diff
changeset
|
195 (r1 += r2) |
17f02a9e1c99
(ccl-encode-unicode-font): Lookup
Kenichi Handa <handa@m17n.org>
parents:
64085
diff
changeset
|
196 (r1 += ,(- #x100 (* 32 96) 32)) |
17f02a9e1c99
(ccl-encode-unicode-font): Lookup
Kenichi Handa <handa@m17n.org>
parents:
64085
diff
changeset
|
197 (r1 >8= 0) |
17f02a9e1c99
(ccl-encode-unicode-font): Lookup
Kenichi Handa <handa@m17n.org>
parents:
64085
diff
changeset
|
198 (r2 = r7)) |
17f02a9e1c99
(ccl-encode-unicode-font): Lookup
Kenichi Handa <handa@m17n.org>
parents:
64085
diff
changeset
|
199 (if (r0 == ,(charset-id 'mule-unicode-2500-33ff)) |
17f02a9e1c99
(ccl-encode-unicode-font): Lookup
Kenichi Handa <handa@m17n.org>
parents:
64085
diff
changeset
|
200 ((r1 *= 96) |
17f02a9e1c99
(ccl-encode-unicode-font): Lookup
Kenichi Handa <handa@m17n.org>
parents:
64085
diff
changeset
|
201 (r1 += r2) |
17f02a9e1c99
(ccl-encode-unicode-font): Lookup
Kenichi Handa <handa@m17n.org>
parents:
64085
diff
changeset
|
202 (r1 += ,(- #x2500 (* 32 96) 32)) |
17f02a9e1c99
(ccl-encode-unicode-font): Lookup
Kenichi Handa <handa@m17n.org>
parents:
64085
diff
changeset
|
203 (r1 >8= 0) |
17f02a9e1c99
(ccl-encode-unicode-font): Lookup
Kenichi Handa <handa@m17n.org>
parents:
64085
diff
changeset
|
204 (r2 = r7)) |
17f02a9e1c99
(ccl-encode-unicode-font): Lookup
Kenichi Handa <handa@m17n.org>
parents:
64085
diff
changeset
|
205 (if (r0 == ,(charset-id 'mule-unicode-e000-ffff)) |
17f02a9e1c99
(ccl-encode-unicode-font): Lookup
Kenichi Handa <handa@m17n.org>
parents:
64085
diff
changeset
|
206 ((r1 *= 96) |
17f02a9e1c99
(ccl-encode-unicode-font): Lookup
Kenichi Handa <handa@m17n.org>
parents:
64085
diff
changeset
|
207 (r1 += r2) |
17f02a9e1c99
(ccl-encode-unicode-font): Lookup
Kenichi Handa <handa@m17n.org>
parents:
64085
diff
changeset
|
208 (r1 += ,(- #xe000 (* 32 96) 32)) |
17f02a9e1c99
(ccl-encode-unicode-font): Lookup
Kenichi Handa <handa@m17n.org>
parents:
64085
diff
changeset
|
209 (r1 >8= 0) |
17f02a9e1c99
(ccl-encode-unicode-font): Lookup
Kenichi Handa <handa@m17n.org>
parents:
64085
diff
changeset
|
210 (r2 = r7)) |
17f02a9e1c99
(ccl-encode-unicode-font): Lookup
Kenichi Handa <handa@m17n.org>
parents:
64085
diff
changeset
|
211 ;; No way, use the glyph for U+FFFD. |
17f02a9e1c99
(ccl-encode-unicode-font): Lookup
Kenichi Handa <handa@m17n.org>
parents:
64085
diff
changeset
|
212 ((r1 = #xFF) |
17f02a9e1c99
(ccl-encode-unicode-font): Lookup
Kenichi Handa <handa@m17n.org>
parents:
64085
diff
changeset
|
213 (r2 = #xFD))))))))))))))) |
47711
d99378556333
(ucs-mule-to-mule-unicode): Define this
Kenichi Handa <handa@m17n.org>
parents:
42329
diff
changeset
|
214 "Encode characters for display with iso10646 font. |
d99378556333
(ucs-mule-to-mule-unicode): Define this
Kenichi Handa <handa@m17n.org>
parents:
42329
diff
changeset
|
215 Translate through the translation-hash-table named |
d99378556333
(ucs-mule-to-mule-unicode): Define this
Kenichi Handa <handa@m17n.org>
parents:
42329
diff
changeset
|
216 `ucs-mule-cjk-to-unicode' and the translation-table named |
d99378556333
(ucs-mule-to-mule-unicode): Define this
Kenichi Handa <handa@m17n.org>
parents:
42329
diff
changeset
|
217 `ucs-mule-to-mule-unicode' initially.") |
32646
43edadfecb51
Use registry "MuleTibetan-2" for Tibetan.
Kenichi Handa <handa@m17n.org>
parents:
29427
diff
changeset
|
218 |
47711
d99378556333
(ucs-mule-to-mule-unicode): Define this
Kenichi Handa <handa@m17n.org>
parents:
42329
diff
changeset
|
219 ;; Use the above CCL encoder for Unicode fonts. Please note that the |
d99378556333
(ucs-mule-to-mule-unicode): Define this
Kenichi Handa <handa@m17n.org>
parents:
42329
diff
changeset
|
220 ;; regexp is not simply "ISO10646-1" because there exists, for |
d99378556333
(ucs-mule-to-mule-unicode): Define this
Kenichi Handa <handa@m17n.org>
parents:
42329
diff
changeset
|
221 ;; instance, the following Devanagari Unicode fonts: |
d99378556333
(ucs-mule-to-mule-unicode): Define this
Kenichi Handa <handa@m17n.org>
parents:
42329
diff
changeset
|
222 ;; -misc-fixed-medium-r-normal--24-240-72-72-c-120-iso10646.indian-1 |
d99378556333
(ucs-mule-to-mule-unicode): Define this
Kenichi Handa <handa@m17n.org>
parents:
42329
diff
changeset
|
223 ;; -sibal-devanagari-medium-r-normal--24-240-75-75-P--iso10646-dev |
32646
43edadfecb51
Use registry "MuleTibetan-2" for Tibetan.
Kenichi Handa <handa@m17n.org>
parents:
29427
diff
changeset
|
224 (setq font-ccl-encoder-alist |
47711
d99378556333
(ucs-mule-to-mule-unicode): Define this
Kenichi Handa <handa@m17n.org>
parents:
42329
diff
changeset
|
225 (cons '("ISO10646.*-*" . ccl-encode-unicode-font) |
32646
43edadfecb51
Use registry "MuleTibetan-2" for Tibetan.
Kenichi Handa <handa@m17n.org>
parents:
29427
diff
changeset
|
226 font-ccl-encoder-alist)) |
43edadfecb51
Use registry "MuleTibetan-2" for Tibetan.
Kenichi Handa <handa@m17n.org>
parents:
29427
diff
changeset
|
227 |
17052 | 228 ;; Setting for suppressing XLoadQueryFont on big fonts. |
229 (setq x-pixel-size-width-font-regexp | |
230 "gb2312\\|jisx0208\\|ksc5601\\|cns11643\\|big5") | |
231 | |
28215
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
232 ;; These fonts require vertical centering. |
26886
8a6d8101919e
(vertical-centering-font-regexp): New
Kenichi Handa <handa@m17n.org>
parents:
26013
diff
changeset
|
233 (setq vertical-centering-font-regexp |
28215
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
234 "gb2312\\|jisx0208\\|jisx0212\\|ksc5601\\|cns11643\\|big5") |
26886
8a6d8101919e
(vertical-centering-font-regexp): New
Kenichi Handa <handa@m17n.org>
parents:
26013
diff
changeset
|
235 |
50516
125da3e3e9af
Specify rescale ratio 1.3 for CDAC fonts.
Kenichi Handa <handa@m17n.org>
parents:
50257
diff
changeset
|
236 ;; CDAC fonts are actually smaller than their design sizes. |
125da3e3e9af
Specify rescale ratio 1.3 for CDAC fonts.
Kenichi Handa <handa@m17n.org>
parents:
50257
diff
changeset
|
237 (setq face-font-rescale-alist |
125da3e3e9af
Specify rescale ratio 1.3 for CDAC fonts.
Kenichi Handa <handa@m17n.org>
parents:
50257
diff
changeset
|
238 '(("-cdac$" . 1.3))) |
125da3e3e9af
Specify rescale ratio 1.3 for CDAC fonts.
Kenichi Handa <handa@m17n.org>
parents:
50257
diff
changeset
|
239 |
22161
7a4c3fd89dda
(x-font-name-charset-alist): New
Kenichi Handa <handa@m17n.org>
parents:
22128
diff
changeset
|
240 (defvar x-font-name-charset-alist |
7a4c3fd89dda
(x-font-name-charset-alist): New
Kenichi Handa <handa@m17n.org>
parents:
22128
diff
changeset
|
241 '(("iso8859-1" ascii latin-iso8859-1) |
7a4c3fd89dda
(x-font-name-charset-alist): New
Kenichi Handa <handa@m17n.org>
parents:
22128
diff
changeset
|
242 ("iso8859-2" ascii latin-iso8859-2) |
7a4c3fd89dda
(x-font-name-charset-alist): New
Kenichi Handa <handa@m17n.org>
parents:
22128
diff
changeset
|
243 ("iso8859-3" ascii latin-iso8859-3) |
7a4c3fd89dda
(x-font-name-charset-alist): New
Kenichi Handa <handa@m17n.org>
parents:
22128
diff
changeset
|
244 ("iso8859-4" ascii latin-iso8859-4) |
7a4c3fd89dda
(x-font-name-charset-alist): New
Kenichi Handa <handa@m17n.org>
parents:
22128
diff
changeset
|
245 ("iso8859-5" ascii cyrillic-iso8859-5) |
7a4c3fd89dda
(x-font-name-charset-alist): New
Kenichi Handa <handa@m17n.org>
parents:
22128
diff
changeset
|
246 ("iso8859-6" ascii arabic-iso8859-6) |
7a4c3fd89dda
(x-font-name-charset-alist): New
Kenichi Handa <handa@m17n.org>
parents:
22128
diff
changeset
|
247 ("iso8859-7" ascii greek-iso8859-7) |
7a4c3fd89dda
(x-font-name-charset-alist): New
Kenichi Handa <handa@m17n.org>
parents:
22128
diff
changeset
|
248 ("iso8859-8" ascii hebrew-iso8859-8) |
26013 | 249 ("iso8859-14" ascii latin-iso8859-14) |
250 ("iso8859-15" ascii latin-iso8859-15) | |
22161
7a4c3fd89dda
(x-font-name-charset-alist): New
Kenichi Handa <handa@m17n.org>
parents:
22128
diff
changeset
|
251 ("tis620" ascii thai-tis620) |
7a4c3fd89dda
(x-font-name-charset-alist): New
Kenichi Handa <handa@m17n.org>
parents:
22128
diff
changeset
|
252 ("koi8" ascii cyrillic-iso8859-5) |
7a4c3fd89dda
(x-font-name-charset-alist): New
Kenichi Handa <handa@m17n.org>
parents:
22128
diff
changeset
|
253 ("viscii" ascii vietnamese-viscii-upper vietnamese-viscii-lower) |
7a4c3fd89dda
(x-font-name-charset-alist): New
Kenichi Handa <handa@m17n.org>
parents:
22128
diff
changeset
|
254 ("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
|
255 ("mulelao-1" ascii lao) |
33048
636ac3744ddd
(fontset-default): Modified for mule-unicode-2500-33ff and
Kenichi Handa <handa@m17n.org>
parents:
32646
diff
changeset
|
256 ("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
|
257 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
|
258 "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
|
259 |
7a4c3fd89dda
(x-font-name-charset-alist): New
Kenichi Handa <handa@m17n.org>
parents:
22128
diff
changeset
|
260 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
|
261 `-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
|
262 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
|
263 created and used for the initial frame.") |
7a4c3fd89dda
(x-font-name-charset-alist): New
Kenichi Handa <handa@m17n.org>
parents:
22128
diff
changeset
|
264 |
17052 | 265 ;;; XLFD (X Logical Font Description) format handler. |
266 | |
267 ;; Define XLFD's field index numbers. ; field name | |
268 (defconst xlfd-regexp-foundry-subnum 0) ; FOUNDRY | |
269 (defconst xlfd-regexp-family-subnum 1) ; FAMILY_NAME | |
270 (defconst xlfd-regexp-weight-subnum 2) ; WEIGHT_NAME | |
271 (defconst xlfd-regexp-slant-subnum 3) ; SLANT | |
272 (defconst xlfd-regexp-swidth-subnum 4) ; SETWIDTH_NAME | |
273 (defconst xlfd-regexp-adstyle-subnum 5) ; ADD_STYLE_NAME | |
274 (defconst xlfd-regexp-pixelsize-subnum 6) ; PIXEL_SIZE | |
275 (defconst xlfd-regexp-pointsize-subnum 7) ; POINT_SIZE | |
276 (defconst xlfd-regexp-resx-subnum 8) ; RESOLUTION_X | |
277 (defconst xlfd-regexp-resy-subnum 9) ; RESOLUTION_Y | |
278 (defconst xlfd-regexp-spacing-subnum 10) ; SPACING | |
279 (defconst xlfd-regexp-avgwidth-subnum 11) ; AVERAGE_WIDTH | |
280 (defconst xlfd-regexp-registry-subnum 12) ; CHARSET_REGISTRY | |
281 (defconst xlfd-regexp-encoding-subnum 13) ; CHARSET_ENCODING | |
282 | |
283 ;; Regular expression matching against a fontname which conforms to | |
284 ;; XLFD (X Logical Font Description). All fields in XLFD should be | |
285 ;; not be omitted (but can be a wild card) to be matched. | |
286 (defconst xlfd-tight-regexp | |
287 "^\ | |
288 -\\([^-]*\\)-\\([^-]*\\)-\\([^-]*\\)-\\([^-]*\\)-\\([^-]*\\)\ | |
289 -\\([^-]*\\)-\\([^-]*\\)-\\([^-]*\\)-\\([^-]*\\)-\\([^-]*\\)\ | |
290 -\\([^-]*\\)-\\([^-]*\\)-\\([^-]*\\)-\\([^-]*\\)$") | |
291 | |
292 ;; List of field numbers of XLFD whose values are numeric. | |
293 (defconst xlfd-regexp-numeric-subnums | |
294 (list xlfd-regexp-pixelsize-subnum ;6 | |
295 xlfd-regexp-pointsize-subnum ;7 | |
296 xlfd-regexp-resx-subnum ;8 | |
297 xlfd-regexp-resy-subnum ;9 | |
298 xlfd-regexp-avgwidth-subnum ;11 | |
299 )) | |
300 | |
301 (defun x-decompose-font-name (pattern) | |
302 "Decompose PATTERN into XLFD's fields and return vector of the fields. | |
303 The length of the vector is 14. | |
304 | |
305 If PATTERN doesn't conform to XLFD, try to get a full XLFD name from | |
306 X server and use the information of the full name to decompose | |
307 PATTERN. If no full XLFD name is gotten, return nil." | |
308 (let (xlfd-fields fontname) | |
309 (if (string-match xlfd-tight-regexp pattern) | |
310 (let ((i 0)) | |
311 (setq xlfd-fields (make-vector 14 nil)) | |
312 (while (< i 14) | |
313 (aset xlfd-fields i (match-string (1+ i) pattern)) | |
314 (setq i (1+ i))) | |
315 xlfd-fields) | |
316 (setq fontname (condition-case nil | |
317 (x-resolve-font-name pattern) | |
318 (error))) | |
319 (if (and fontname | |
320 (string-match xlfd-tight-regexp fontname)) | |
23890
fa4839661777
(x-decompose-font-name): If PATTERN
Kenichi Handa <handa@m17n.org>
parents:
23655
diff
changeset
|
321 ;; We get a full XLFD name. |
17052 | 322 (let ((len (length pattern)) |
323 (i 0) | |
324 l) | |
23890
fa4839661777
(x-decompose-font-name): If PATTERN
Kenichi Handa <handa@m17n.org>
parents:
23655
diff
changeset
|
325 ;; 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
|
326 ;; should be a cons of matched index and matched string. |
17052 | 327 (setq xlfd-fields (make-vector 14 nil)) |
328 (while (< i 14) | |
329 (aset xlfd-fields i | |
330 (cons (match-beginning (1+ i)) | |
331 (match-string (1+ i) fontname))) | |
332 (setq i (1+ i))) | |
23890
fa4839661777
(x-decompose-font-name): If PATTERN
Kenichi Handa <handa@m17n.org>
parents:
23655
diff
changeset
|
333 |
fa4839661777
(x-decompose-font-name): If PATTERN
Kenichi Handa <handa@m17n.org>
parents:
23655
diff
changeset
|
334 ;; Replace wild cards in PATTERN by regexp codes. |
17052 | 335 (setq i 0) |
336 (while (< i len) | |
337 (let ((ch (aref pattern i))) | |
338 (if (= ch ??) | |
339 (setq pattern (concat (substring pattern 0 i) | |
340 "\\(.\\)" | |
341 (substring pattern (1+ i))) | |
342 len (+ len 4) | |
343 i (+ i 4)) | |
344 (if (= ch ?*) | |
345 (setq pattern (concat (substring pattern 0 i) | |
346 "\\(.*\\)" | |
347 (substring pattern (1+ i))) | |
348 len (+ len 5) | |
349 i (+ i 5)) | |
350 (setq i (1+ i)))))) | |
23890
fa4839661777
(x-decompose-font-name): If PATTERN
Kenichi Handa <handa@m17n.org>
parents:
23655
diff
changeset
|
351 |
fa4839661777
(x-decompose-font-name): If PATTERN
Kenichi Handa <handa@m17n.org>
parents:
23655
diff
changeset
|
352 ;; 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
|
353 (if (string-match pattern fontname) |
fa4839661777
(x-decompose-font-name): If PATTERN
Kenichi Handa <handa@m17n.org>
parents:
23655
diff
changeset
|
354 ;; The regular expression PATTERN matchs the full XLFD |
fa4839661777
(x-decompose-font-name): If PATTERN
Kenichi Handa <handa@m17n.org>
parents:
23655
diff
changeset
|
355 ;; 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
|
356 ;; 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
|
357 ;; exact strings in PATTERN. |
fa4839661777
(x-decompose-font-name): If PATTERN
Kenichi Handa <handa@m17n.org>
parents:
23655
diff
changeset
|
358 (let ((l (cdr (cdr (match-data))))) |
fa4839661777
(x-decompose-font-name): If PATTERN
Kenichi Handa <handa@m17n.org>
parents:
23655
diff
changeset
|
359 (setq i 0) |
fa4839661777
(x-decompose-font-name): If PATTERN
Kenichi Handa <handa@m17n.org>
parents:
23655
diff
changeset
|
360 (while (< i 14) |
fa4839661777
(x-decompose-font-name): If PATTERN
Kenichi Handa <handa@m17n.org>
parents:
23655
diff
changeset
|
361 (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
|
362 (progn |
fa4839661777
(x-decompose-font-name): If PATTERN
Kenichi Handa <handa@m17n.org>
parents:
23655
diff
changeset
|
363 (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
|
364 (setq i (1+ i))) |
fa4839661777
(x-decompose-font-name): If PATTERN
Kenichi Handa <handa@m17n.org>
parents:
23655
diff
changeset
|
365 (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
|
366 (progn |
fa4839661777
(x-decompose-font-name): If PATTERN
Kenichi Handa <handa@m17n.org>
parents:
23655
diff
changeset
|
367 (aset xlfd-fields i "*") |
fa4839661777
(x-decompose-font-name): If PATTERN
Kenichi Handa <handa@m17n.org>
parents:
23655
diff
changeset
|
368 (setq i (1+ i))) |
fa4839661777
(x-decompose-font-name): If PATTERN
Kenichi Handa <handa@m17n.org>
parents:
23655
diff
changeset
|
369 (setq l (cdr (cdr l))))))) |
fa4839661777
(x-decompose-font-name): If PATTERN
Kenichi Handa <handa@m17n.org>
parents:
23655
diff
changeset
|
370 ;; 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
|
371 ;; in the corresonding fields in full XLFD name. |
fa4839661777
(x-decompose-font-name): If PATTERN
Kenichi Handa <handa@m17n.org>
parents:
23655
diff
changeset
|
372 (setq i 0) |
fa4839661777
(x-decompose-font-name): If PATTERN
Kenichi Handa <handa@m17n.org>
parents:
23655
diff
changeset
|
373 (while (< i 14) |
fa4839661777
(x-decompose-font-name): If PATTERN
Kenichi Handa <handa@m17n.org>
parents:
23655
diff
changeset
|
374 (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
|
375 (setq i (1+ i)))) |
17052 | 376 xlfd-fields))))) |
377 | |
17177
9e550b522bc0
(x-charset-registries): Change entry for Ethiopic.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
378 ;; 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
|
379 ;; 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
|
380 (defsubst x-reduce-font-name (name) |
9e550b522bc0
(x-charset-registries): Change entry for Ethiopic.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
381 (while (string-match "-\\*-\\(\\*-\\)+" name) |
9e550b522bc0
(x-charset-registries): Change entry for Ethiopic.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
382 (setq name (replace-match "-*-" t t name))) |
9e550b522bc0
(x-charset-registries): Change entry for Ethiopic.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
383 name) |
9e550b522bc0
(x-charset-registries): Change entry for Ethiopic.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
384 |
22449
c87830c691a5
(instantiate-fontset): Delete
Kenichi Handa <handa@m17n.org>
parents:
22161
diff
changeset
|
385 (defun x-compose-font-name (fields &optional reduce) |
17052 | 386 "Compose X's fontname from FIELDS. |
74330
5401c4ed263b
(create-fontset-from-ascii-font, create-fontset-from-fontset-spec,
Juanma Barranquero <lekktu@gmail.com>
parents:
74190
diff
changeset
|
387 FIELDS is a vector of XLFD fields, of length 14. |
17177
9e550b522bc0
(x-charset-registries): Change entry for Ethiopic.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
388 If a field is nil, wild-card letter `*' is embedded. |
74330
5401c4ed263b
(create-fontset-from-ascii-font, create-fontset-from-fontset-spec,
Juanma Barranquero <lekktu@gmail.com>
parents:
74190
diff
changeset
|
389 Optional argument REDUCE exists just for backward compatibility, |
5401c4ed263b
(create-fontset-from-ascii-font, create-fontset-from-fontset-spec,
Juanma Barranquero <lekktu@gmail.com>
parents:
74190
diff
changeset
|
390 and is always ignored." |
28215
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
391 (concat "-" (mapconcat (lambda (x) (or x "*")) fields "-"))) |
23205
22df54cdb841
(resolved-ascii-font): New variable.
Kenichi Handa <handa@m17n.org>
parents:
23196
diff
changeset
|
392 |
40250
4f3033e5b688
(x-must-resolve-font-name): New
Gerd Moellmann <gerd@gnu.org>
parents:
38414
diff
changeset
|
393 |
4f3033e5b688
(x-must-resolve-font-name): New
Gerd Moellmann <gerd@gnu.org>
parents:
38414
diff
changeset
|
394 (defun x-must-resolve-font-name (xlfd-fields) |
4f3033e5b688
(x-must-resolve-font-name): New
Gerd Moellmann <gerd@gnu.org>
parents:
38414
diff
changeset
|
395 "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
|
396 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
|
397 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
|
398 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
|
399 Value is name of that font." |
4f3033e5b688
(x-must-resolve-font-name): New
Gerd Moellmann <gerd@gnu.org>
parents:
38414
diff
changeset
|
400 (let ((ascii-font nil) (index 0)) |
4f3033e5b688
(x-must-resolve-font-name): New
Gerd Moellmann <gerd@gnu.org>
parents:
38414
diff
changeset
|
401 (while (and (null ascii-font) (<= index xlfd-regexp-encoding-subnum)) |
4f3033e5b688
(x-must-resolve-font-name): New
Gerd Moellmann <gerd@gnu.org>
parents:
38414
diff
changeset
|
402 (let ((pattern (x-compose-font-name xlfd-fields))) |
4f3033e5b688
(x-must-resolve-font-name): New
Gerd Moellmann <gerd@gnu.org>
parents:
38414
diff
changeset
|
403 (condition-case nil |
4f3033e5b688
(x-must-resolve-font-name): New
Gerd Moellmann <gerd@gnu.org>
parents:
38414
diff
changeset
|
404 (setq ascii-font (x-resolve-font-name pattern)) |
4f3033e5b688
(x-must-resolve-font-name): New
Gerd Moellmann <gerd@gnu.org>
parents:
38414
diff
changeset
|
405 (error |
4f3033e5b688
(x-must-resolve-font-name): New
Gerd Moellmann <gerd@gnu.org>
parents:
38414
diff
changeset
|
406 (message "Warning: no fonts matching `%s' available" pattern) |
4f3033e5b688
(x-must-resolve-font-name): New
Gerd Moellmann <gerd@gnu.org>
parents:
38414
diff
changeset
|
407 (aset xlfd-fields index "*") |
4f3033e5b688
(x-must-resolve-font-name): New
Gerd Moellmann <gerd@gnu.org>
parents:
38414
diff
changeset
|
408 (setq index (1+ index)))))) |
4f3033e5b688
(x-must-resolve-font-name): New
Gerd Moellmann <gerd@gnu.org>
parents:
38414
diff
changeset
|
409 (unless ascii-font |
50581
4daf1ecf4381
(create-fontset-from-ascii-font): Doc fix.
John Paul Wallington <jpw@pobox.com>
parents:
50516
diff
changeset
|
410 (error "No fonts found")) |
40250
4f3033e5b688
(x-must-resolve-font-name): New
Gerd Moellmann <gerd@gnu.org>
parents:
38414
diff
changeset
|
411 ascii-font)) |
4f3033e5b688
(x-must-resolve-font-name): New
Gerd Moellmann <gerd@gnu.org>
parents:
38414
diff
changeset
|
412 |
4f3033e5b688
(x-must-resolve-font-name): New
Gerd Moellmann <gerd@gnu.org>
parents:
38414
diff
changeset
|
413 |
17052 | 414 (defun x-complement-fontset-spec (xlfd-fields fontlist) |
28215
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
415 "Complement FONTLIST for charsets based on XLFD-FIELDS and return it. |
17052 | 416 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
|
417 FONTLIST is an alist of charsets vs the corresponding font names. |
17052 | 418 |
28215
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
419 The fonts are complemented as below. |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
420 |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
421 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
|
422 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
|
423 FONTLIST. |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
424 |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
425 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
|
426 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
|
427 (let* ((slot (assq 'ascii fontlist)) |
36368
dbd54e46ee03
(x-complement-fontset-spec): In the
Kenichi Handa <handa@m17n.org>
parents:
34917
diff
changeset
|
428 (ascii-font (cdr slot)) |
dbd54e46ee03
(x-complement-fontset-spec): In the
Kenichi Handa <handa@m17n.org>
parents:
34917
diff
changeset
|
429 ascii-font-spec) |
34917
989f2f0c8a7e
(x-complement-fontset-spec): Resolve
Kenichi Handa <handa@m17n.org>
parents:
34245
diff
changeset
|
430 (if ascii-font |
989f2f0c8a7e
(x-complement-fontset-spec): Resolve
Kenichi Handa <handa@m17n.org>
parents:
34245
diff
changeset
|
431 (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
|
432 ;; 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
|
433 (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
|
434 (aset xlfd-fields xlfd-regexp-encoding-subnum "1") |
40250
4f3033e5b688
(x-must-resolve-font-name): New
Gerd Moellmann <gerd@gnu.org>
parents:
38414
diff
changeset
|
435 (setq ascii-font (x-must-resolve-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
|
436 (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
|
437 |
28215
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
438 ;; 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
|
439 ;; 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
|
440 (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
|
441 (if (not xlfd-fields) |
dbd54e46ee03
(x-complement-fontset-spec): In the
Kenichi Handa <handa@m17n.org>
parents:
34917
diff
changeset
|
442 (setq ascii-font-spec ascii-font) |
dbd54e46ee03
(x-complement-fontset-spec): In the
Kenichi Handa <handa@m17n.org>
parents:
34917
diff
changeset
|
443 (setq ascii-font-spec |
dbd54e46ee03
(x-complement-fontset-spec): In the
Kenichi Handa <handa@m17n.org>
parents:
34917
diff
changeset
|
444 (cons (format "%s-%s" |
dbd54e46ee03
(x-complement-fontset-spec): In the
Kenichi Handa <handa@m17n.org>
parents:
34917
diff
changeset
|
445 (aref xlfd-fields xlfd-regexp-foundry-subnum) |
dbd54e46ee03
(x-complement-fontset-spec): In the
Kenichi Handa <handa@m17n.org>
parents:
34917
diff
changeset
|
446 (aref xlfd-fields xlfd-regexp-family-subnum)) |
dbd54e46ee03
(x-complement-fontset-spec): In the
Kenichi Handa <handa@m17n.org>
parents:
34917
diff
changeset
|
447 (format "%s-%s" |
dbd54e46ee03
(x-complement-fontset-spec): In the
Kenichi Handa <handa@m17n.org>
parents:
34917
diff
changeset
|
448 (aref xlfd-fields xlfd-regexp-registry-subnum) |
dbd54e46ee03
(x-complement-fontset-spec): In the
Kenichi Handa <handa@m17n.org>
parents:
34917
diff
changeset
|
449 (aref xlfd-fields xlfd-regexp-encoding-subnum))))) |
28215
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
450 (let ((tail x-font-name-charset-alist) |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
451 elt) |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
452 (while tail |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
453 (setq elt (car tail) tail (cdr tail)) |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
454 (if (string-match (car elt) ascii-font) |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
455 (let ((charsets (cdr elt)) |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
456 charset) |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
457 (while charsets |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
458 (setq charset (car charsets) charsets (cdr charsets)) |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
459 (or (assq charset fontlist) |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
460 (setq fontlist |
36368
dbd54e46ee03
(x-complement-fontset-spec): In the
Kenichi Handa <handa@m17n.org>
parents:
34917
diff
changeset
|
461 (cons (cons charset ascii-font-spec) fontlist)))))))) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49287
diff
changeset
|
462 |
28215
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
463 fontlist)) |
17052 | 464 |
19049
cad4c032fa26
(fontset-name-p): New function.
Kenichi Handa <handa@m17n.org>
parents:
18719
diff
changeset
|
465 (defun fontset-name-p (fontset) |
cad4c032fa26
(fontset-name-p): New function.
Kenichi Handa <handa@m17n.org>
parents:
18719
diff
changeset
|
466 "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
|
467 A valid fontset name should conform to XLFD (X Logical Font Description) |
74330
5401c4ed263b
(create-fontset-from-ascii-font, create-fontset-from-fontset-spec,
Juanma Barranquero <lekktu@gmail.com>
parents:
74190
diff
changeset
|
468 with \"fontset\" in `<CHARSET_REGISTRY>' field." |
19049
cad4c032fa26
(fontset-name-p): New function.
Kenichi Handa <handa@m17n.org>
parents:
18719
diff
changeset
|
469 (and (string-match xlfd-tight-regexp fontset) |
cad4c032fa26
(fontset-name-p): New function.
Kenichi Handa <handa@m17n.org>
parents:
18719
diff
changeset
|
470 (string= (match-string (1+ xlfd-regexp-registry-subnum) fontset) |
cad4c032fa26
(fontset-name-p): New function.
Kenichi Handa <handa@m17n.org>
parents:
18719
diff
changeset
|
471 "fontset"))) |
cad4c032fa26
(fontset-name-p): New function.
Kenichi Handa <handa@m17n.org>
parents:
18719
diff
changeset
|
472 |
17052 | 473 ;; Return a list to be appended to `x-fixed-font-alist' when |
474 ;; `mouse-set-font' is called. | |
475 (defun generate-fontset-menu () | |
28215
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
476 (let ((fontsets (fontset-list)) |
17052 | 477 fontset-name |
478 l) | |
479 (while fontsets | |
28215
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
480 (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
|
481 (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
|
482 (cons "Fontset" |
ab814ec4995e
(generate-fontset-menu): Return a
Kenichi Handa <handa@m17n.org>
parents:
24153
diff
changeset
|
483 (sort l (function (lambda (x y) (string< (car x) (car y)))))))) |
17052 | 484 |
485 (defun fontset-plain-name (fontset) | |
486 "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
|
487 (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
|
488 (error "Invalid fontset: %s" fontset)) |
17052 | 489 (let ((xlfd-fields (x-decompose-font-name fontset))) |
490 (if xlfd-fields | |
491 (let ((weight (aref xlfd-fields xlfd-regexp-weight-subnum)) | |
492 (slant (aref xlfd-fields xlfd-regexp-slant-subnum)) | |
493 (swidth (aref xlfd-fields xlfd-regexp-swidth-subnum)) | |
494 (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
|
495 (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
|
496 (nickname (aref xlfd-fields xlfd-regexp-encoding-subnum)) |
17052 | 497 name) |
17755
4c82e87c7d7c
(x-decompose-font-name): While seting each field of
Kenichi Handa <handa@m17n.org>
parents:
17339
diff
changeset
|
498 (if (not (string= "fontset" charset)) |
17052 | 499 fontset |
62402
a7e02ef1e3d6
Replace `string-to-int' by `string-to-number'.
Juanma Barranquero <lekktu@gmail.com>
parents:
62274
diff
changeset
|
500 (if (> (string-to-number size) 0) |
17755
4c82e87c7d7c
(x-decompose-font-name): While seting each field of
Kenichi Handa <handa@m17n.org>
parents:
17339
diff
changeset
|
501 (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
|
502 (setq name nickname)) |
4c82e87c7d7c
(x-decompose-font-name): While seting each field of
Kenichi Handa <handa@m17n.org>
parents:
17339
diff
changeset
|
503 (cond ((string-match "^medium$" weight) |
4c82e87c7d7c
(x-decompose-font-name): While seting each field of
Kenichi Handa <handa@m17n.org>
parents:
17339
diff
changeset
|
504 (setq name (concat name " " "medium"))) |
4c82e87c7d7c
(x-decompose-font-name): While seting each field of
Kenichi Handa <handa@m17n.org>
parents:
17339
diff
changeset
|
505 ((string-match "^bold$\\|^demibold$" weight) |
4c82e87c7d7c
(x-decompose-font-name): While seting each field of
Kenichi Handa <handa@m17n.org>
parents:
17339
diff
changeset
|
506 (setq name (concat name " " weight)))) |
4c82e87c7d7c
(x-decompose-font-name): While seting each field of
Kenichi Handa <handa@m17n.org>
parents:
17339
diff
changeset
|
507 (cond ((string-match "^i$" slant) |
4c82e87c7d7c
(x-decompose-font-name): While seting each field of
Kenichi Handa <handa@m17n.org>
parents:
17339
diff
changeset
|
508 (setq name (concat name " " "italic"))) |
4c82e87c7d7c
(x-decompose-font-name): While seting each field of
Kenichi Handa <handa@m17n.org>
parents:
17339
diff
changeset
|
509 ((string-match "^o$" slant) |
4c82e87c7d7c
(x-decompose-font-name): While seting each field of
Kenichi Handa <handa@m17n.org>
parents:
17339
diff
changeset
|
510 (setq name (concat name " " "slant"))) |
4c82e87c7d7c
(x-decompose-font-name): While seting each field of
Kenichi Handa <handa@m17n.org>
parents:
17339
diff
changeset
|
511 ((string-match "^ri$" slant) |
4c82e87c7d7c
(x-decompose-font-name): While seting each field of
Kenichi Handa <handa@m17n.org>
parents:
17339
diff
changeset
|
512 (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
|
513 ((string-match "^ro$" slant) |
4c82e87c7d7c
(x-decompose-font-name): While seting each field of
Kenichi Handa <handa@m17n.org>
parents:
17339
diff
changeset
|
514 (setq name (concat name " " "reverse slant")))) |
17052 | 515 name)) |
516 fontset))) | |
517 | |
49287
5cb7e7103296
Don't setup the default fontset and
Kenichi Handa <handa@m17n.org>
parents:
47711
diff
changeset
|
518 |
22161
7a4c3fd89dda
(x-font-name-charset-alist): New
Kenichi Handa <handa@m17n.org>
parents:
22128
diff
changeset
|
519 (defun create-fontset-from-fontset-spec (fontset-spec |
22449
c87830c691a5
(instantiate-fontset): Delete
Kenichi Handa <handa@m17n.org>
parents:
22161
diff
changeset
|
520 &optional style-variant noerror) |
17052 | 521 "Create a fontset from fontset specification string FONTSET-SPEC. |
522 FONTSET-SPEC is a string of the format: | |
74190
c1d05e32a15a
(create-fontset-from-fontset-spec): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
71457
diff
changeset
|
523 FONTSET-NAME,CHARSET0:FONT0,CHARSET1:FONT1, ... |
17755
4c82e87c7d7c
(x-decompose-font-name): While seting each field of
Kenichi Handa <handa@m17n.org>
parents:
17339
diff
changeset
|
524 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
|
525 |
74190
c1d05e32a15a
(create-fontset-from-fontset-spec): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
71457
diff
changeset
|
526 Optional 2nd arg exists just for backward compatibility, and is ignored. |
22449
c87830c691a5
(instantiate-fontset): Delete
Kenichi Handa <handa@m17n.org>
parents:
22161
diff
changeset
|
527 |
74330
5401c4ed263b
(create-fontset-from-ascii-font, create-fontset-from-fontset-spec,
Juanma Barranquero <lekktu@gmail.com>
parents:
74190
diff
changeset
|
528 If this function attempts to create already existing fontset, an error is |
22672
9cfa1a788a5a
(create-fontset-from-fontset-spec):
Kenichi Handa <handa@m17n.org>
parents:
22618
diff
changeset
|
529 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
|
530 |
9cfa1a788a5a
(create-fontset-from-fontset-spec):
Kenichi Handa <handa@m17n.org>
parents:
22618
diff
changeset
|
531 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
|
532 (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
|
533 (error "Invalid fontset spec: %s" fontset-spec)) |
28215
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
534 (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
|
535 (let ((idx (match-end 0)) |
4c82e87c7d7c
(x-decompose-font-name): While seting each field of
Kenichi Handa <handa@m17n.org>
parents:
17339
diff
changeset
|
536 (name (match-string 0 fontset-spec)) |
28215
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
537 xlfd-fields charset fontlist ascii-font) |
22161
7a4c3fd89dda
(x-font-name-charset-alist): New
Kenichi Handa <handa@m17n.org>
parents:
22128
diff
changeset
|
538 (if (query-fontset name) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49287
diff
changeset
|
539 (or noerror |
23655
8aa7d51024b2
(create-fontset-from-fontset-spec): Give correct arg to `error'.
Kenichi Handa <handa@m17n.org>
parents:
23205
diff
changeset
|
540 (error "Fontset \"%s\" already exists" name)) |
28215
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
541 (setq xlfd-fields (x-decompose-font-name name)) |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
542 (or xlfd-fields |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
543 (error "Fontset \"%s\" not conforming to XLFD" name)) |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
544 |
22161
7a4c3fd89dda
(x-font-name-charset-alist): New
Kenichi Handa <handa@m17n.org>
parents:
22128
diff
changeset
|
545 ;; At first, extract pairs of charset and fontname from FONTSET-SPEC. |
69294
5e2f7c7f5f4b
(create-fontset-from-fontset-spec): Fix
Kenichi Handa <handa@m17n.org>
parents:
66059
diff
changeset
|
546 (while (string-match "[, \t\n]*\\([^:]+\\):[ \t]*\\([^,]+\\)" |
5e2f7c7f5f4b
(create-fontset-from-fontset-spec): Fix
Kenichi Handa <handa@m17n.org>
parents:
66059
diff
changeset
|
547 fontset-spec idx) |
22161
7a4c3fd89dda
(x-font-name-charset-alist): New
Kenichi Handa <handa@m17n.org>
parents:
22128
diff
changeset
|
548 (setq idx (match-end 0)) |
7a4c3fd89dda
(x-font-name-charset-alist): New
Kenichi Handa <handa@m17n.org>
parents:
22128
diff
changeset
|
549 (setq charset (intern (match-string 1 fontset-spec))) |
7a4c3fd89dda
(x-font-name-charset-alist): New
Kenichi Handa <handa@m17n.org>
parents:
22128
diff
changeset
|
550 (if (charsetp charset) |
7a4c3fd89dda
(x-font-name-charset-alist): New
Kenichi Handa <handa@m17n.org>
parents:
22128
diff
changeset
|
551 (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
|
552 fontlist)))) |
34917
989f2f0c8a7e
(x-complement-fontset-spec): Resolve
Kenichi Handa <handa@m17n.org>
parents:
34245
diff
changeset
|
553 (setq ascii-font (cdr (assq 'ascii fontlist))) |
22449
c87830c691a5
(instantiate-fontset): Delete
Kenichi Handa <handa@m17n.org>
parents:
22161
diff
changeset
|
554 |
28215
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
555 ;; Complement FONTLIST. |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
556 (setq fontlist (x-complement-fontset-spec xlfd-fields fontlist)) |
22449
c87830c691a5
(instantiate-fontset): Delete
Kenichi Handa <handa@m17n.org>
parents:
22161
diff
changeset
|
557 |
28215
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
558 (new-fontset name fontlist) |
22161
7a4c3fd89dda
(x-font-name-charset-alist): New
Kenichi Handa <handa@m17n.org>
parents:
22128
diff
changeset
|
559 |
28215
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
560 ;; Define the short name alias. |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
561 (if (and (string-match "fontset-.*$" name) |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
562 (not (assoc name fontset-alias-alist))) |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
563 (let ((alias (match-string 0 name))) |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
564 (or (rassoc alias fontset-alias-alist) |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
565 (setq fontset-alias-alist |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
566 (cons (cons name alias) fontset-alias-alist))))) |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
567 |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
568 ;; Define the ASCII font name alias. |
34917
989f2f0c8a7e
(x-complement-fontset-spec): Resolve
Kenichi Handa <handa@m17n.org>
parents:
34245
diff
changeset
|
569 (or ascii-font |
989f2f0c8a7e
(x-complement-fontset-spec): Resolve
Kenichi Handa <handa@m17n.org>
parents:
34245
diff
changeset
|
570 (setq ascii-font (cdr (assq 'ascii fontlist)))) |
28215
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
571 (or (rassoc ascii-font fontset-alias-alist) |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
572 (setq fontset-alias-alist |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
573 (cons (cons name ascii-font) |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
574 fontset-alias-alist)))) |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
575 |
22672
9cfa1a788a5a
(create-fontset-from-fontset-spec):
Kenichi Handa <handa@m17n.org>
parents:
22618
diff
changeset
|
576 name)) |
9cfa1a788a5a
(create-fontset-from-fontset-spec):
Kenichi Handa <handa@m17n.org>
parents:
22618
diff
changeset
|
577 |
9cfa1a788a5a
(create-fontset-from-fontset-spec):
Kenichi Handa <handa@m17n.org>
parents:
22618
diff
changeset
|
578 (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
|
579 fontset-name) |
9cfa1a788a5a
(create-fontset-from-fontset-spec):
Kenichi Handa <handa@m17n.org>
parents:
22618
diff
changeset
|
580 "Create a fontset from an ASCII font FONT. |
9cfa1a788a5a
(create-fontset-from-fontset-spec):
Kenichi Handa <handa@m17n.org>
parents:
22618
diff
changeset
|
581 |
74330
5401c4ed263b
(create-fontset-from-ascii-font, create-fontset-from-fontset-spec,
Juanma Barranquero <lekktu@gmail.com>
parents:
74190
diff
changeset
|
582 Optional 2nd arg RESOLVED-FONT is a resolved name of FONT. |
5401c4ed263b
(create-fontset-from-ascii-font, create-fontset-from-fontset-spec,
Juanma Barranquero <lekktu@gmail.com>
parents:
74190
diff
changeset
|
583 If omitted, `x-resolve-font-name' is called to get the resolved name. |
5401c4ed263b
(create-fontset-from-ascii-font, create-fontset-from-fontset-spec,
Juanma Barranquero <lekktu@gmail.com>
parents:
74190
diff
changeset
|
584 At this time, if FONT is not available, an error is signaled. |
22672
9cfa1a788a5a
(create-fontset-from-fontset-spec):
Kenichi Handa <handa@m17n.org>
parents:
22618
diff
changeset
|
585 |
74330
5401c4ed263b
(create-fontset-from-ascii-font, create-fontset-from-fontset-spec,
Juanma Barranquero <lekktu@gmail.com>
parents:
74190
diff
changeset
|
586 Optional 3rd arg FONTSET-NAME is a string to be used in |
22672
9cfa1a788a5a
(create-fontset-from-fontset-spec):
Kenichi Handa <handa@m17n.org>
parents:
22618
diff
changeset
|
587 `<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
|
588 an appropriate name is generated automatically. |
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 It returns a name of the created fontset." |
28215
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
591 (setq font (downcase font)) |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
592 (if resolved-font |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
593 (setq resolved-font (downcase resolved-font)) |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
594 (setq resolved-font (downcase (x-resolve-font-name font)))) |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
595 (let ((xlfd (x-decompose-font-name font)) |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
596 (resolved-xlfd (x-decompose-font-name resolved-font)) |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
597 fontset fontset-spec) |
22672
9cfa1a788a5a
(create-fontset-from-fontset-spec):
Kenichi Handa <handa@m17n.org>
parents:
22618
diff
changeset
|
598 (aset xlfd xlfd-regexp-foundry-subnum nil) |
9cfa1a788a5a
(create-fontset-from-fontset-spec):
Kenichi Handa <handa@m17n.org>
parents:
22618
diff
changeset
|
599 (aset xlfd xlfd-regexp-family-subnum nil) |
9cfa1a788a5a
(create-fontset-from-fontset-spec):
Kenichi Handa <handa@m17n.org>
parents:
22618
diff
changeset
|
600 (aset xlfd xlfd-regexp-registry-subnum "fontset") |
28215
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
601 (if fontset-name |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
602 (setq fontset-name (downcase fontset-name)) |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
603 (setq fontset-name |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
604 (format "%s_%s_%s" |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
605 (aref resolved-xlfd xlfd-regexp-registry-subnum) |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
606 (aref resolved-xlfd xlfd-regexp-encoding-subnum) |
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
607 (aref resolved-xlfd xlfd-regexp-pixelsize-subnum)))) |
22672
9cfa1a788a5a
(create-fontset-from-fontset-spec):
Kenichi Handa <handa@m17n.org>
parents:
22618
diff
changeset
|
608 (aset xlfd xlfd-regexp-encoding-subnum fontset-name) |
9cfa1a788a5a
(create-fontset-from-fontset-spec):
Kenichi Handa <handa@m17n.org>
parents:
22618
diff
changeset
|
609 (setq fontset (x-compose-font-name xlfd)) |
9cfa1a788a5a
(create-fontset-from-fontset-spec):
Kenichi Handa <handa@m17n.org>
parents:
22618
diff
changeset
|
610 (or (query-fontset fontset) |
28215
ceaded4c2cb9
(x-charset-registries): Variable
Kenichi Handa <handa@m17n.org>
parents:
27534
diff
changeset
|
611 (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
|
612 |
17052 | 613 |
17842
cb1af8ead3df
(standard-fontset-spec): Name changed from
Kenichi Handa <handa@m17n.org>
parents:
17755
diff
changeset
|
614 ;; 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
|
615 ;; 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
|
616 ;; 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
|
617 ;; many cases. |
17842
cb1af8ead3df
(standard-fontset-spec): Name changed from
Kenichi Handa <handa@m17n.org>
parents:
17755
diff
changeset
|
618 (defvar standard-fontset-spec |
27534
eeb998860456
(standard-fontset-spec): Purecopy it.
Dave Love <fx@gnu.org>
parents:
26886
diff
changeset
|
619 (purecopy "-*-fixed-medium-r-normal-*-16-*-*-*-*-*-fontset-standard, |
17052 | 620 chinese-gb2312:-*-medium-r-normal-*-16-*-gb2312*-*, |
621 korean-ksc5601:-*-medium-r-normal-*-16-*-ksc5601*-*, | |
622 chinese-cns11643-1:-*-medium-r-normal-*-16-*-cns11643*-1, | |
623 chinese-cns11643-2:-*-medium-r-normal-*-16-*-cns11643*-2, | |
624 chinese-cns11643-3:-*-medium-r-normal-*-16-*-cns11643*-3, | |
625 chinese-cns11643-4:-*-medium-r-normal-*-16-*-cns11643*-4, | |
626 chinese-cns11643-5:-*-medium-r-normal-*-16-*-cns11643*-5, | |
627 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
|
628 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
|
629 "String of fontset spec of the standard fontset. |
cb1af8ead3df
(standard-fontset-spec): Name changed from
Kenichi Handa <handa@m17n.org>
parents:
17755
diff
changeset
|
630 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
|
631 with correct glyphs by using the standard fontset. |
17052 | 632 See the documentation of `create-fontset-from-fontset-spec' for the format.") |
633 | |
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 | |
52401 | 650 ;;; arch-tag: bb53e629-0234-403c-950e-551e61554849 |
17052 | 651 ;;; fontset.el ends here |