annotate lisp/international/fontset.el @ 88785:3387266b74c1

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