Mercurial > emacs
annotate src/fontset.c @ 32807:7d91ceb03536
Update author's email address.
author | Eli Zaretskii <eliz@gnu.org> |
---|---|
date | Tue, 24 Oct 2000 09:15:44 +0000 |
parents | 131348208699 |
children | ca33eb68d9da |
rev | line source |
---|---|
17052 | 1 /* Fontset handler. |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
2 Copyright (C) 1995, 1997, 2000 Electrotechnical Laboratory, JAPAN. |
18341
33e78cc7f058
Change copyright notices.
Richard M. Stallman <rms@gnu.org>
parents:
18192
diff
changeset
|
3 Licensed to the Free Software Foundation. |
17052 | 4 |
17071 | 5 This file is part of GNU Emacs. |
6 | |
7 GNU Emacs is free software; you can redistribute it and/or modify | |
8 it under the terms of the GNU General Public License as published by | |
9 the Free Software Foundation; either version 2, or (at your option) | |
10 any later version. | |
17052 | 11 |
17071 | 12 GNU Emacs is distributed in the hope that it will be useful, |
13 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 GNU General Public License for more details. | |
17052 | 16 |
17071 | 17 You should have received a copy of the GNU General Public License |
18 along with GNU Emacs; see the file COPYING. If not, write to | |
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
20 Boston, MA 02111-1307, USA. */ | |
17052 | 21 |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
22 /* #define FONTSET_DEBUG */ |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
23 |
17052 | 24 #include <config.h> |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
25 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
26 #ifdef FONTSET_DEBUG |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
27 #include <stdio.h> |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
28 #endif |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
29 |
17052 | 30 #include "lisp.h" |
28963 | 31 #include "buffer.h" |
17052 | 32 #include "charset.h" |
33 #include "ccl.h" | |
31102
6a0caa788013
Include keyboard.h before frame.h.
Andrew Innes <andrewi@gnu.org>
parents:
30941
diff
changeset
|
34 #include "keyboard.h" |
23517
73f09e7bc96e
Include frame.h before fontset.h.
Kenichi Handa <handa@m17n.org>
parents:
22719
diff
changeset
|
35 #include "frame.h" |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
36 #include "dispextern.h" |
17052 | 37 #include "fontset.h" |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
38 #include "window.h" |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
39 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
40 #ifdef FONTSET_DEBUG |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
41 #undef xassert |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
42 #define xassert(X) do {if (!(X)) abort ();} while (0) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
43 #undef INLINE |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
44 #define INLINE |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
45 #endif |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
46 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
47 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
48 /* FONTSET |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
49 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
50 A fontset is a collection of font related information to give |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
51 similar appearance (style, size, etc) of characters. There are two |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
52 kinds of fontsets; base and realized. A base fontset is created by |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
53 new-fontset from Emacs Lisp explicitly. A realized fontset is |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
54 created implicitly when a face is realized for ASCII characters. A |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
55 face is also realized for multibyte characters based on an ASCII |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
56 face. All of the multibyte faces based on the same ASCII face |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
57 share the same realized fontset. |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
58 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
59 A fontset object is implemented by a char-table. |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
60 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
61 An element of a base fontset is: |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
62 (INDEX . FONTNAME) or |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
63 (INDEX . (FOUNDRY . REGISTRY )) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
64 FONTNAME is a font name pattern for the corresponding character. |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
65 FOUNDRY and REGISTRY are respectively foundy and regisry fields of |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
66 a font name for the corresponding character. INDEX specifies for |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
67 which character (or generic character) the element is defined. It |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
68 may be different from an index to access this element. For |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
69 instance, if a fontset defines some font for all characters of |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
70 charset `japanese-jisx0208', INDEX is the generic character of this |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
71 charset. REGISTRY is the |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
72 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
73 An element of a realized fontset is FACE-ID which is a face to use |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
74 for displaying the correspnding character. |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
75 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
76 All single byte charaters (ASCII and 8bit-unibyte) share the same |
29767
c8e5453dc85d
(FONTSET_ASCII): Use the first element of char table
Kenichi Handa <handa@m17n.org>
parents:
29501
diff
changeset
|
77 element in a fontset. The element is stored in the first element |
c8e5453dc85d
(FONTSET_ASCII): Use the first element of char table
Kenichi Handa <handa@m17n.org>
parents:
29501
diff
changeset
|
78 of the fontset. |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
79 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
80 To access or set each element, use macros FONTSET_REF and |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
81 FONTSET_SET respectively for efficiency. |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
82 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
83 A fontset has 3 extra slots. |
17052 | 84 |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
85 The 1st slot is an ID number of the fontset. |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
86 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
87 The 2nd slot is a name of the fontset. This is nil for a realized |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
88 face. |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
89 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
90 The 3rd slot is a frame that the fontset belongs to. This is nil |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
91 for a default face. |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
92 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
93 A parent of a base fontset is nil. A parent of a realized fontset |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
94 is a base fontset. |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
95 |
30398
dde5ab185aad
(fontset_ref): Remove INLINE declaration.
Kenichi Handa <handa@m17n.org>
parents:
30172
diff
changeset
|
96 All fontsets are recorded in Vfontset_table. |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
97 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
98 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
99 DEFAULT FONTSET |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
100 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
101 There's a special fontset named `default fontset' which defines a |
30398
dde5ab185aad
(fontset_ref): Remove INLINE declaration.
Kenichi Handa <handa@m17n.org>
parents:
30172
diff
changeset
|
102 default fontname pattern. When a base fontset doesn't specify a |
dde5ab185aad
(fontset_ref): Remove INLINE declaration.
Kenichi Handa <handa@m17n.org>
parents:
30172
diff
changeset
|
103 font for a specific character, the corresponding value in the |
dde5ab185aad
(fontset_ref): Remove INLINE declaration.
Kenichi Handa <handa@m17n.org>
parents:
30172
diff
changeset
|
104 default fontset is used. The format is the same as a base fontset. |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
105 |
30398
dde5ab185aad
(fontset_ref): Remove INLINE declaration.
Kenichi Handa <handa@m17n.org>
parents:
30172
diff
changeset
|
106 The parent of a realized fontset created for such a face that has |
dde5ab185aad
(fontset_ref): Remove INLINE declaration.
Kenichi Handa <handa@m17n.org>
parents:
30172
diff
changeset
|
107 no fontset is the default fontset. |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
108 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
109 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
110 These structures are hidden from the other codes than this file. |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
111 The other codes handle fontsets only by their ID numbers. They |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
112 usually use variable name `fontset' for IDs. But, in this file, we |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
113 always use varialbe name `id' for IDs, and name `fontset' for the |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
114 actual fontset objects. |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
115 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
116 */ |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
117 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
118 /********** VARIABLES and FUNCTION PROTOTYPES **********/ |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
119 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
120 extern Lisp_Object Qfont; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
121 Lisp_Object Qfontset; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
122 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
123 /* Vector containing all fontsets. */ |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
124 static Lisp_Object Vfontset_table; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
125 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
126 /* Next possibly free fontset ID. Usually this keeps the mininum |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
127 fontset ID not yet used. */ |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
128 static int next_fontset_id; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
129 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
130 /* The default fontset. This gives default FAMILY and REGISTRY of |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
131 font for each characters. */ |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
132 static Lisp_Object Vdefault_fontset; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
133 |
17052 | 134 Lisp_Object Vfont_encoding_alist; |
17112
5c48ff325655
(syms_of_fontset): Intern Qfontset. Declare new lisp
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
135 Lisp_Object Vuse_default_ascent; |
19282
09a1536debb4
(Vignore_relative_composition): New variable.
Kenichi Handa <handa@m17n.org>
parents:
19172
diff
changeset
|
136 Lisp_Object Vignore_relative_composition; |
19450
895dc2520755
(Valternate_fontname_alist): Name changed from
Kenichi Handa <handa@m17n.org>
parents:
19282
diff
changeset
|
137 Lisp_Object Valternate_fontname_alist; |
17730
4bbcc6804b5d
(Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
17331
diff
changeset
|
138 Lisp_Object Vfontset_alias_alist; |
17331
f91b4d582897
(Vhighlight_wrong_size_font, Vclip_large_size_font):
Kenichi Handa <handa@m17n.org>
parents:
17193
diff
changeset
|
139 Lisp_Object Vhighlight_wrong_size_font; |
f91b4d582897
(Vhighlight_wrong_size_font, Vclip_large_size_font):
Kenichi Handa <handa@m17n.org>
parents:
17193
diff
changeset
|
140 Lisp_Object Vclip_large_size_font; |
26858
7cc081b4e084
(Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents:
26164
diff
changeset
|
141 Lisp_Object Vvertical_centering_font_regexp; |
17052 | 142 |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
143 /* The following six are declarations of callback functions depending |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
144 on window system. See the comments in src/fontset.h for more |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
145 detail. */ |
17052 | 146 |
147 /* Return a pointer to struct font_info of font FONT_IDX of frame F. */ | |
20315
931b4ddf7966
Protoize functions declarations.
Andreas Schwab <schwab@suse.de>
parents:
19450
diff
changeset
|
148 struct font_info *(*get_font_info_func) P_ ((FRAME_PTR f, int font_idx)); |
17052 | 149 |
150 /* Return a list of font names which matches PATTERN. See the document of | |
151 `x-list-fonts' for more detail. */ | |
23517
73f09e7bc96e
Include frame.h before fontset.h.
Kenichi Handa <handa@m17n.org>
parents:
22719
diff
changeset
|
152 Lisp_Object (*list_fonts_func) P_ ((struct frame *f, |
73f09e7bc96e
Include frame.h before fontset.h.
Kenichi Handa <handa@m17n.org>
parents:
22719
diff
changeset
|
153 Lisp_Object pattern, |
73f09e7bc96e
Include frame.h before fontset.h.
Kenichi Handa <handa@m17n.org>
parents:
22719
diff
changeset
|
154 int size, |
73f09e7bc96e
Include frame.h before fontset.h.
Kenichi Handa <handa@m17n.org>
parents:
22719
diff
changeset
|
155 int maxnames)); |
17052 | 156 |
157 /* Load a font named NAME for frame F and return a pointer to the | |
158 information of the loaded font. If loading is failed, return 0. */ | |
20315
931b4ddf7966
Protoize functions declarations.
Andreas Schwab <schwab@suse.de>
parents:
19450
diff
changeset
|
159 struct font_info *(*load_font_func) P_ ((FRAME_PTR f, char *name, int)); |
17052 | 160 |
161 /* Return a pointer to struct font_info of a font named NAME for frame F. */ | |
20315
931b4ddf7966
Protoize functions declarations.
Andreas Schwab <schwab@suse.de>
parents:
19450
diff
changeset
|
162 struct font_info *(*query_font_func) P_ ((FRAME_PTR f, char *name)); |
17052 | 163 |
164 /* Additional function for setting fontset or changing fontset | |
165 contents of frame F. */ | |
20315
931b4ddf7966
Protoize functions declarations.
Andreas Schwab <schwab@suse.de>
parents:
19450
diff
changeset
|
166 void (*set_frame_fontset_func) P_ ((FRAME_PTR f, Lisp_Object arg, |
931b4ddf7966
Protoize functions declarations.
Andreas Schwab <schwab@suse.de>
parents:
19450
diff
changeset
|
167 Lisp_Object oldval)); |
17052 | 168 |
21553
2d7afcd11b72
(find_ccl_program_func): New variable.
Kenichi Handa <handa@m17n.org>
parents:
21514
diff
changeset
|
169 /* To find a CCL program, fs_load_font calls this function. |
2d7afcd11b72
(find_ccl_program_func): New variable.
Kenichi Handa <handa@m17n.org>
parents:
21514
diff
changeset
|
170 The argument is a pointer to the struct font_info. |
2d7afcd11b72
(find_ccl_program_func): New variable.
Kenichi Handa <handa@m17n.org>
parents:
21514
diff
changeset
|
171 This function set the memer `encoder' of the structure. */ |
2d7afcd11b72
(find_ccl_program_func): New variable.
Kenichi Handa <handa@m17n.org>
parents:
21514
diff
changeset
|
172 void (*find_ccl_program_func) P_ ((struct font_info *)); |
2d7afcd11b72
(find_ccl_program_func): New variable.
Kenichi Handa <handa@m17n.org>
parents:
21514
diff
changeset
|
173 |
17052 | 174 /* Check if any window system is used now. */ |
20315
931b4ddf7966
Protoize functions declarations.
Andreas Schwab <schwab@suse.de>
parents:
19450
diff
changeset
|
175 void (*check_window_system_func) P_ ((void)); |
17052 | 176 |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
177 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
178 /* Prototype declarations for static functions. */ |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
179 static Lisp_Object fontset_ref P_ ((Lisp_Object, int)); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
180 static void fontset_set P_ ((Lisp_Object, int, Lisp_Object)); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
181 static Lisp_Object make_fontset P_ ((Lisp_Object, Lisp_Object, Lisp_Object)); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
182 static int fontset_id_valid_p P_ ((int)); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
183 static Lisp_Object fontset_pattern_regexp P_ ((Lisp_Object)); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
184 static Lisp_Object font_family_registry P_ ((Lisp_Object)); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
185 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
186 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
187 /********** MACROS AND FUNCTIONS TO HANDLE FONTSET **********/ |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
188 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
189 /* Return the fontset with ID. No check of ID's validness. */ |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
190 #define FONTSET_FROM_ID(id) AREF (Vfontset_table, id) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
191 |
30398
dde5ab185aad
(fontset_ref): Remove INLINE declaration.
Kenichi Handa <handa@m17n.org>
parents:
30172
diff
changeset
|
192 /* Macros to access special values of FONTSET. */ |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
193 #define FONTSET_ID(fontset) XCHAR_TABLE (fontset)->extras[0] |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
194 #define FONTSET_NAME(fontset) XCHAR_TABLE (fontset)->extras[1] |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
195 #define FONTSET_FRAME(fontset) XCHAR_TABLE (fontset)->extras[2] |
29767
c8e5453dc85d
(FONTSET_ASCII): Use the first element of char table
Kenichi Handa <handa@m17n.org>
parents:
29501
diff
changeset
|
196 #define FONTSET_ASCII(fontset) XCHAR_TABLE (fontset)->contents[0] |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
197 #define FONTSET_BASE(fontset) XCHAR_TABLE (fontset)->parent |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
198 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
199 #define BASE_FONTSET_P(fontset) NILP (FONTSET_BASE(fontset)) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
200 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
201 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
202 /* Return the element of FONTSET (char-table) at index C (character). */ |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
203 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
204 #define FONTSET_REF(fontset, c) fontset_ref (fontset, c) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
205 |
30398
dde5ab185aad
(fontset_ref): Remove INLINE declaration.
Kenichi Handa <handa@m17n.org>
parents:
30172
diff
changeset
|
206 static Lisp_Object |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
207 fontset_ref (fontset, c) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
208 Lisp_Object fontset; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
209 int c; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
210 { |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
211 int charset, c1, c2; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
212 Lisp_Object elt, defalt; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
213 int i; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
214 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
215 if (SINGLE_BYTE_CHAR_P (c)) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
216 return FONTSET_ASCII (fontset); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
217 |
29011
b60861d6c1e0
(fontset_ref): Use SPLIT_CHAR instead of
Kenichi Handa <handa@m17n.org>
parents:
28971
diff
changeset
|
218 SPLIT_CHAR (c, charset, c1, c2); |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
219 elt = XCHAR_TABLE (fontset)->contents[charset + 128]; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
220 if (!SUB_CHAR_TABLE_P (elt)) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
221 return elt; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
222 defalt = XCHAR_TABLE (elt)->defalt; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
223 if (c1 < 32 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
224 || (elt = XCHAR_TABLE (elt)->contents[c1], |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
225 NILP (elt))) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
226 return defalt; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
227 if (!SUB_CHAR_TABLE_P (elt)) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
228 return elt; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
229 defalt = XCHAR_TABLE (elt)->defalt; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
230 if (c2 < 32 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
231 || (elt = XCHAR_TABLE (elt)->contents[c2], |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
232 NILP (elt))) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
233 return defalt; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
234 return elt; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
235 } |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
236 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
237 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
238 #define FONTSET_REF_VIA_BASE(fontset, c) fontset_ref_via_base (fontset, &c) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
239 |
30398
dde5ab185aad
(fontset_ref): Remove INLINE declaration.
Kenichi Handa <handa@m17n.org>
parents:
30172
diff
changeset
|
240 static Lisp_Object |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
241 fontset_ref_via_base (fontset, c) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
242 Lisp_Object fontset; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
243 int *c; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
244 { |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
245 int charset, c1, c2; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
246 Lisp_Object elt; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
247 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
248 if (SINGLE_BYTE_CHAR_P (*c)) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
249 return FONTSET_ASCII (fontset); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
250 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
251 elt = FONTSET_REF (FONTSET_BASE (fontset), *c); |
29767
c8e5453dc85d
(FONTSET_ASCII): Use the first element of char table
Kenichi Handa <handa@m17n.org>
parents:
29501
diff
changeset
|
252 if (NILP (elt) && ! EQ (fontset, Vdefault_fontset)) |
c8e5453dc85d
(FONTSET_ASCII): Use the first element of char table
Kenichi Handa <handa@m17n.org>
parents:
29501
diff
changeset
|
253 elt = FONTSET_REF (Vdefault_fontset, *c); |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
254 if (NILP (elt)) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
255 return Qnil; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
256 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
257 *c = XINT (XCAR (elt)); |
29011
b60861d6c1e0
(fontset_ref): Use SPLIT_CHAR instead of
Kenichi Handa <handa@m17n.org>
parents:
28971
diff
changeset
|
258 SPLIT_CHAR (*c, charset, c1, c2); |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
259 elt = XCHAR_TABLE (fontset)->contents[charset + 128]; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
260 if (c1 < 32) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
261 return (SUB_CHAR_TABLE_P (elt) ? XCHAR_TABLE (elt)->defalt : elt); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
262 if (!SUB_CHAR_TABLE_P (elt)) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
263 return Qnil; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
264 elt = XCHAR_TABLE (elt)->contents[c1]; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
265 if (c2 < 32) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
266 return (SUB_CHAR_TABLE_P (elt) ? XCHAR_TABLE (elt)->defalt : elt); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
267 if (!SUB_CHAR_TABLE_P (elt)) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
268 return Qnil; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
269 elt = XCHAR_TABLE (elt)->contents[c2]; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
270 return elt; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
271 } |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
272 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
273 |
30398
dde5ab185aad
(fontset_ref): Remove INLINE declaration.
Kenichi Handa <handa@m17n.org>
parents:
30172
diff
changeset
|
274 /* Store into the element of FONTSET at index C the value NEWELT. */ |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
275 #define FONTSET_SET(fontset, c, newelt) fontset_set(fontset, c, newelt) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
276 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
277 static void |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
278 fontset_set (fontset, c, newelt) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
279 Lisp_Object fontset; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
280 int c; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
281 Lisp_Object newelt; |
17052 | 282 { |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
283 int charset, code[3]; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
284 Lisp_Object *elt, tmp; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
285 int i, j; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
286 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
287 if (SINGLE_BYTE_CHAR_P (c)) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
288 { |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
289 FONTSET_ASCII (fontset) = newelt; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
290 return; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
291 } |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
292 |
29011
b60861d6c1e0
(fontset_ref): Use SPLIT_CHAR instead of
Kenichi Handa <handa@m17n.org>
parents:
28971
diff
changeset
|
293 SPLIT_CHAR (c, charset, code[0], code[1]); |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
294 code[2] = 0; /* anchor */ |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
295 elt = &XCHAR_TABLE (fontset)->contents[charset + 128]; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
296 for (i = 0; code[i] > 0; i++) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
297 { |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
298 if (!SUB_CHAR_TABLE_P (*elt)) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
299 *elt = make_sub_char_table (*elt); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
300 elt = &XCHAR_TABLE (*elt)->contents[code[i]]; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
301 } |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
302 if (SUB_CHAR_TABLE_P (*elt)) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
303 XCHAR_TABLE (*elt)->defalt = newelt; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
304 else |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
305 *elt = newelt; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
306 } |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
307 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
308 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
309 /* Return a newly created fontset with NAME. If BASE is nil, make a |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
310 base fontset. Otherwise make a realized fontset whose parent is |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
311 BASE. */ |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
312 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
313 static Lisp_Object |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
314 make_fontset (frame, name, base) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
315 Lisp_Object frame, name, base; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
316 { |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
317 Lisp_Object fontset, elt, base_elt; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
318 int size = ASIZE (Vfontset_table); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
319 int id = next_fontset_id; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
320 int i, j; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
321 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
322 /* Find a free slot in Vfontset_table. Usually, next_fontset_id is |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
323 the next available fontset ID. So it is expected that this loop |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
324 terminates quickly. In addition, as the last element of |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
325 Vfotnset_table is always nil, we don't have to check the range of |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
326 id. */ |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
327 while (!NILP (AREF (Vfontset_table, id))) id++; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
328 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
329 if (id + 1 == size) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
330 { |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
331 Lisp_Object tem; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
332 int i; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
333 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
334 tem = Fmake_vector (make_number (size + 8), Qnil); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
335 for (i = 0; i < size; i++) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
336 AREF (tem, i) = AREF (Vfontset_table, i); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
337 Vfontset_table = tem; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
338 } |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
339 |
29767
c8e5453dc85d
(FONTSET_ASCII): Use the first element of char table
Kenichi Handa <handa@m17n.org>
parents:
29501
diff
changeset
|
340 fontset = Fmake_char_table (Qfontset, Qnil); |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
341 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
342 FONTSET_ID (fontset) = make_number (id); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
343 FONTSET_NAME (fontset) = name; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
344 FONTSET_FRAME (fontset) = frame; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
345 FONTSET_BASE (fontset) = base; |
17052 | 346 |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
347 AREF (Vfontset_table, id) = fontset; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
348 next_fontset_id = id + 1; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
349 return fontset; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
350 } |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
351 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
352 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
353 /* Return 1 if ID is a valid fontset id, else return 0. */ |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
354 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
355 static INLINE int |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
356 fontset_id_valid_p (id) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
357 int id; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
358 { |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
359 return (id >= 0 && id < ASIZE (Vfontset_table) - 1); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
360 } |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
361 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
362 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
363 /* Extract `family' and `registry' string from FONTNAME and set in |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
364 *FAMILY and *REGISTRY respectively. Actually, `family' may also |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
365 contain `foundry', `registry' may also contain `encoding' of |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
366 FONTNAME. */ |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
367 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
368 static Lisp_Object |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
369 font_family_registry (fontname) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
370 Lisp_Object fontname; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
371 { |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
372 Lisp_Object family, registry; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
373 char *p = XSTRING (fontname)->data; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
374 char *sep[15]; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
375 int i = 0; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
376 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
377 while (*p && i < 15) if (*p++ == '-') sep[i++] = p; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
378 if (i != 14) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
379 return fontname; |
17052 | 380 |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
381 family = make_unibyte_string (sep[0], sep[2] - 1 - sep[0]); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
382 registry = make_unibyte_string (sep[12], p - sep[12]); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
383 return Fcons (family, registry); |
17052 | 384 } |
385 | |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
386 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
387 /********** INTERFACES TO xfaces.c and dispextern.h **********/ |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
388 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
389 /* Return name of the fontset with ID. */ |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
390 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
391 Lisp_Object |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
392 fontset_name (id) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
393 int id; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
394 { |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
395 Lisp_Object fontset; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
396 fontset = FONTSET_FROM_ID (id); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
397 return FONTSET_NAME (fontset); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
398 } |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
399 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
400 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
401 /* Return ASCII font name of the fontset with ID. */ |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
402 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
403 Lisp_Object |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
404 fontset_ascii (id) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
405 int id; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
406 { |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
407 Lisp_Object fontset, elt; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
408 fontset= FONTSET_FROM_ID (id); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
409 elt = FONTSET_ASCII (fontset); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
410 return XCDR (elt); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
411 } |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
412 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
413 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
414 /* Free fontset of FACE. Called from free_realized_face. */ |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
415 |
17052 | 416 void |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
417 free_face_fontset (f, face) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
418 FRAME_PTR f; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
419 struct face *face; |
17052 | 420 { |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
421 if (fontset_id_valid_p (face->fontset)) |
17052 | 422 { |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
423 AREF (Vfontset_table, face->fontset) = Qnil; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
424 if (face->fontset < next_fontset_id) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
425 next_fontset_id = face->fontset; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
426 } |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
427 } |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
428 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
429 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
430 /* Return 1 iff FACE is suitable for displaying character C. |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
431 Otherwise return 0. Called from the macro FACE_SUITABLE_FOR_CHAR_P |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
432 when C is not a single byte character.. */ |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
433 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
434 int |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
435 face_suitable_for_char_p (face, c) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
436 struct face *face; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
437 int c; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
438 { |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
439 Lisp_Object fontset, elt; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
440 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
441 if (SINGLE_BYTE_CHAR_P (c)) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
442 return (face == face->ascii_face); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
443 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
444 xassert (fontset_id_valid_p (face->fontset)); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
445 fontset = FONTSET_FROM_ID (face->fontset); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
446 xassert (!BASE_FONTSET_P (fontset)); |
17052 | 447 |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
448 elt = FONTSET_REF_VIA_BASE (fontset, c); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
449 return (!NILP (elt) && face->id == XFASTINT (elt)); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
450 } |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
451 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
452 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
453 /* Return ID of face suitable for displaying character C on frame F. |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
454 The selection of face is done based on the fontset of FACE. FACE |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
455 should already have been realized for ASCII characters. Called |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
456 from the macro FACE_FOR_CHAR when C is not a single byte character. */ |
17052 | 457 |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
458 int |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
459 face_for_char (f, face, c) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
460 FRAME_PTR f; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
461 struct face *face; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
462 int c; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
463 { |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
464 Lisp_Object fontset, elt; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
465 int face_id; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
466 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
467 xassert (fontset_id_valid_p (face->fontset)); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
468 fontset = FONTSET_FROM_ID (face->fontset); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
469 xassert (!BASE_FONTSET_P (fontset)); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
470 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
471 elt = FONTSET_REF_VIA_BASE (fontset, c); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
472 if (!NILP (elt)) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
473 return XINT (elt); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
474 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
475 /* No face is recorded for C in the fontset of FACE. Make a new |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
476 realized face for C that has the same fontset. */ |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
477 face_id = lookup_face (f, face->lface, c, face); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
478 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
479 /* Record the face ID in FONTSET at the same index as the |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
480 information in the base fontset. */ |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
481 FONTSET_SET (fontset, c, make_number (face_id)); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
482 return face_id; |
17052 | 483 } |
484 | |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
485 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
486 /* Make a realized fontset for ASCII face FACE on frame F from the |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
487 base fontset BASE_FONTSET_ID. If BASE_FONTSET_ID is -1, use the |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
488 default fontset as the base. Value is the id of the new fontset. |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
489 Called from realize_x_face. */ |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
490 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
491 int |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
492 make_fontset_for_ascii_face (f, base_fontset_id) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
493 FRAME_PTR f; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
494 int base_fontset_id; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
495 { |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
496 Lisp_Object base_fontset, fontset, name, frame; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
497 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
498 XSETFRAME (frame, f); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
499 if (base_fontset_id >= 0) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
500 { |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
501 base_fontset = FONTSET_FROM_ID (base_fontset_id); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
502 if (!BASE_FONTSET_P (base_fontset)) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
503 base_fontset = FONTSET_BASE (base_fontset); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
504 xassert (BASE_FONTSET_P (base_fontset)); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
505 } |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
506 else |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
507 base_fontset = Vdefault_fontset; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
508 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
509 fontset = make_fontset (frame, Qnil, base_fontset); |
28511
7a9707590ccd
(make_fontset_for_ascii_face): Use XINT on return value.
Ken Raeburn <raeburn@raeburn.org>
parents:
28241
diff
changeset
|
510 return XINT (FONTSET_ID (fontset)); |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
511 } |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
512 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
513 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
514 /* Return the font name pattern for C that is recorded in the fontset |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
515 with ID. A font is opened by that pattern to get the fullname. If |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
516 the fullname conform to XLFD, extract foundry-family field and |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
517 registry-encoding field, and return the cons of them. Otherwise |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
518 return the fullname. If ID is -1, or the fontset doesn't contain |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
519 information about C, get the registry and encoding of C from the |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
520 default fontset. Called from choose_face_font. */ |
18346
c46e9f750033
(font_idx_temp): New temprary variable used in FS_LOAD_FONT.
Kenichi Handa <handa@m17n.org>
parents:
18341
diff
changeset
|
521 |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
522 Lisp_Object |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
523 fontset_font_pattern (f, id, c) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
524 FRAME_PTR f; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
525 int id, c; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
526 { |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
527 Lisp_Object fontset, elt; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
528 struct font_info *fontp; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
529 Lisp_Object family_registry; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
530 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
531 elt = Qnil; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
532 if (fontset_id_valid_p (id)) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
533 { |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
534 fontset = FONTSET_FROM_ID (id); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
535 xassert (!BASE_FONTSET_P (fontset)); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
536 fontset = FONTSET_BASE (fontset); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
537 elt = FONTSET_REF (fontset, c); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
538 } |
29767
c8e5453dc85d
(FONTSET_ASCII): Use the first element of char table
Kenichi Handa <handa@m17n.org>
parents:
29501
diff
changeset
|
539 if (NILP (elt)) |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
540 elt = FONTSET_REF (Vdefault_fontset, c); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
541 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
542 if (!CONSP (elt)) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
543 return Qnil; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
544 if (CONSP (XCDR (elt))) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
545 return XCDR (elt); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
546 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
547 /* The fontset specifies only a font name pattern (not cons of |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
548 family and registry). Try to open a font by that pattern and get |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
549 a registry from the full name of the opened font. We ignore |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
550 family name here because it should be wild card in the fontset |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
551 specification. */ |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
552 elt = XCDR (elt); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
553 xassert (STRINGP (elt)); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
554 fontp = FS_LOAD_FONT (f, c, XSTRING (elt)->data, -1); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
555 if (!fontp) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
556 return Qnil; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
557 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
558 family_registry = font_family_registry (build_string (fontp->full_name)); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
559 if (!CONSP (family_registry)) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
560 return family_registry; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
561 XCAR (family_registry) = Qnil; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
562 return family_registry; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
563 } |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
564 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
565 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
566 /* Load a font named FONTNAME to display character C on frame F. |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
567 Return a pointer to the struct font_info of the loaded font. If |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
568 loading fails, return NULL. If FACE is non-zero and a fontset is |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
569 assigned to it, record FACE->id in the fontset for C. If FONTNAME |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
570 is NULL, the name is taken from the fontset of FACE or what |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
571 specified by ID. */ |
17052 | 572 |
573 struct font_info * | |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
574 fs_load_font (f, c, fontname, id, face) |
17052 | 575 FRAME_PTR f; |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
576 int c; |
17052 | 577 char *fontname; |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
578 int id; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
579 struct face *face; |
17052 | 580 { |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
581 Lisp_Object fontset; |
17052 | 582 Lisp_Object list, elt; |
583 int font_idx; | |
584 int size = 0; | |
585 struct font_info *fontp; | |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
586 int charset = CHAR_CHARSET (c); |
17052 | 587 |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
588 if (face) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
589 id = face->fontset; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
590 if (id < 0) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
591 fontset = Qnil; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
592 else |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
593 fontset = FONTSET_FROM_ID (id); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
594 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
595 if (!NILP (fontset) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
596 && !BASE_FONTSET_P (fontset)) |
17052 | 597 { |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
598 elt = FONTSET_REF_VIA_BASE (fontset, c); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
599 if (!NILP (elt)) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
600 { |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
601 /* A suitable face for C is already recorded, which means |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
602 that a proper font is already loaded. */ |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
603 int face_id = XINT (elt); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
604 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
605 xassert (face_id == face->id); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
606 face = FACE_FROM_ID (f, face_id); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
607 return (*get_font_info_func) (f, face->font_info_id); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
608 } |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
609 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
610 if (!fontname && charset == CHARSET_ASCII) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
611 { |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
612 elt = FONTSET_ASCII (fontset); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
613 fontname = XSTRING (XCDR (elt))->data; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
614 } |
17052 | 615 } |
616 | |
617 if (!fontname) | |
618 /* No way to get fontname. */ | |
619 return 0; | |
620 | |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
621 fontp = (*load_font_func) (f, fontname, size); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
622 if (!fontp) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
623 return 0; |
17052 | 624 |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
625 /* Fill in members (charset, vertical_centering, encoding, etc) of |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
626 font_info structure that are not set by (*load_font_func). */ |
17052 | 627 fontp->charset = charset; |
628 | |
26858
7cc081b4e084
(Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents:
26164
diff
changeset
|
629 fontp->vertical_centering |
7cc081b4e084
(Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents:
26164
diff
changeset
|
630 = (STRINGP (Vvertical_centering_font_regexp) |
7cc081b4e084
(Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents:
26164
diff
changeset
|
631 && (fast_c_string_match_ignore_case |
7cc081b4e084
(Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents:
26164
diff
changeset
|
632 (Vvertical_centering_font_regexp, fontp->full_name) >= 0)); |
7cc081b4e084
(Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents:
26164
diff
changeset
|
633 |
17999
5e325c8057c8
(fs_load_font): Before using a fontset, be sure to
Kenichi Handa <handa@m17n.org>
parents:
17882
diff
changeset
|
634 if (fontp->encoding[1] != FONT_ENCODING_NOT_DECIDED) |
17052 | 635 { |
636 /* The font itself tells which code points to be used. Use this | |
637 encoding for all other charsets. */ | |
638 int i; | |
639 | |
640 fontp->encoding[0] = fontp->encoding[1]; | |
17190
6637001cdb4b
Adjusted for the change of MAX_CHARSET.
Kenichi Handa <handa@m17n.org>
parents:
17112
diff
changeset
|
641 for (i = MIN_CHARSET_OFFICIAL_DIMENSION1; i <= MAX_CHARSET; i++) |
17052 | 642 fontp->encoding[i] = fontp->encoding[1]; |
643 } | |
644 else | |
645 { | |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
646 /* The font itself doesn't have information about encoding. */ |
17052 | 647 int i; |
648 | |
28766
da7e00e4eaa6
(fs_load_font): By default, use 0x00..0x7f for ASCII.
Kenichi Handa <handa@m17n.org>
parents:
28676
diff
changeset
|
649 fontname = fontp->full_name; |
da7e00e4eaa6
(fs_load_font): By default, use 0x00..0x7f for ASCII.
Kenichi Handa <handa@m17n.org>
parents:
28676
diff
changeset
|
650 /* By default, encoding of ASCII chars is 0 (i.e. 0x00..0x7F), |
da7e00e4eaa6
(fs_load_font): By default, use 0x00..0x7f for ASCII.
Kenichi Handa <handa@m17n.org>
parents:
28676
diff
changeset
|
651 others is 1 (i.e. 0x80..0xFF). */ |
da7e00e4eaa6
(fs_load_font): By default, use 0x00..0x7f for ASCII.
Kenichi Handa <handa@m17n.org>
parents:
28676
diff
changeset
|
652 fontp->encoding[0] = 0; |
17190
6637001cdb4b
Adjusted for the change of MAX_CHARSET.
Kenichi Handa <handa@m17n.org>
parents:
17112
diff
changeset
|
653 for (i = MIN_CHARSET_OFFICIAL_DIMENSION1; i <= MAX_CHARSET; i++) |
17052 | 654 fontp->encoding[i] = 1; |
655 /* Then override them by a specification in Vfont_encoding_alist. */ | |
26164
d39ec0a27081
more XCAR/XCDR/XFLOAT_DATA uses, to help isolete lisp engine
Ken Raeburn <raeburn@raeburn.org>
parents:
25668
diff
changeset
|
656 for (list = Vfont_encoding_alist; CONSP (list); list = XCDR (list)) |
17052 | 657 { |
26164
d39ec0a27081
more XCAR/XCDR/XFLOAT_DATA uses, to help isolete lisp engine
Ken Raeburn <raeburn@raeburn.org>
parents:
25668
diff
changeset
|
658 elt = XCAR (list); |
17052 | 659 if (CONSP (elt) |
26164
d39ec0a27081
more XCAR/XCDR/XFLOAT_DATA uses, to help isolete lisp engine
Ken Raeburn <raeburn@raeburn.org>
parents:
25668
diff
changeset
|
660 && STRINGP (XCAR (elt)) && CONSP (XCDR (elt)) |
d39ec0a27081
more XCAR/XCDR/XFLOAT_DATA uses, to help isolete lisp engine
Ken Raeburn <raeburn@raeburn.org>
parents:
25668
diff
changeset
|
661 && (fast_c_string_match_ignore_case (XCAR (elt), fontname) |
17052 | 662 >= 0)) |
663 { | |
664 Lisp_Object tmp; | |
665 | |
26164
d39ec0a27081
more XCAR/XCDR/XFLOAT_DATA uses, to help isolete lisp engine
Ken Raeburn <raeburn@raeburn.org>
parents:
25668
diff
changeset
|
666 for (tmp = XCDR (elt); CONSP (tmp); tmp = XCDR (tmp)) |
d39ec0a27081
more XCAR/XCDR/XFLOAT_DATA uses, to help isolete lisp engine
Ken Raeburn <raeburn@raeburn.org>
parents:
25668
diff
changeset
|
667 if (CONSP (XCAR (tmp)) |
d39ec0a27081
more XCAR/XCDR/XFLOAT_DATA uses, to help isolete lisp engine
Ken Raeburn <raeburn@raeburn.org>
parents:
25668
diff
changeset
|
668 && ((i = get_charset_id (XCAR (XCAR (tmp)))) |
17052 | 669 >= 0) |
26164
d39ec0a27081
more XCAR/XCDR/XFLOAT_DATA uses, to help isolete lisp engine
Ken Raeburn <raeburn@raeburn.org>
parents:
25668
diff
changeset
|
670 && INTEGERP (XCDR (XCAR (tmp))) |
d39ec0a27081
more XCAR/XCDR/XFLOAT_DATA uses, to help isolete lisp engine
Ken Raeburn <raeburn@raeburn.org>
parents:
25668
diff
changeset
|
671 && XFASTINT (XCDR (XCAR (tmp))) < 4) |
17052 | 672 fontp->encoding[i] |
26164
d39ec0a27081
more XCAR/XCDR/XFLOAT_DATA uses, to help isolete lisp engine
Ken Raeburn <raeburn@raeburn.org>
parents:
25668
diff
changeset
|
673 = XFASTINT (XCDR (XCAR (tmp))); |
17052 | 674 } |
675 } | |
676 } | |
677 | |
678 fontp->font_encoder = (struct ccl_program *) 0; | |
21553
2d7afcd11b72
(find_ccl_program_func): New variable.
Kenichi Handa <handa@m17n.org>
parents:
21514
diff
changeset
|
679 |
2d7afcd11b72
(find_ccl_program_func): New variable.
Kenichi Handa <handa@m17n.org>
parents:
21514
diff
changeset
|
680 if (find_ccl_program_func) |
2d7afcd11b72
(find_ccl_program_func): New variable.
Kenichi Handa <handa@m17n.org>
parents:
21514
diff
changeset
|
681 (*find_ccl_program_func) (fontp); |
17052 | 682 |
28963 | 683 /* If we loaded a font for a face that has fontset, record the face |
684 ID in the fontset for C. */ | |
685 if (face | |
686 && !NILP (fontset) | |
687 && !BASE_FONTSET_P (fontset)) | |
688 FONTSET_SET (fontset, c, make_number (face->id)); | |
17052 | 689 return fontp; |
690 } | |
691 | |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
692 |
17052 | 693 /* Cache data used by fontset_pattern_regexp. The car part is a |
694 pattern string containing at least one wild card, the cdr part is | |
695 the corresponding regular expression. */ | |
696 static Lisp_Object Vcached_fontset_data; | |
697 | |
26164
d39ec0a27081
more XCAR/XCDR/XFLOAT_DATA uses, to help isolete lisp engine
Ken Raeburn <raeburn@raeburn.org>
parents:
25668
diff
changeset
|
698 #define CACHED_FONTSET_NAME (XSTRING (XCAR (Vcached_fontset_data))->data) |
d39ec0a27081
more XCAR/XCDR/XFLOAT_DATA uses, to help isolete lisp engine
Ken Raeburn <raeburn@raeburn.org>
parents:
25668
diff
changeset
|
699 #define CACHED_FONTSET_REGEX (XCDR (Vcached_fontset_data)) |
17052 | 700 |
701 /* If fontset name PATTERN contains any wild card, return regular | |
702 expression corresponding to PATTERN. */ | |
703 | |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
704 static Lisp_Object |
17052 | 705 fontset_pattern_regexp (pattern) |
706 Lisp_Object pattern; | |
707 { | |
708 if (!index (XSTRING (pattern)->data, '*') | |
709 && !index (XSTRING (pattern)->data, '?')) | |
710 /* PATTERN does not contain any wild cards. */ | |
17730
4bbcc6804b5d
(Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
17331
diff
changeset
|
711 return Qnil; |
17052 | 712 |
713 if (!CONSP (Vcached_fontset_data) | |
714 || strcmp (XSTRING (pattern)->data, CACHED_FONTSET_NAME)) | |
715 { | |
716 /* We must at first update the cached data. */ | |
17730
4bbcc6804b5d
(Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
17331
diff
changeset
|
717 char *regex = (char *) alloca (XSTRING (pattern)->size * 2); |
17052 | 718 char *p0, *p1 = regex; |
719 | |
17730
4bbcc6804b5d
(Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
17331
diff
changeset
|
720 /* Convert "*" to ".*", "?" to ".". */ |
4bbcc6804b5d
(Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
17331
diff
changeset
|
721 *p1++ = '^'; |
17827
95010205f916
(fontset_pattern_regexp): Cast to (char *) before
Kenichi Handa <handa@m17n.org>
parents:
17730
diff
changeset
|
722 for (p0 = (char *) XSTRING (pattern)->data; *p0; p0++) |
17052 | 723 { |
17730
4bbcc6804b5d
(Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
17331
diff
changeset
|
724 if (*p0 == '*') |
17052 | 725 { |
17730
4bbcc6804b5d
(Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
17331
diff
changeset
|
726 *p1++ = '.'; |
4bbcc6804b5d
(Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
17331
diff
changeset
|
727 *p1++ = '*'; |
17052 | 728 } |
17730
4bbcc6804b5d
(Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
17331
diff
changeset
|
729 else if (*p0 == '?') |
21127
577865651099
(fontset_pattern_regexp): `==' was used instead of `='.
Richard M. Stallman <rms@gnu.org>
parents:
20346
diff
changeset
|
730 *p1++ = '.'; |
17730
4bbcc6804b5d
(Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
17331
diff
changeset
|
731 else |
4bbcc6804b5d
(Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
17331
diff
changeset
|
732 *p1++ = *p0; |
17052 | 733 } |
734 *p1++ = '$'; | |
735 *p1++ = 0; | |
736 | |
737 Vcached_fontset_data = Fcons (build_string (XSTRING (pattern)->data), | |
738 build_string (regex)); | |
739 } | |
740 | |
741 return CACHED_FONTSET_REGEX; | |
742 } | |
743 | |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
744 /* Return ID of the base fontset named NAME. If there's no such |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
745 fontset, return -1. */ |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
746 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
747 int |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
748 fs_query_fontset (name, regexpp) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
749 Lisp_Object name; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
750 int regexpp; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
751 { |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
752 Lisp_Object fontset, tem; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
753 int i; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
754 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
755 name = Fdowncase (name); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
756 if (!regexpp) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
757 { |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
758 tem = Frassoc (name, Vfontset_alias_alist); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
759 if (CONSP (tem) && STRINGP (XCAR (tem))) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
760 name = XCAR (tem); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
761 else |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
762 { |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
763 tem = fontset_pattern_regexp (name); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
764 if (STRINGP (tem)) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
765 { |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
766 name = tem; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
767 regexpp = 1; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
768 } |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
769 } |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
770 } |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
771 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
772 for (i = 0; i < ASIZE (Vfontset_table); i++) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
773 { |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
774 Lisp_Object fontset; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
775 unsigned char *this_name; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
776 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
777 fontset = FONTSET_FROM_ID (i); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
778 if (NILP (fontset) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
779 || !BASE_FONTSET_P (fontset)) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
780 continue; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
781 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
782 this_name = XSTRING (FONTSET_NAME (fontset))->data; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
783 if (regexpp |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
784 ? fast_c_string_match_ignore_case (name, this_name) >= 0 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
785 : !strcmp (XSTRING (name)->data, this_name)) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
786 return i; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
787 } |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
788 return -1; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
789 } |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
790 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
791 |
21553
2d7afcd11b72
(find_ccl_program_func): New variable.
Kenichi Handa <handa@m17n.org>
parents:
21514
diff
changeset
|
792 DEFUN ("query-fontset", Fquery_fontset, Squery_fontset, 1, 2, 0, |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
793 "Return the name of a fontset that matches PATTERN.\n\ |
24585
6810d6fb639f
(Fquery_fontset): Don't check for fontset aliases here.
Richard M. Stallman <rms@gnu.org>
parents:
23517
diff
changeset
|
794 The value is nil if there is no matching fontset.\n\ |
6810d6fb639f
(Fquery_fontset): Don't check for fontset aliases here.
Richard M. Stallman <rms@gnu.org>
parents:
23517
diff
changeset
|
795 PATTERN can contain `*' or `?' as a wildcard\n\ |
6810d6fb639f
(Fquery_fontset): Don't check for fontset aliases here.
Richard M. Stallman <rms@gnu.org>
parents:
23517
diff
changeset
|
796 just as X font name matching algorithm allows.\n\ |
6810d6fb639f
(Fquery_fontset): Don't check for fontset aliases here.
Richard M. Stallman <rms@gnu.org>
parents:
23517
diff
changeset
|
797 If REGEXPP is non-nil, PATTERN is a regular expression.") |
21553
2d7afcd11b72
(find_ccl_program_func): New variable.
Kenichi Handa <handa@m17n.org>
parents:
21514
diff
changeset
|
798 (pattern, regexpp) |
2d7afcd11b72
(find_ccl_program_func): New variable.
Kenichi Handa <handa@m17n.org>
parents:
21514
diff
changeset
|
799 Lisp_Object pattern, regexpp; |
17052 | 800 { |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
801 Lisp_Object fontset; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
802 int id; |
17052 | 803 |
804 (*check_window_system_func) (); | |
805 | |
806 CHECK_STRING (pattern, 0); | |
807 | |
808 if (XSTRING (pattern)->size == 0) | |
809 return Qnil; | |
810 | |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
811 id = fs_query_fontset (pattern, !NILP (regexpp)); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
812 if (id < 0) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
813 return Qnil; |
17052 | 814 |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
815 fontset = FONTSET_FROM_ID (id); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
816 return FONTSET_NAME (fontset); |
17052 | 817 } |
818 | |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
819 /* Return a list of base fontset names matching PATTERN on frame F. |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
820 If SIZE is not 0, it is the size (maximum bound width) of fontsets |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
821 to be listed. */ |
17052 | 822 |
823 Lisp_Object | |
824 list_fontsets (f, pattern, size) | |
825 FRAME_PTR f; | |
826 Lisp_Object pattern; | |
827 int size; | |
828 { | |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
829 Lisp_Object frame, regexp, val, tail; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
830 int id; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
831 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
832 XSETFRAME (frame, f); |
17052 | 833 |
834 regexp = fontset_pattern_regexp (pattern); | |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
835 val = Qnil; |
17052 | 836 |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
837 for (id = 0; id < ASIZE (Vfontset_table); id++) |
17052 | 838 { |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
839 Lisp_Object fontset; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
840 unsigned char *name; |
17052 | 841 |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
842 fontset = FONTSET_FROM_ID (id); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
843 if (NILP (fontset) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
844 || !BASE_FONTSET_P (fontset) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
845 || !EQ (frame, FONTSET_FRAME (fontset))) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
846 continue; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
847 name = XSTRING (FONTSET_NAME (fontset))->data; |
17052 | 848 |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
849 if (!NILP (regexp) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
850 ? (fast_c_string_match_ignore_case (regexp, name) < 0) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
851 : strcmp (XSTRING (pattern)->data, name)) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
852 continue; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
853 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
854 if (size) |
17052 | 855 { |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
856 struct font_info *fontp; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
857 fontp = FS_LOAD_FONT (f, 0, NULL, id); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
858 if (!fontp || size != fontp->size) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
859 continue; |
17052 | 860 } |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
861 val = Fcons (Fcopy_sequence (FONTSET_NAME (fontset)), val); |
17052 | 862 } |
863 | |
864 return val; | |
865 } | |
866 | |
867 DEFUN ("new-fontset", Fnew_fontset, Snew_fontset, 2, 2, 0, | |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
868 "Create a new fontset NAME that contains font information in FONTLIST.\n\ |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
869 FONTLIST is an alist of charsets vs corresponding font name patterns.") |
17052 | 870 (name, fontlist) |
871 Lisp_Object name, fontlist; | |
872 { | |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
873 Lisp_Object fontset, elements, ascii_font; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
874 Lisp_Object tem, tail, elt; |
17052 | 875 |
876 (*check_window_system_func) (); | |
877 | |
878 CHECK_STRING (name, 0); | |
879 CHECK_LIST (fontlist, 1); | |
880 | |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
881 name = Fdowncase (name); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
882 tem = Fquery_fontset (name, Qnil); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
883 if (!NILP (tem)) |
24585
6810d6fb639f
(Fquery_fontset): Don't check for fontset aliases here.
Richard M. Stallman <rms@gnu.org>
parents:
23517
diff
changeset
|
884 error ("Fontset `%s' matches the existing fontset `%s'", |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
885 XSTRING (name)->data, XSTRING (tem)->data); |
17052 | 886 |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
887 /* Check the validity of FONTLIST while creating a template for |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
888 fontset elements. */ |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
889 elements = ascii_font = Qnil; |
26164
d39ec0a27081
more XCAR/XCDR/XFLOAT_DATA uses, to help isolete lisp engine
Ken Raeburn <raeburn@raeburn.org>
parents:
25668
diff
changeset
|
890 for (tail = fontlist; CONSP (tail); tail = XCDR (tail)) |
17052 | 891 { |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
892 Lisp_Object family, registry; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
893 int c, charset; |
17052 | 894 |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
895 tem = XCAR (tail); |
17052 | 896 if (!CONSP (tem) |
26164
d39ec0a27081
more XCAR/XCDR/XFLOAT_DATA uses, to help isolete lisp engine
Ken Raeburn <raeburn@raeburn.org>
parents:
25668
diff
changeset
|
897 || (charset = get_charset_id (XCAR (tem))) < 0 |
d39ec0a27081
more XCAR/XCDR/XFLOAT_DATA uses, to help isolete lisp engine
Ken Raeburn <raeburn@raeburn.org>
parents:
25668
diff
changeset
|
898 || !STRINGP (XCDR (tem))) |
17052 | 899 error ("Elements of fontlist must be a cons of charset and font name"); |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
900 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
901 tem = Fdowncase (XCDR (tem)); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
902 if (charset == CHARSET_ASCII) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
903 ascii_font = tem; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
904 else |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
905 { |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
906 c = MAKE_CHAR (charset, 0, 0); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
907 elements = Fcons (Fcons (make_number (c), tem), elements); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
908 } |
17052 | 909 } |
910 | |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
911 if (NILP (ascii_font)) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
912 error ("No ASCII font in the fontlist"); |
17052 | 913 |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
914 fontset = make_fontset (Qnil, name, Qnil); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
915 FONTSET_ASCII (fontset) = Fcons (make_number (0), ascii_font); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
916 for (; CONSP (elements); elements = XCDR (elements)) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
917 { |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
918 elt = XCAR (elements); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
919 tem = Fcons (XCAR (elt), font_family_registry (XCDR (elt))); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
920 FONTSET_SET (fontset, XINT (XCAR (elt)), tem); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
921 } |
17052 | 922 |
923 return Qnil; | |
924 } | |
925 | |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
926 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
927 /* Clear all elements of FONTSET for multibyte characters. */ |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
928 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
929 static void |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
930 clear_fontset_elements (fontset) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
931 Lisp_Object fontset; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
932 { |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
933 int i; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
934 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
935 for (i = CHAR_TABLE_SINGLE_BYTE_SLOTS; i < CHAR_TABLE_ORDINARY_SLOTS; i++) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
936 XCHAR_TABLE (fontset)->contents[i] = Qnil; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
937 } |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
938 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
939 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
940 /* Check validity of NAME as a fontset name and return the |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
941 corresponding fontset. If not valid, signal an error. |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
942 If NAME is t, return Vdefault_fontset. */ |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
943 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
944 static Lisp_Object |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
945 check_fontset_name (name) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
946 Lisp_Object name; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
947 { |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
948 int id; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
949 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
950 if (EQ (name, Qt)) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
951 return Vdefault_fontset; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
952 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
953 CHECK_STRING (name, 0); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
954 id = fs_query_fontset (name, 0); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
955 if (id < 0) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
956 error ("Fontset `%s' does not exist", XSTRING (name)->data); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
957 return FONTSET_FROM_ID (id); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
958 } |
17052 | 959 |
960 DEFUN ("set-fontset-font", Fset_fontset_font, Sset_fontset_font, 3, 4, 0, | |
28676
0a677c35ad99
(Fset_fontset_font): Fix docstring. Local variable
Kenichi Handa <handa@m17n.org>
parents:
28511
diff
changeset
|
961 "Modify fontset NAME to use FONTNAME for CHARACTER.\n\ |
28241
df61a12bd266
(Fset_fontset_font, Ffontset_font): Fix newlines in doc string.
Dave Love <fx@gnu.org>
parents:
28223
diff
changeset
|
962 \n\ |
28676
0a677c35ad99
(Fset_fontset_font): Fix docstring. Local variable
Kenichi Handa <handa@m17n.org>
parents:
28511
diff
changeset
|
963 CHARACTER may be a cons; (FROM . TO), where FROM and TO are\n\ |
28241
df61a12bd266
(Fset_fontset_font, Ffontset_font): Fix newlines in doc string.
Dave Love <fx@gnu.org>
parents:
28223
diff
changeset
|
964 non-generic characters. In that case, use FONTNAME\n\ |
df61a12bd266
(Fset_fontset_font, Ffontset_font): Fix newlines in doc string.
Dave Love <fx@gnu.org>
parents:
28223
diff
changeset
|
965 for all characters in the range FROM and TO (inclusive).\n\ |
29501
f901ec87b147
(Fset_fontset_font): The arg CHARACTER may be a charset.
Kenichi Handa <handa@m17n.org>
parents:
29233
diff
changeset
|
966 CHARACTER may be a charset. In that case, use FONTNAME\n\ |
f901ec87b147
(Fset_fontset_font): The arg CHARACTER may be a charset.
Kenichi Handa <handa@m17n.org>
parents:
29233
diff
changeset
|
967 for all character in the charsets.\n\ |
28241
df61a12bd266
(Fset_fontset_font, Ffontset_font): Fix newlines in doc string.
Dave Love <fx@gnu.org>
parents:
28223
diff
changeset
|
968 \n\ |
29233
a09ee5c15dcb
(check_registry_encoding): This function deleted.
Kenichi Handa <handa@m17n.org>
parents:
29231
diff
changeset
|
969 FONTNAME may be a cons; (FAMILY . REGISTRY), where FAMILY is a family\n\ |
a09ee5c15dcb
(check_registry_encoding): This function deleted.
Kenichi Handa <handa@m17n.org>
parents:
29231
diff
changeset
|
970 name of a font, REGSITRY is a registry name of a font.") |
28676
0a677c35ad99
(Fset_fontset_font): Fix docstring. Local variable
Kenichi Handa <handa@m17n.org>
parents:
28511
diff
changeset
|
971 (name, character, fontname, frame) |
0a677c35ad99
(Fset_fontset_font): Fix docstring. Local variable
Kenichi Handa <handa@m17n.org>
parents:
28511
diff
changeset
|
972 Lisp_Object name, character, fontname, frame; |
17052 | 973 { |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
974 Lisp_Object fontset, elt; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
975 Lisp_Object realized; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
976 int from, to; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
977 int id; |
29233
a09ee5c15dcb
(check_registry_encoding): This function deleted.
Kenichi Handa <handa@m17n.org>
parents:
29231
diff
changeset
|
978 Lisp_Object family, registry; |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
979 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
980 fontset = check_fontset_name (name); |
17052 | 981 |
28676
0a677c35ad99
(Fset_fontset_font): Fix docstring. Local variable
Kenichi Handa <handa@m17n.org>
parents:
28511
diff
changeset
|
982 if (CONSP (character)) |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
983 { |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
984 /* CH should be (FROM . TO) where FROM and TO are non-generic |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
985 characters. */ |
28676
0a677c35ad99
(Fset_fontset_font): Fix docstring. Local variable
Kenichi Handa <handa@m17n.org>
parents:
28511
diff
changeset
|
986 CHECK_NUMBER (XCAR (character), 1); |
0a677c35ad99
(Fset_fontset_font): Fix docstring. Local variable
Kenichi Handa <handa@m17n.org>
parents:
28511
diff
changeset
|
987 CHECK_NUMBER (XCDR (character), 1); |
0a677c35ad99
(Fset_fontset_font): Fix docstring. Local variable
Kenichi Handa <handa@m17n.org>
parents:
28511
diff
changeset
|
988 from = XINT (XCAR (character)); |
0a677c35ad99
(Fset_fontset_font): Fix docstring. Local variable
Kenichi Handa <handa@m17n.org>
parents:
28511
diff
changeset
|
989 to = XINT (XCDR (character)); |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
990 if (!char_valid_p (from, 0) || !char_valid_p (to, 0)) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
991 error ("Character range should be by non-generic characters."); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
992 if (!NILP (name) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
993 && (SINGLE_BYTE_CHAR_P (from) || SINGLE_BYTE_CHAR_P (to))) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
994 error ("Can't change font for a single byte character"); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
995 } |
29501
f901ec87b147
(Fset_fontset_font): The arg CHARACTER may be a charset.
Kenichi Handa <handa@m17n.org>
parents:
29233
diff
changeset
|
996 else if (SYMBOLP (character)) |
f901ec87b147
(Fset_fontset_font): The arg CHARACTER may be a charset.
Kenichi Handa <handa@m17n.org>
parents:
29233
diff
changeset
|
997 { |
f901ec87b147
(Fset_fontset_font): The arg CHARACTER may be a charset.
Kenichi Handa <handa@m17n.org>
parents:
29233
diff
changeset
|
998 elt = Fget (character, Qcharset); |
f901ec87b147
(Fset_fontset_font): The arg CHARACTER may be a charset.
Kenichi Handa <handa@m17n.org>
parents:
29233
diff
changeset
|
999 if (!VECTORP (elt) || ASIZE (elt) < 1 || !NATNUMP (AREF (elt, 0))) |
f901ec87b147
(Fset_fontset_font): The arg CHARACTER may be a charset.
Kenichi Handa <handa@m17n.org>
parents:
29233
diff
changeset
|
1000 error ("Invalid charset: %s", (XSYMBOL (character)->name)->data); |
f901ec87b147
(Fset_fontset_font): The arg CHARACTER may be a charset.
Kenichi Handa <handa@m17n.org>
parents:
29233
diff
changeset
|
1001 from = MAKE_CHAR (XINT (AREF (elt, 0)), 0, 0); |
f901ec87b147
(Fset_fontset_font): The arg CHARACTER may be a charset.
Kenichi Handa <handa@m17n.org>
parents:
29233
diff
changeset
|
1002 to = from; |
f901ec87b147
(Fset_fontset_font): The arg CHARACTER may be a charset.
Kenichi Handa <handa@m17n.org>
parents:
29233
diff
changeset
|
1003 } |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1004 else |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1005 { |
28676
0a677c35ad99
(Fset_fontset_font): Fix docstring. Local variable
Kenichi Handa <handa@m17n.org>
parents:
28511
diff
changeset
|
1006 CHECK_NUMBER (character, 1); |
0a677c35ad99
(Fset_fontset_font): Fix docstring. Local variable
Kenichi Handa <handa@m17n.org>
parents:
28511
diff
changeset
|
1007 from = XINT (character); |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1008 to = from; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1009 } |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1010 if (!char_valid_p (from, 1)) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1011 invalid_character (from); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1012 if (SINGLE_BYTE_CHAR_P (from)) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1013 error ("Can't change font for a single byte character"); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1014 if (from < to) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1015 { |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1016 if (!char_valid_p (to, 1)) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1017 invalid_character (to); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1018 if (SINGLE_BYTE_CHAR_P (to)) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1019 error ("Can't change font for a single byte character"); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1020 } |
17052 | 1021 |
29233
a09ee5c15dcb
(check_registry_encoding): This function deleted.
Kenichi Handa <handa@m17n.org>
parents:
29231
diff
changeset
|
1022 if (STRINGP (fontname)) |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1023 { |
29233
a09ee5c15dcb
(check_registry_encoding): This function deleted.
Kenichi Handa <handa@m17n.org>
parents:
29231
diff
changeset
|
1024 fontname = Fdowncase (fontname); |
a09ee5c15dcb
(check_registry_encoding): This function deleted.
Kenichi Handa <handa@m17n.org>
parents:
29231
diff
changeset
|
1025 elt = Fcons (make_number (from), font_family_registry (fontname)); |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1026 } |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1027 else |
29233
a09ee5c15dcb
(check_registry_encoding): This function deleted.
Kenichi Handa <handa@m17n.org>
parents:
29231
diff
changeset
|
1028 { |
a09ee5c15dcb
(check_registry_encoding): This function deleted.
Kenichi Handa <handa@m17n.org>
parents:
29231
diff
changeset
|
1029 CHECK_CONS (fontname, 2); |
a09ee5c15dcb
(check_registry_encoding): This function deleted.
Kenichi Handa <handa@m17n.org>
parents:
29231
diff
changeset
|
1030 family = XCAR (fontname); |
a09ee5c15dcb
(check_registry_encoding): This function deleted.
Kenichi Handa <handa@m17n.org>
parents:
29231
diff
changeset
|
1031 registry = XCDR (fontname); |
a09ee5c15dcb
(check_registry_encoding): This function deleted.
Kenichi Handa <handa@m17n.org>
parents:
29231
diff
changeset
|
1032 if (!NILP (family)) |
30398
dde5ab185aad
(fontset_ref): Remove INLINE declaration.
Kenichi Handa <handa@m17n.org>
parents:
30172
diff
changeset
|
1033 { |
dde5ab185aad
(fontset_ref): Remove INLINE declaration.
Kenichi Handa <handa@m17n.org>
parents:
30172
diff
changeset
|
1034 CHECK_STRING (family, 2); |
dde5ab185aad
(fontset_ref): Remove INLINE declaration.
Kenichi Handa <handa@m17n.org>
parents:
30172
diff
changeset
|
1035 family = Fdowncase (family); |
dde5ab185aad
(fontset_ref): Remove INLINE declaration.
Kenichi Handa <handa@m17n.org>
parents:
30172
diff
changeset
|
1036 } |
29233
a09ee5c15dcb
(check_registry_encoding): This function deleted.
Kenichi Handa <handa@m17n.org>
parents:
29231
diff
changeset
|
1037 if (!NILP (registry)) |
30398
dde5ab185aad
(fontset_ref): Remove INLINE declaration.
Kenichi Handa <handa@m17n.org>
parents:
30172
diff
changeset
|
1038 { |
dde5ab185aad
(fontset_ref): Remove INLINE declaration.
Kenichi Handa <handa@m17n.org>
parents:
30172
diff
changeset
|
1039 CHECK_STRING (registry, 2); |
dde5ab185aad
(fontset_ref): Remove INLINE declaration.
Kenichi Handa <handa@m17n.org>
parents:
30172
diff
changeset
|
1040 registry = Fdowncase (registry); |
dde5ab185aad
(fontset_ref): Remove INLINE declaration.
Kenichi Handa <handa@m17n.org>
parents:
30172
diff
changeset
|
1041 } |
29233
a09ee5c15dcb
(check_registry_encoding): This function deleted.
Kenichi Handa <handa@m17n.org>
parents:
29231
diff
changeset
|
1042 elt = Fcons (make_number (from), Fcons (family, registry)); |
a09ee5c15dcb
(check_registry_encoding): This function deleted.
Kenichi Handa <handa@m17n.org>
parents:
29231
diff
changeset
|
1043 } |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1044 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1045 /* The arg FRAME is kept for backward compatibility. We only check |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1046 the validity. */ |
17052 | 1047 if (!NILP (frame)) |
1048 CHECK_LIVE_FRAME (frame, 3); | |
1049 | |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1050 for (; from <= to; from++) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1051 FONTSET_SET (fontset, from, elt); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1052 Foptimize_char_table (fontset); |
17052 | 1053 |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1054 /* If there's a realized fontset REALIZED whose parent is FONTSET, |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1055 clear all the elements of REALIZED and free all multibyte faces |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1056 whose fontset is REALIZED. This way, the specified character(s) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1057 are surely redisplayed by a correct font. */ |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1058 for (id = 0; id < ASIZE (Vfontset_table); id++) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1059 { |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1060 realized = AREF (Vfontset_table, id); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1061 if (!NILP (realized) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1062 && !BASE_FONTSET_P (realized) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1063 && EQ (FONTSET_BASE (realized), fontset)) |
17052 | 1064 { |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1065 FRAME_PTR f = XFRAME (FONTSET_FRAME (realized)); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1066 clear_fontset_elements (realized); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1067 free_realized_multibyte_face (f, id); |
17052 | 1068 } |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1069 } |
17052 | 1070 |
1071 return Qnil; | |
1072 } | |
1073 | |
1074 DEFUN ("font-info", Ffont_info, Sfont_info, 1, 2, 0, | |
1075 "Return information about a font named NAME on frame FRAME.\n\ | |
1076 If FRAME is omitted or nil, use the selected frame.\n\ | |
1077 The returned value is a vector of OPENED-NAME, FULL-NAME, CHARSET, SIZE,\n\ | |
17112
5c48ff325655
(syms_of_fontset): Intern Qfontset. Declare new lisp
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
1078 HEIGHT, BASELINE-OFFSET, RELATIVE-COMPOSE, and DEFAULT-ASCENT,\n\ |
17052 | 1079 where\n\ |
1080 OPENED-NAME is the name used for opening the font,\n\ | |
1081 FULL-NAME is the full name of the font,\n\ | |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1082 SIZE is the maximum bound width of the font,\n\ |
17052 | 1083 HEIGHT is the height of the font,\n\ |
1084 BASELINE-OFFSET is the upward offset pixels from ASCII baseline,\n\ | |
17112
5c48ff325655
(syms_of_fontset): Intern Qfontset. Declare new lisp
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
1085 RELATIVE-COMPOSE and DEFAULT-ASCENT are the numbers controlling\n\ |
5c48ff325655
(syms_of_fontset): Intern Qfontset. Declare new lisp
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
1086 how to compose characters.\n\ |
17052 | 1087 If the named font is not yet loaded, return nil.") |
1088 (name, frame) | |
1089 Lisp_Object name, frame; | |
1090 { | |
1091 FRAME_PTR f; | |
1092 struct font_info *fontp; | |
1093 Lisp_Object info; | |
1094 | |
1095 (*check_window_system_func) (); | |
1096 | |
1097 CHECK_STRING (name, 0); | |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1098 name = Fdowncase (name); |
17052 | 1099 if (NILP (frame)) |
25668
99290b59352d
(Ffont_info): Change for Lisp_Object selected_frame.
Gerd Moellmann <gerd@gnu.org>
parents:
24611
diff
changeset
|
1100 frame = selected_frame; |
99290b59352d
(Ffont_info): Change for Lisp_Object selected_frame.
Gerd Moellmann <gerd@gnu.org>
parents:
24611
diff
changeset
|
1101 CHECK_LIVE_FRAME (frame, 1); |
99290b59352d
(Ffont_info): Change for Lisp_Object selected_frame.
Gerd Moellmann <gerd@gnu.org>
parents:
24611
diff
changeset
|
1102 f = XFRAME (frame); |
17052 | 1103 |
1104 if (!query_font_func) | |
1105 error ("Font query function is not supported"); | |
1106 | |
1107 fontp = (*query_font_func) (f, XSTRING (name)->data); | |
1108 if (!fontp) | |
1109 return Qnil; | |
1110 | |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1111 info = Fmake_vector (make_number (7), Qnil); |
17052 | 1112 |
1113 XVECTOR (info)->contents[0] = build_string (fontp->name); | |
1114 XVECTOR (info)->contents[1] = build_string (fontp->full_name); | |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1115 XVECTOR (info)->contents[2] = make_number (fontp->size); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1116 XVECTOR (info)->contents[3] = make_number (fontp->height); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1117 XVECTOR (info)->contents[4] = make_number (fontp->baseline_offset); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1118 XVECTOR (info)->contents[5] = make_number (fontp->relative_compose); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1119 XVECTOR (info)->contents[6] = make_number (fontp->default_ascent); |
17052 | 1120 |
1121 return info; | |
1122 } | |
1123 | |
28963 | 1124 |
1125 /* Return the font name for the character at POSITION in the current | |
1126 buffer. This is computed from all the text properties and overlays | |
1127 that apply to POSITION. It returns nil in the following cases: | |
1128 | |
1129 (1) The window system doesn't have a font for the character (thus | |
1130 it is displayed by an empty box). | |
1131 | |
1132 (2) The character code is invalid. | |
1133 | |
1134 (3) The current buffer is not displayed in any window. | |
1135 | |
1136 In addition, the returned font name may not take into account of | |
1137 such redisplay engine hooks as what used in jit-lock-mode if | |
1138 POSITION is currently not visible. */ | |
1139 | |
1140 | |
1141 DEFUN ("internal-char-font", Finternal_char_font, Sinternal_char_font, 1, 1, 0, | |
1142 "For internal use only.") | |
1143 (position) | |
1144 Lisp_Object position; | |
1145 { | |
1146 int pos, pos_byte, dummy; | |
1147 int face_id; | |
1148 int c; | |
1149 Lisp_Object window; | |
1150 struct window *w; | |
1151 struct frame *f; | |
1152 struct face *face; | |
1153 | |
1154 CHECK_NUMBER_COERCE_MARKER (position, 0); | |
1155 pos = XINT (position); | |
1156 if (pos < BEGV || pos >= ZV) | |
1157 args_out_of_range_3 (position, make_number (BEGV), make_number (ZV)); | |
1158 pos_byte = CHAR_TO_BYTE (pos); | |
1159 c = FETCH_CHAR (pos_byte); | |
1160 if (! CHAR_VALID_P (c, 0)) | |
1161 return Qnil; | |
30941
ac162a21c419
(Finternal_char_font): Search only the selected frame for a window of
Kenichi Handa <handa@m17n.org>
parents:
30398
diff
changeset
|
1162 window = Fget_buffer_window (Fcurrent_buffer (), Qnil); |
28963 | 1163 if (NILP (window)) |
1164 return Qnil; | |
1165 w = XWINDOW (window); | |
1166 f = XFRAME (w->frame); | |
1167 face_id = face_at_buffer_position (w, pos, -1, -1, &dummy, pos + 100, 0); | |
1168 face_id = FACE_FOR_CHAR (f, FACE_FROM_ID (f, face_id), c); | |
1169 face = FACE_FROM_ID (f, face_id); | |
1170 return (face->font && face->font_name | |
1171 ? build_string (face->font_name) | |
1172 : Qnil); | |
1173 } | |
1174 | |
1175 | |
1176 /* Called from Ffontset_info via map_char_table on each leaf of | |
1177 fontset. ARG is a list (LAST FONT-INFO ...), where LAST is `(last | |
1178 ARG)' and FONT-INFOs have this form: | |
1179 (CHAR FONT-SPEC) or ((FROM . TO) FONT-SPEC) | |
1180 The current leaf is indexed by CHARACTER and has value ELT. This | |
1181 function add the information of the current leaf to ARG by | |
1182 appending a new element or modifying the last element.. */ | |
1183 | |
1184 static void | |
1185 accumulate_font_info (arg, character, elt) | |
1186 Lisp_Object arg, character, elt; | |
1187 { | |
1188 Lisp_Object last, last_char, last_elt, tmp; | |
1189 | |
29767
c8e5453dc85d
(FONTSET_ASCII): Use the first element of char table
Kenichi Handa <handa@m17n.org>
parents:
29501
diff
changeset
|
1190 if (!CONSP (elt) && !SINGLE_BYTE_CHAR_P (XINT (character))) |
c8e5453dc85d
(FONTSET_ASCII): Use the first element of char table
Kenichi Handa <handa@m17n.org>
parents:
29501
diff
changeset
|
1191 elt = FONTSET_REF (Vdefault_fontset, XINT (character)); |
28963 | 1192 if (!CONSP (elt)) |
1193 return; | |
1194 last = XCAR (arg); | |
1195 last_char = XCAR (XCAR (last)); | |
1196 last_elt = XCAR (XCDR (XCAR (last))); | |
1197 elt = XCDR (elt); | |
1198 if (!NILP (Fequal (elt, last_elt))) | |
1199 { | |
1200 int this_charset = CHAR_CHARSET (XINT (character)); | |
1201 | |
1202 if (CONSP (last_char)) /* LAST_CHAR == (FROM . TO) */ | |
1203 { | |
1204 if (this_charset == CHAR_CHARSET (XINT (XCAR (last_char)))) | |
1205 { | |
1206 XCDR (last_char) = character; | |
1207 return; | |
1208 } | |
1209 } | |
29767
c8e5453dc85d
(FONTSET_ASCII): Use the first element of char table
Kenichi Handa <handa@m17n.org>
parents:
29501
diff
changeset
|
1210 else if (XINT (last_char) == XINT (character)) |
c8e5453dc85d
(FONTSET_ASCII): Use the first element of char table
Kenichi Handa <handa@m17n.org>
parents:
29501
diff
changeset
|
1211 return; |
c8e5453dc85d
(FONTSET_ASCII): Use the first element of char table
Kenichi Handa <handa@m17n.org>
parents:
29501
diff
changeset
|
1212 else if (this_charset == CHAR_CHARSET (XINT (last_char))) |
28963 | 1213 { |
29767
c8e5453dc85d
(FONTSET_ASCII): Use the first element of char table
Kenichi Handa <handa@m17n.org>
parents:
29501
diff
changeset
|
1214 XCAR (XCAR (last)) = Fcons (last_char, character); |
c8e5453dc85d
(FONTSET_ASCII): Use the first element of char table
Kenichi Handa <handa@m17n.org>
parents:
29501
diff
changeset
|
1215 return; |
28963 | 1216 } |
1217 } | |
1218 XCDR (last) = Fcons (Fcons (character, Fcons (elt, Qnil)), Qnil); | |
1219 XCAR (arg) = XCDR (last); | |
1220 } | |
1221 | |
1222 | |
17052 | 1223 DEFUN ("fontset-info", Ffontset_info, Sfontset_info, 1, 2, 0, |
1224 "Return information about a fontset named NAME on frame FRAME.\n\ | |
30124
26076259e03f
(Ffontset_info): Make the return value more compatible
Kenichi Handa <handa@m17n.org>
parents:
29767
diff
changeset
|
1225 The value is a vector:\n\ |
26076259e03f
(Ffontset_info): Make the return value more compatible
Kenichi Handa <handa@m17n.org>
parents:
29767
diff
changeset
|
1226 [ SIZE HEIGHT ((CHARSET-OR-RANGE FONT-SPEC OPENED ...) ...) ],\n\ |
28963 | 1227 where,\n\ |
30124
26076259e03f
(Ffontset_info): Make the return value more compatible
Kenichi Handa <handa@m17n.org>
parents:
29767
diff
changeset
|
1228 SIZE is the maximum bound width of ASCII font in the fontset,\n\ |
26076259e03f
(Ffontset_info): Make the return value more compatible
Kenichi Handa <handa@m17n.org>
parents:
29767
diff
changeset
|
1229 HEIGHT is the maximum bound height of ASCII font in the fontset,\n\ |
28971 | 1230 CHARSET-OR-RANGE is a charset, a character (may be a generic character)\n\ |
28970
0585095ab3e1
(Ffontset_info): Fix newline in doc.
Dave Love <fx@gnu.org>
parents:
28963
diff
changeset
|
1231 or a cons of two characters specifying the range of characters.\n\ |
28963 | 1232 FONT-SPEC is a fontname pattern string or a cons (FAMILY . REGISTRY),\n\ |
1233 where FAMILY is a `FAMILY' field of a XLFD font name,\n\ | |
1234 REGISTRY is a `CHARSET_REGISTRY' field of a XLDF font name.\n\ | |
1235 FAMILY may contain a `FOUNDARY' field at the head.\n\ | |
1236 REGISTRY may contain a `CHARSET_ENCODING' field at the tail.\n\ | |
1237 OPENEDs are names of fonts actually opened.\n\ | |
30124
26076259e03f
(Ffontset_info): Make the return value more compatible
Kenichi Handa <handa@m17n.org>
parents:
29767
diff
changeset
|
1238 If the ASCII font is not yet opened, SIZE and HEIGHT are 0.\n\ |
28963 | 1239 If FRAME is omitted, it defaults to the currently selected frame.") |
17052 | 1240 (name, frame) |
1241 Lisp_Object name, frame; | |
1242 { | |
28963 | 1243 Lisp_Object fontset; |
17052 | 1244 FRAME_PTR f; |
28963 | 1245 Lisp_Object indices[3]; |
1246 Lisp_Object val, tail, elt; | |
1247 Lisp_Object *realized; | |
30124
26076259e03f
(Ffontset_info): Make the return value more compatible
Kenichi Handa <handa@m17n.org>
parents:
29767
diff
changeset
|
1248 struct font_info *fontp = NULL; |
28963 | 1249 int n_realized = 0; |
17052 | 1250 int i; |
1251 | |
1252 (*check_window_system_func) (); | |
1253 | |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1254 fontset = check_fontset_name (name); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1255 |
17052 | 1256 if (NILP (frame)) |
25668
99290b59352d
(Ffont_info): Change for Lisp_Object selected_frame.
Gerd Moellmann <gerd@gnu.org>
parents:
24611
diff
changeset
|
1257 frame = selected_frame; |
99290b59352d
(Ffont_info): Change for Lisp_Object selected_frame.
Gerd Moellmann <gerd@gnu.org>
parents:
24611
diff
changeset
|
1258 CHECK_LIVE_FRAME (frame, 1); |
99290b59352d
(Ffont_info): Change for Lisp_Object selected_frame.
Gerd Moellmann <gerd@gnu.org>
parents:
24611
diff
changeset
|
1259 f = XFRAME (frame); |
17052 | 1260 |
29767
c8e5453dc85d
(FONTSET_ASCII): Use the first element of char table
Kenichi Handa <handa@m17n.org>
parents:
29501
diff
changeset
|
1261 /* Recode realized fontsets whose base is FONTSET in the table |
28963 | 1262 `realized'. */ |
1263 realized = (Lisp_Object *) alloca (sizeof (Lisp_Object) | |
1264 * ASIZE (Vfontset_table)); | |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1265 for (i = 0; i < ASIZE (Vfontset_table); i++) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1266 { |
28963 | 1267 elt = FONTSET_FROM_ID (i); |
1268 if (!NILP (elt) | |
1269 && EQ (FONTSET_BASE (elt), fontset)) | |
1270 realized[n_realized++] = elt; | |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1271 } |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1272 |
28963 | 1273 /* Accumulate information of the fontset in VAL. The format is |
1274 (LAST FONT-INFO FONT-INFO ...), where FONT-INFO is (CHAR-OR-RANGE | |
1275 FONT-SPEC). See the comment for accumulate_font_info for the | |
1276 detail. */ | |
1277 val = Fcons (Fcons (make_number (0), | |
1278 Fcons (XCDR (FONTSET_ASCII (fontset)), Qnil)), | |
1279 Qnil); | |
1280 val = Fcons (val, val); | |
1281 map_char_table (accumulate_font_info, Qnil, fontset, val, 0, indices); | |
1282 val = XCDR (val); | |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1283 |
28963 | 1284 /* For each FONT-INFO, if CHAR_OR_RANGE (car part) is a generic |
29767
c8e5453dc85d
(FONTSET_ASCII): Use the first element of char table
Kenichi Handa <handa@m17n.org>
parents:
29501
diff
changeset
|
1285 character for a charset, replace it with the charset symbol. If |
28963 | 1286 fonts are opened for FONT-SPEC, append the names of the fonts to |
1287 FONT-SPEC. */ | |
1288 for (tail = val; CONSP (tail); tail = XCDR (tail)) | |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1289 { |
28963 | 1290 int c; |
1291 elt = XCAR (tail); | |
1292 if (INTEGERP (XCAR (elt))) | |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1293 { |
28963 | 1294 int charset, c1, c2; |
1295 c = XINT (XCAR (elt)); | |
1296 SPLIT_CHAR (c, charset, c1, c2); | |
1297 if (c1 == 0) | |
1298 XCAR (elt) = CHARSET_SYMBOL (charset); | |
1299 } | |
1300 else | |
1301 c = XINT (XCAR (XCAR (elt))); | |
1302 for (i = 0; i < n_realized; i++) | |
1303 { | |
1304 Lisp_Object face_id, font; | |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1305 struct face *face; |
17052 | 1306 |
28963 | 1307 face_id = FONTSET_REF_VIA_BASE (realized[i], c); |
1308 if (INTEGERP (face_id)) | |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1309 { |
28963 | 1310 face = FACE_FROM_ID (f, XINT (face_id)); |
1311 if (face->font && face->font_name) | |
1312 { | |
1313 font = build_string (face->font_name); | |
1314 if (NILP (Fmember (font, XCDR (XCDR (elt))))) | |
1315 XCDR (XCDR (elt)) = Fcons (font, XCDR (XCDR (elt))); | |
1316 } | |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1317 } |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1318 } |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1319 } |
30124
26076259e03f
(Ffontset_info): Make the return value more compatible
Kenichi Handa <handa@m17n.org>
parents:
29767
diff
changeset
|
1320 |
26076259e03f
(Ffontset_info): Make the return value more compatible
Kenichi Handa <handa@m17n.org>
parents:
29767
diff
changeset
|
1321 elt = Fcdr (Fcdr (Fassq (CHARSET_SYMBOL (CHARSET_ASCII), val))); |
26076259e03f
(Ffontset_info): Make the return value more compatible
Kenichi Handa <handa@m17n.org>
parents:
29767
diff
changeset
|
1322 if (CONSP (elt)) |
26076259e03f
(Ffontset_info): Make the return value more compatible
Kenichi Handa <handa@m17n.org>
parents:
29767
diff
changeset
|
1323 { |
26076259e03f
(Ffontset_info): Make the return value more compatible
Kenichi Handa <handa@m17n.org>
parents:
29767
diff
changeset
|
1324 elt = XCAR (elt); |
26076259e03f
(Ffontset_info): Make the return value more compatible
Kenichi Handa <handa@m17n.org>
parents:
29767
diff
changeset
|
1325 fontp = (*query_font_func) (f, XSTRING (elt)->data); |
26076259e03f
(Ffontset_info): Make the return value more compatible
Kenichi Handa <handa@m17n.org>
parents:
29767
diff
changeset
|
1326 } |
26076259e03f
(Ffontset_info): Make the return value more compatible
Kenichi Handa <handa@m17n.org>
parents:
29767
diff
changeset
|
1327 val = Fmake_vector (make_number (3), val); |
26076259e03f
(Ffontset_info): Make the return value more compatible
Kenichi Handa <handa@m17n.org>
parents:
29767
diff
changeset
|
1328 AREF (val, 0) = fontp ? make_number (fontp->size) : make_number (0); |
26076259e03f
(Ffontset_info): Make the return value more compatible
Kenichi Handa <handa@m17n.org>
parents:
29767
diff
changeset
|
1329 AREF (val, 1) = fontp ? make_number (fontp->height) : make_number (0); |
26076259e03f
(Ffontset_info): Make the return value more compatible
Kenichi Handa <handa@m17n.org>
parents:
29767
diff
changeset
|
1330 return val; |
17052 | 1331 } |
1332 | |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1333 DEFUN ("fontset-font", Ffontset_font, Sfontset_font, 2, 2, 0, |
28241
df61a12bd266
(Fset_fontset_font, Ffontset_font): Fix newlines in doc string.
Dave Love <fx@gnu.org>
parents:
28223
diff
changeset
|
1334 "Return a font name pattern for character CH in fontset NAME.\n\ |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1335 If NAME is t, find a font name pattern in the default fontset.") |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1336 (name, ch) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1337 Lisp_Object name, ch; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1338 { |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1339 int c, id; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1340 Lisp_Object fontset, elt; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1341 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1342 fontset = check_fontset_name (name); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1343 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1344 CHECK_NUMBER (ch, 1); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1345 c = XINT (ch); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1346 if (!char_valid_p (c, 1)) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1347 invalid_character (c); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1348 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1349 elt = FONTSET_REF (fontset, c); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1350 if (CONSP (elt)) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1351 elt = XCDR (elt); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1352 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1353 return elt; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1354 } |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1355 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1356 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1357 DEFUN ("fontset-list", Ffontset_list, Sfontset_list, 0, 0, 0, |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1358 "Return a list of all defined fontset names.") |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1359 () |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1360 { |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1361 Lisp_Object fontset, list; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1362 int i; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1363 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1364 list = Qnil; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1365 for (i = 0; i < ASIZE (Vfontset_table); i++) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1366 { |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1367 fontset = FONTSET_FROM_ID (i); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1368 if (!NILP (fontset) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1369 && BASE_FONTSET_P (fontset)) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1370 list = Fcons (FONTSET_NAME (fontset), list); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1371 } |
28963 | 1372 |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1373 return list; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1374 } |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1375 |
21514 | 1376 void |
17052 | 1377 syms_of_fontset () |
1378 { | |
1379 int i; | |
1380 | |
1381 if (!load_font_func) | |
1382 /* Window system initializer should have set proper functions. */ | |
1383 abort (); | |
1384 | |
17112
5c48ff325655
(syms_of_fontset): Intern Qfontset. Declare new lisp
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
1385 Qfontset = intern ("fontset"); |
17052 | 1386 staticpro (&Qfontset); |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1387 Fput (Qfontset, Qchar_table_extra_slots, make_number (3)); |
17052 | 1388 |
1389 Vcached_fontset_data = Qnil; | |
1390 staticpro (&Vcached_fontset_data); | |
1391 | |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1392 Vfontset_table = Fmake_vector (make_number (32), Qnil); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1393 staticpro (&Vfontset_table); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1394 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1395 Vdefault_fontset = Fmake_char_table (Qfontset, Qnil); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1396 staticpro (&Vdefault_fontset); |
28963 | 1397 FONTSET_ID (Vdefault_fontset) = make_number (0); |
1398 FONTSET_NAME (Vdefault_fontset) | |
1399 = build_string ("-*-*-*-*-*-*-*-*-*-*-*-*-fontset-default"); | |
32790
131348208699
(syms_of_fontset) [WINDOWSNT]: Special case for ASCII font of default
Jason Rumney <jasonr@gnu.org>
parents:
32752
diff
changeset
|
1400 #if defined (macintosh) |
32752
923b8d6d8277
Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
31102
diff
changeset
|
1401 FONTSET_ASCII (Vdefault_fontset) |
923b8d6d8277
Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
31102
diff
changeset
|
1402 = Fcons (make_number (0), |
923b8d6d8277
Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
31102
diff
changeset
|
1403 build_string ("-apple-monaco-medium-r-*--*-120-*-*-*-*-mac-roman")); |
32790
131348208699
(syms_of_fontset) [WINDOWSNT]: Special case for ASCII font of default
Jason Rumney <jasonr@gnu.org>
parents:
32752
diff
changeset
|
1404 #elif defined (WINDOWSNT) |
131348208699
(syms_of_fontset) [WINDOWSNT]: Special case for ASCII font of default
Jason Rumney <jasonr@gnu.org>
parents:
32752
diff
changeset
|
1405 FONTSET_ASCII (Vdefault_fontset) |
131348208699
(syms_of_fontset) [WINDOWSNT]: Special case for ASCII font of default
Jason Rumney <jasonr@gnu.org>
parents:
32752
diff
changeset
|
1406 = Fcons (make_number (0), |
131348208699
(syms_of_fontset) [WINDOWSNT]: Special case for ASCII font of default
Jason Rumney <jasonr@gnu.org>
parents:
32752
diff
changeset
|
1407 build_string ("-outline-courier new-normal-r-*-*-*-120-*-*-*-*-iso8859-1")); |
32752
923b8d6d8277
Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
31102
diff
changeset
|
1408 #else |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1409 FONTSET_ASCII (Vdefault_fontset) |
29231
3c444d185d31
(syms_of_fontset): Adjust the font name for ascii of
Kenichi Handa <handa@m17n.org>
parents:
29011
diff
changeset
|
1410 = Fcons (make_number (0), |
3c444d185d31
(syms_of_fontset): Adjust the font name for ascii of
Kenichi Handa <handa@m17n.org>
parents:
29011
diff
changeset
|
1411 build_string ("-adobe-courier-medium-r-*-*-*-120-*-*-*-*-iso8859-1")); |
32752
923b8d6d8277
Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
31102
diff
changeset
|
1412 #endif |
28963 | 1413 AREF (Vfontset_table, 0) = Vdefault_fontset; |
1414 next_fontset_id = 1; | |
17052 | 1415 |
1416 DEFVAR_LISP ("font-encoding-alist", &Vfont_encoding_alist, | |
1417 "Alist of fontname patterns vs corresponding encoding info.\n\ | |
1418 Each element looks like (REGEXP . ENCODING-INFO),\n\ | |
1419 where ENCODING-INFO is an alist of CHARSET vs ENCODING.\n\ | |
1420 ENCODING is one of the following integer values:\n\ | |
1421 0: code points 0x20..0x7F or 0x2020..0x7F7F are used,\n\ | |
1422 1: code points 0xA0..0xFF or 0xA0A0..0xFFFF are used,\n\ | |
1423 2: code points 0x20A0..0x7FFF are used,\n\ | |
1424 3: code points 0xA020..0xFF7F are used."); | |
1425 Vfont_encoding_alist = Qnil; | |
1426 | |
17112
5c48ff325655
(syms_of_fontset): Intern Qfontset. Declare new lisp
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
1427 DEFVAR_LISP ("use-default-ascent", &Vuse_default_ascent, |
19172
f3580f4e3587
(syms_of_fontset): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents:
18976
diff
changeset
|
1428 "Char table of characters whose ascent values should be ignored.\n\ |
17112
5c48ff325655
(syms_of_fontset): Intern Qfontset. Declare new lisp
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
1429 If an entry for a character is non-nil, the ascent value of the glyph\n\ |
19282
09a1536debb4
(Vignore_relative_composition): New variable.
Kenichi Handa <handa@m17n.org>
parents:
19172
diff
changeset
|
1430 is assumed to be what specified by _MULE_DEFAULT_ASCENT property of a font.\n\ |
09a1536debb4
(Vignore_relative_composition): New variable.
Kenichi Handa <handa@m17n.org>
parents:
19172
diff
changeset
|
1431 \n\ |
09a1536debb4
(Vignore_relative_composition): New variable.
Kenichi Handa <handa@m17n.org>
parents:
19172
diff
changeset
|
1432 This affects how a composite character which contains\n\ |
09a1536debb4
(Vignore_relative_composition): New variable.
Kenichi Handa <handa@m17n.org>
parents:
19172
diff
changeset
|
1433 such a character is displayed on screen."); |
09a1536debb4
(Vignore_relative_composition): New variable.
Kenichi Handa <handa@m17n.org>
parents:
19172
diff
changeset
|
1434 Vuse_default_ascent = Qnil; |
09a1536debb4
(Vignore_relative_composition): New variable.
Kenichi Handa <handa@m17n.org>
parents:
19172
diff
changeset
|
1435 |
09a1536debb4
(Vignore_relative_composition): New variable.
Kenichi Handa <handa@m17n.org>
parents:
19172
diff
changeset
|
1436 DEFVAR_LISP ("ignore-relative-composition", &Vignore_relative_composition, |
09a1536debb4
(Vignore_relative_composition): New variable.
Kenichi Handa <handa@m17n.org>
parents:
19172
diff
changeset
|
1437 "Char table of characters which is not composed relatively.\n\ |
26858
7cc081b4e084
(Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents:
26164
diff
changeset
|
1438 If an entry for a character is non-nil, a composition sequence\n\ |
19282
09a1536debb4
(Vignore_relative_composition): New variable.
Kenichi Handa <handa@m17n.org>
parents:
19172
diff
changeset
|
1439 which contains that character is displayed so that\n\ |
09a1536debb4
(Vignore_relative_composition): New variable.
Kenichi Handa <handa@m17n.org>
parents:
19172
diff
changeset
|
1440 the glyph of that character is put without considering\n\ |
09a1536debb4
(Vignore_relative_composition): New variable.
Kenichi Handa <handa@m17n.org>
parents:
19172
diff
changeset
|
1441 an ascent and descent value of a previous character."); |
26858
7cc081b4e084
(Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents:
26164
diff
changeset
|
1442 Vignore_relative_composition = Qnil; |
17112
5c48ff325655
(syms_of_fontset): Intern Qfontset. Declare new lisp
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
1443 |
19450
895dc2520755
(Valternate_fontname_alist): Name changed from
Kenichi Handa <handa@m17n.org>
parents:
19282
diff
changeset
|
1444 DEFVAR_LISP ("alternate-fontname-alist", &Valternate_fontname_alist, |
895dc2520755
(Valternate_fontname_alist): Name changed from
Kenichi Handa <handa@m17n.org>
parents:
19282
diff
changeset
|
1445 "Alist of fontname vs list of the alternate fontnames.\n\ |
19172
f3580f4e3587
(syms_of_fontset): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents:
18976
diff
changeset
|
1446 When a specified font name is not found, the corresponding\n\ |
19450
895dc2520755
(Valternate_fontname_alist): Name changed from
Kenichi Handa <handa@m17n.org>
parents:
19282
diff
changeset
|
1447 alternate fontnames (if any) are tried instead."); |
895dc2520755
(Valternate_fontname_alist): Name changed from
Kenichi Handa <handa@m17n.org>
parents:
19282
diff
changeset
|
1448 Valternate_fontname_alist = Qnil; |
17193
dc4562b0152a
(Valternative_fontname_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
17190
diff
changeset
|
1449 |
17730
4bbcc6804b5d
(Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
17331
diff
changeset
|
1450 DEFVAR_LISP ("fontset-alias-alist", &Vfontset_alias_alist, |
4bbcc6804b5d
(Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
17331
diff
changeset
|
1451 "Alist of fontset names vs the aliases."); |
28963 | 1452 Vfontset_alias_alist = Fcons (Fcons (FONTSET_NAME (Vdefault_fontset), |
1453 build_string ("fontset-default")), | |
1454 Qnil); | |
17730
4bbcc6804b5d
(Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
17331
diff
changeset
|
1455 |
17331
f91b4d582897
(Vhighlight_wrong_size_font, Vclip_large_size_font):
Kenichi Handa <handa@m17n.org>
parents:
17193
diff
changeset
|
1456 DEFVAR_LISP ("highlight-wrong-size-font", &Vhighlight_wrong_size_font, |
f91b4d582897
(Vhighlight_wrong_size_font, Vclip_large_size_font):
Kenichi Handa <handa@m17n.org>
parents:
17193
diff
changeset
|
1457 "*Non-nil means highlight characters shown in wrong size fonts somehow.\n\ |
f91b4d582897
(Vhighlight_wrong_size_font, Vclip_large_size_font):
Kenichi Handa <handa@m17n.org>
parents:
17193
diff
changeset
|
1458 The way to highlight them depends on window system on which Emacs runs.\n\ |
19172
f3580f4e3587
(syms_of_fontset): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents:
18976
diff
changeset
|
1459 On X11, a rectangle is shown around each such character."); |
18976
ebb3e71c6dfd
(syms_of_fontset): Set Vhighlight_wrong_size_font to Qnil.
Kenichi Handa <handa@m17n.org>
parents:
18694
diff
changeset
|
1460 Vhighlight_wrong_size_font = Qnil; |
17331
f91b4d582897
(Vhighlight_wrong_size_font, Vclip_large_size_font):
Kenichi Handa <handa@m17n.org>
parents:
17193
diff
changeset
|
1461 |
f91b4d582897
(Vhighlight_wrong_size_font, Vclip_large_size_font):
Kenichi Handa <handa@m17n.org>
parents:
17193
diff
changeset
|
1462 DEFVAR_LISP ("clip-large-size-font", &Vclip_large_size_font, |
19172
f3580f4e3587
(syms_of_fontset): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents:
18976
diff
changeset
|
1463 "*Non-nil means characters shown in overlarge fonts are clipped.\n\ |
17730
4bbcc6804b5d
(Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
17331
diff
changeset
|
1464 The height of clipping area is the same as that of an ASCII character.\n\ |
19172
f3580f4e3587
(syms_of_fontset): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents:
18976
diff
changeset
|
1465 The width of the area is the same as that of an ASCII character,\n\ |
f3580f4e3587
(syms_of_fontset): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents:
18976
diff
changeset
|
1466 or twice as wide, depending on the character set's column-width.\n\ |
17730
4bbcc6804b5d
(Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
17331
diff
changeset
|
1467 \n\ |
19172
f3580f4e3587
(syms_of_fontset): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents:
18976
diff
changeset
|
1468 If the only font you have for a specific character set is too large,\n\ |
f3580f4e3587
(syms_of_fontset): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents:
18976
diff
changeset
|
1469 and clipping these characters makes them hard to read,\n\ |
f3580f4e3587
(syms_of_fontset): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents:
18976
diff
changeset
|
1470 you can set this variable to nil to display the characters without clipping.\n\ |
f3580f4e3587
(syms_of_fontset): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents:
18976
diff
changeset
|
1471 The drawback is that you will get some garbage left on your screen."); |
17331
f91b4d582897
(Vhighlight_wrong_size_font, Vclip_large_size_font):
Kenichi Handa <handa@m17n.org>
parents:
17193
diff
changeset
|
1472 Vclip_large_size_font = Qt; |
f91b4d582897
(Vhighlight_wrong_size_font, Vclip_large_size_font):
Kenichi Handa <handa@m17n.org>
parents:
17193
diff
changeset
|
1473 |
26858
7cc081b4e084
(Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents:
26164
diff
changeset
|
1474 DEFVAR_LISP ("vertical-centering-font-regexp", |
7cc081b4e084
(Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents:
26164
diff
changeset
|
1475 &Vvertical_centering_font_regexp, |
7cc081b4e084
(Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents:
26164
diff
changeset
|
1476 "*Regexp matching font names that require vertical centering on display.\n\ |
7cc081b4e084
(Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents:
26164
diff
changeset
|
1477 When a character is displayed with such fonts, the character is displayed\n\ |
7cc081b4e084
(Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents:
26164
diff
changeset
|
1478 at the vertival center of lines."); |
7cc081b4e084
(Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents:
26164
diff
changeset
|
1479 Vvertical_centering_font_regexp = Qnil; |
7cc081b4e084
(Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents:
26164
diff
changeset
|
1480 |
17052 | 1481 defsubr (&Squery_fontset); |
1482 defsubr (&Snew_fontset); | |
1483 defsubr (&Sset_fontset_font); | |
1484 defsubr (&Sfont_info); | |
28963 | 1485 defsubr (&Sinternal_char_font); |
17052 | 1486 defsubr (&Sfontset_info); |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1487 defsubr (&Sfontset_font); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1488 defsubr (&Sfontset_list); |
17052 | 1489 } |