Mercurial > emacs
annotate src/fontset.c @ 41043:21a6b9fea031
(calcFunc-evalv): Use `defalias' instead of `fset' and
`symbol-function'.
Style cleanup; don't put closing parens on their
own line, add "foo.el ends here" to each file, and update
copyright date.
author | Colin Walters <walters@gnu.org> |
---|---|
date | Wed, 14 Nov 2001 09:03:32 +0000 |
parents | a17c8b15ef1b |
children | c0f330e36e98 |
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)); |
35658
3551e8549d4e
(font_family_registry): Even if FONTNAME conform to
Kenichi Handa <handa@m17n.org>
parents:
34975
diff
changeset
|
184 static Lisp_Object font_family_registry P_ ((Lisp_Object, int)); |
28223
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 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
214 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
|
215 return FONTSET_ASCII (fontset); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
216 |
29011
b60861d6c1e0
(fontset_ref): Use SPLIT_CHAR instead of
Kenichi Handa <handa@m17n.org>
parents:
28971
diff
changeset
|
217 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
|
218 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
|
219 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
|
220 return elt; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
221 defalt = XCHAR_TABLE (elt)->defalt; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
222 if (c1 < 32 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
223 || (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
|
224 NILP (elt))) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
225 return defalt; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
226 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
|
227 return elt; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
228 defalt = XCHAR_TABLE (elt)->defalt; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
229 if (c2 < 32 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
230 || (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
|
231 NILP (elt))) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
232 return defalt; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
233 return elt; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
234 } |
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 #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
|
238 |
30398
dde5ab185aad
(fontset_ref): Remove INLINE declaration.
Kenichi Handa <handa@m17n.org>
parents:
30172
diff
changeset
|
239 static Lisp_Object |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
240 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
|
241 Lisp_Object fontset; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
242 int *c; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
243 { |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
244 int charset, c1, c2; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
245 Lisp_Object elt; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
246 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
247 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
|
248 return FONTSET_ASCII (fontset); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
249 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
250 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
|
251 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
|
252 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
|
253 if (NILP (elt)) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
254 return Qnil; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
255 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
256 *c = XINT (XCAR (elt)); |
29011
b60861d6c1e0
(fontset_ref): Use SPLIT_CHAR instead of
Kenichi Handa <handa@m17n.org>
parents:
28971
diff
changeset
|
257 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
|
258 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
|
259 if (c1 < 32) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
260 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
|
261 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
|
262 return Qnil; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
263 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
|
264 if (c2 < 32) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
265 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
|
266 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
|
267 return Qnil; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
268 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
|
269 return elt; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
270 } |
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 |
30398
dde5ab185aad
(fontset_ref): Remove INLINE declaration.
Kenichi Handa <handa@m17n.org>
parents:
30172
diff
changeset
|
273 /* 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
|
274 #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
|
275 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
276 static void |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
277 fontset_set (fontset, c, newelt) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
278 Lisp_Object fontset; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
279 int c; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
280 Lisp_Object newelt; |
17052 | 281 { |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
282 int charset, code[3]; |
34975
0d69e2d2724e
(fontset_ref): Remove unused variable `i'.
Eli Zaretskii <eliz@gnu.org>
parents:
32978
diff
changeset
|
283 Lisp_Object *elt; |
0d69e2d2724e
(fontset_ref): Remove unused variable `i'.
Eli Zaretskii <eliz@gnu.org>
parents:
32978
diff
changeset
|
284 int i; |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
285 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
286 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
|
287 { |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
288 FONTSET_ASCII (fontset) = newelt; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
289 return; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
290 } |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
291 |
29011
b60861d6c1e0
(fontset_ref): Use SPLIT_CHAR instead of
Kenichi Handa <handa@m17n.org>
parents:
28971
diff
changeset
|
292 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
|
293 code[2] = 0; /* anchor */ |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
294 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
|
295 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
|
296 { |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
297 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
|
298 *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
|
299 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
|
300 } |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
301 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
|
302 XCHAR_TABLE (*elt)->defalt = newelt; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
303 else |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
304 *elt = newelt; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
305 } |
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 /* 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
|
309 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
|
310 BASE. */ |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
311 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
312 static Lisp_Object |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
313 make_fontset (frame, name, base) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
314 Lisp_Object frame, name, base; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
315 { |
34975
0d69e2d2724e
(fontset_ref): Remove unused variable `i'.
Eli Zaretskii <eliz@gnu.org>
parents:
32978
diff
changeset
|
316 Lisp_Object fontset; |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
317 int size = ASIZE (Vfontset_table); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
318 int id = next_fontset_id; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
319 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
320 /* 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
|
321 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
|
322 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
|
323 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
|
324 id. */ |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
325 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
|
326 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
327 if (id + 1 == size) |
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 Lisp_Object tem; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
330 int i; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
331 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
332 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
|
333 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
|
334 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
|
335 Vfontset_table = tem; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
336 } |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
337 |
29767
c8e5453dc85d
(FONTSET_ASCII): Use the first element of char table
Kenichi Handa <handa@m17n.org>
parents:
29501
diff
changeset
|
338 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
|
339 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
340 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
|
341 FONTSET_NAME (fontset) = name; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
342 FONTSET_FRAME (fontset) = frame; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
343 FONTSET_BASE (fontset) = base; |
17052 | 344 |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
345 AREF (Vfontset_table, id) = fontset; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
346 next_fontset_id = id + 1; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
347 return fontset; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
348 } |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
349 |
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 /* 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
|
352 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
353 static INLINE int |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
354 fontset_id_valid_p (id) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
355 int id; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
356 { |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
357 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
|
358 } |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
359 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
360 |
35658
3551e8549d4e
(font_family_registry): Even if FONTNAME conform to
Kenichi Handa <handa@m17n.org>
parents:
34975
diff
changeset
|
361 /* Extract `family' and `registry' string from FONTNAME and a cons of |
3551e8549d4e
(font_family_registry): Even if FONTNAME conform to
Kenichi Handa <handa@m17n.org>
parents:
34975
diff
changeset
|
362 them. Actually, `family' may also contain `foundry', `registry' |
3551e8549d4e
(font_family_registry): Even if FONTNAME conform to
Kenichi Handa <handa@m17n.org>
parents:
34975
diff
changeset
|
363 may also contain `encoding' of FONTNAME. But, if FONTNAME doesn't |
3551e8549d4e
(font_family_registry): Even if FONTNAME conform to
Kenichi Handa <handa@m17n.org>
parents:
34975
diff
changeset
|
364 conform to XLFD nor explicitely specifies the other fields |
3551e8549d4e
(font_family_registry): Even if FONTNAME conform to
Kenichi Handa <handa@m17n.org>
parents:
34975
diff
changeset
|
365 (i.e. not using wildcard `*'), return FONTNAME. If FORCE is |
3551e8549d4e
(font_family_registry): Even if FONTNAME conform to
Kenichi Handa <handa@m17n.org>
parents:
34975
diff
changeset
|
366 nonzero, specifications of the other fields are ignored, and return |
3551e8549d4e
(font_family_registry): Even if FONTNAME conform to
Kenichi Handa <handa@m17n.org>
parents:
34975
diff
changeset
|
367 a cons as far as FONTNAME conform to XLFD. */ |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
368 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
369 static Lisp_Object |
35658
3551e8549d4e
(font_family_registry): Even if FONTNAME conform to
Kenichi Handa <handa@m17n.org>
parents:
34975
diff
changeset
|
370 font_family_registry (fontname, force) |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
371 Lisp_Object fontname; |
35658
3551e8549d4e
(font_family_registry): Even if FONTNAME conform to
Kenichi Handa <handa@m17n.org>
parents:
34975
diff
changeset
|
372 int force; |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
373 { |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
374 Lisp_Object family, registry; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
375 char *p = XSTRING (fontname)->data; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
376 char *sep[15]; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
377 int i = 0; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
378 |
35658
3551e8549d4e
(font_family_registry): Even if FONTNAME conform to
Kenichi Handa <handa@m17n.org>
parents:
34975
diff
changeset
|
379 while (*p && i < 15) |
3551e8549d4e
(font_family_registry): Even if FONTNAME conform to
Kenichi Handa <handa@m17n.org>
parents:
34975
diff
changeset
|
380 if (*p++ == '-') |
3551e8549d4e
(font_family_registry): Even if FONTNAME conform to
Kenichi Handa <handa@m17n.org>
parents:
34975
diff
changeset
|
381 { |
3551e8549d4e
(font_family_registry): Even if FONTNAME conform to
Kenichi Handa <handa@m17n.org>
parents:
34975
diff
changeset
|
382 if (!force && i >= 2 && i <= 11 && *p != '*' && p[1] != '-') |
3551e8549d4e
(font_family_registry): Even if FONTNAME conform to
Kenichi Handa <handa@m17n.org>
parents:
34975
diff
changeset
|
383 return fontname; |
3551e8549d4e
(font_family_registry): Even if FONTNAME conform to
Kenichi Handa <handa@m17n.org>
parents:
34975
diff
changeset
|
384 sep[i++] = p; |
3551e8549d4e
(font_family_registry): Even if FONTNAME conform to
Kenichi Handa <handa@m17n.org>
parents:
34975
diff
changeset
|
385 } |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
386 if (i != 14) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
387 return fontname; |
17052 | 388 |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
389 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
|
390 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
|
391 return Fcons (family, registry); |
17052 | 392 } |
393 | |
28223
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 /********** 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
|
396 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
397 /* 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
|
398 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
399 Lisp_Object |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
400 fontset_name (id) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
401 int 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 fontset; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
404 fontset = FONTSET_FROM_ID (id); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
405 return FONTSET_NAME (fontset); |
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 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
408 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
409 /* 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
|
410 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
411 Lisp_Object |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
412 fontset_ascii (id) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
413 int id; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
414 { |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
415 Lisp_Object fontset, elt; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
416 fontset= FONTSET_FROM_ID (id); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
417 elt = FONTSET_ASCII (fontset); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
418 return XCDR (elt); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
419 } |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
420 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
421 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
422 /* 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
|
423 |
17052 | 424 void |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
425 free_face_fontset (f, face) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
426 FRAME_PTR f; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
427 struct face *face; |
17052 | 428 { |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
429 if (fontset_id_valid_p (face->fontset)) |
17052 | 430 { |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
431 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
|
432 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
|
433 next_fontset_id = face->fontset; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
434 } |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
435 } |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
436 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
437 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
438 /* 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
|
439 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
|
440 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
|
441 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
442 int |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
443 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
|
444 struct face *face; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
445 int c; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
446 { |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
447 Lisp_Object fontset, elt; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
448 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
449 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
|
450 return (face == face->ascii_face); |
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 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
|
453 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
|
454 xassert (!BASE_FONTSET_P (fontset)); |
17052 | 455 |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
456 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
|
457 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
|
458 } |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
459 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
460 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
461 /* 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
|
462 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
|
463 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
|
464 from the macro FACE_FOR_CHAR when C is not a single byte character. */ |
17052 | 465 |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
466 int |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
467 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
|
468 FRAME_PTR f; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
469 struct face *face; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
470 int c; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
471 { |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
472 Lisp_Object fontset, elt; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
473 int face_id; |
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 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
|
476 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
|
477 xassert (!BASE_FONTSET_P (fontset)); |
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 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
|
480 if (!NILP (elt)) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
481 return XINT (elt); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
482 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
483 /* 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
|
484 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
|
485 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
|
486 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
487 /* 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
|
488 information in the base fontset. */ |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
489 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
|
490 return face_id; |
17052 | 491 } |
492 | |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
493 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
494 /* 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
|
495 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
|
496 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
|
497 Called from realize_x_face. */ |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
498 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
499 int |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
500 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
|
501 FRAME_PTR f; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
502 int base_fontset_id; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
503 { |
34975
0d69e2d2724e
(fontset_ref): Remove unused variable `i'.
Eli Zaretskii <eliz@gnu.org>
parents:
32978
diff
changeset
|
504 Lisp_Object base_fontset, fontset, frame; |
28223
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 XSETFRAME (frame, f); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
507 if (base_fontset_id >= 0) |
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 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
|
510 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
|
511 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
|
512 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
|
513 } |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
514 else |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
515 base_fontset = Vdefault_fontset; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
516 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
517 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
|
518 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
|
519 } |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
520 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
521 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
522 /* Return the font name pattern for C that is recorded in the fontset |
35658
3551e8549d4e
(font_family_registry): Even if FONTNAME conform to
Kenichi Handa <handa@m17n.org>
parents:
34975
diff
changeset
|
523 with ID. If a font name pattern is specified (instead of a cons of |
3551e8549d4e
(font_family_registry): Even if FONTNAME conform to
Kenichi Handa <handa@m17n.org>
parents:
34975
diff
changeset
|
524 family and registry), check if a font can be opened by that pattern |
3551e8549d4e
(font_family_registry): Even if FONTNAME conform to
Kenichi Handa <handa@m17n.org>
parents:
34975
diff
changeset
|
525 to get the fullname. If a font is opened, return that name. |
3551e8549d4e
(font_family_registry): Even if FONTNAME conform to
Kenichi Handa <handa@m17n.org>
parents:
34975
diff
changeset
|
526 Otherwise, return nil. If ID is -1, or the fontset doesn't contain |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
527 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
|
528 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
|
529 |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
530 Lisp_Object |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
531 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
|
532 FRAME_PTR f; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
533 int id, c; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
534 { |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
535 Lisp_Object fontset, elt; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
536 struct font_info *fontp; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
537 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
538 elt = Qnil; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
539 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
|
540 { |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
541 fontset = FONTSET_FROM_ID (id); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
542 xassert (!BASE_FONTSET_P (fontset)); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
543 fontset = FONTSET_BASE (fontset); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
544 elt = FONTSET_REF (fontset, c); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
545 } |
29767
c8e5453dc85d
(FONTSET_ASCII): Use the first element of char table
Kenichi Handa <handa@m17n.org>
parents:
29501
diff
changeset
|
546 if (NILP (elt)) |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
547 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
|
548 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
549 if (!CONSP (elt)) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
550 return Qnil; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
551 if (CONSP (XCDR (elt))) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
552 return XCDR (elt); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
553 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
554 /* The fontset specifies only a font name pattern (not cons of |
35658
3551e8549d4e
(font_family_registry): Even if FONTNAME conform to
Kenichi Handa <handa@m17n.org>
parents:
34975
diff
changeset
|
555 family and registry). If a font can be opened by that pattern, |
3551e8549d4e
(font_family_registry): Even if FONTNAME conform to
Kenichi Handa <handa@m17n.org>
parents:
34975
diff
changeset
|
556 return the name of opened font. Otherwise return nil. The |
3551e8549d4e
(font_family_registry): Even if FONTNAME conform to
Kenichi Handa <handa@m17n.org>
parents:
34975
diff
changeset
|
557 exception is a font for single byte characters. In that case, we |
3551e8549d4e
(font_family_registry): Even if FONTNAME conform to
Kenichi Handa <handa@m17n.org>
parents:
34975
diff
changeset
|
558 return a cons of FAMILY and REGISTRY extracted from the opened |
3551e8549d4e
(font_family_registry): Even if FONTNAME conform to
Kenichi Handa <handa@m17n.org>
parents:
34975
diff
changeset
|
559 font name. */ |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
560 elt = XCDR (elt); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
561 xassert (STRINGP (elt)); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
562 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
|
563 if (!fontp) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
564 return Qnil; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
565 |
35658
3551e8549d4e
(font_family_registry): Even if FONTNAME conform to
Kenichi Handa <handa@m17n.org>
parents:
34975
diff
changeset
|
566 return font_family_registry (build_string (fontp->full_name), |
3551e8549d4e
(font_family_registry): Even if FONTNAME conform to
Kenichi Handa <handa@m17n.org>
parents:
34975
diff
changeset
|
567 SINGLE_BYTE_CHAR_P (c)); |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
568 } |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
569 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
570 |
40028
392c2fe9edd7
(fs_load_font) [WINDOWSNT && _MSC_VER]: Disable
Andrew Innes <andrewi@gnu.org>
parents:
39973
diff
changeset
|
571 #if defined(WINDOWSNT) && defined (_MSC_VER) |
392c2fe9edd7
(fs_load_font) [WINDOWSNT && _MSC_VER]: Disable
Andrew Innes <andrewi@gnu.org>
parents:
39973
diff
changeset
|
572 #pragma optimize("", off) |
392c2fe9edd7
(fs_load_font) [WINDOWSNT && _MSC_VER]: Disable
Andrew Innes <andrewi@gnu.org>
parents:
39973
diff
changeset
|
573 #endif |
392c2fe9edd7
(fs_load_font) [WINDOWSNT && _MSC_VER]: Disable
Andrew Innes <andrewi@gnu.org>
parents:
39973
diff
changeset
|
574 |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
575 /* 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
|
576 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
|
577 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
|
578 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
|
579 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
|
580 specified by ID. */ |
17052 | 581 |
582 struct font_info * | |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
583 fs_load_font (f, c, fontname, id, face) |
17052 | 584 FRAME_PTR f; |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
585 int c; |
17052 | 586 char *fontname; |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
587 int id; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
588 struct face *face; |
17052 | 589 { |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
590 Lisp_Object fontset; |
17052 | 591 Lisp_Object list, elt; |
592 int size = 0; | |
593 struct font_info *fontp; | |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
594 int charset = CHAR_CHARSET (c); |
17052 | 595 |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
596 if (face) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
597 id = face->fontset; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
598 if (id < 0) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
599 fontset = Qnil; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
600 else |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
601 fontset = FONTSET_FROM_ID (id); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
602 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
603 if (!NILP (fontset) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
604 && !BASE_FONTSET_P (fontset)) |
17052 | 605 { |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
606 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
|
607 if (!NILP (elt)) |
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 /* 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
|
610 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
|
611 int face_id = XINT (elt); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
612 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
613 xassert (face_id == face->id); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
614 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
|
615 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
|
616 } |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
617 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
618 if (!fontname && charset == CHARSET_ASCII) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
619 { |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
620 elt = FONTSET_ASCII (fontset); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
621 fontname = XSTRING (XCDR (elt))->data; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
622 } |
17052 | 623 } |
624 | |
625 if (!fontname) | |
626 /* No way to get fontname. */ | |
627 return 0; | |
628 | |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
629 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
|
630 if (!fontp) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
631 return 0; |
17052 | 632 |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
633 /* 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
|
634 font_info structure that are not set by (*load_font_func). */ |
17052 | 635 fontp->charset = charset; |
636 | |
26858
7cc081b4e084
(Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents:
26164
diff
changeset
|
637 fontp->vertical_centering |
7cc081b4e084
(Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents:
26164
diff
changeset
|
638 = (STRINGP (Vvertical_centering_font_regexp) |
7cc081b4e084
(Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents:
26164
diff
changeset
|
639 && (fast_c_string_match_ignore_case |
7cc081b4e084
(Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents:
26164
diff
changeset
|
640 (Vvertical_centering_font_regexp, fontp->full_name) >= 0)); |
7cc081b4e084
(Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents:
26164
diff
changeset
|
641 |
17999
5e325c8057c8
(fs_load_font): Before using a fontset, be sure to
Kenichi Handa <handa@m17n.org>
parents:
17882
diff
changeset
|
642 if (fontp->encoding[1] != FONT_ENCODING_NOT_DECIDED) |
17052 | 643 { |
644 /* The font itself tells which code points to be used. Use this | |
645 encoding for all other charsets. */ | |
646 int i; | |
647 | |
648 fontp->encoding[0] = fontp->encoding[1]; | |
17190
6637001cdb4b
Adjusted for the change of MAX_CHARSET.
Kenichi Handa <handa@m17n.org>
parents:
17112
diff
changeset
|
649 for (i = MIN_CHARSET_OFFICIAL_DIMENSION1; i <= MAX_CHARSET; i++) |
17052 | 650 fontp->encoding[i] = fontp->encoding[1]; |
651 } | |
652 else | |
653 { | |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
654 /* The font itself doesn't have information about encoding. */ |
17052 | 655 int i; |
656 | |
28766
da7e00e4eaa6
(fs_load_font): By default, use 0x00..0x7f for ASCII.
Kenichi Handa <handa@m17n.org>
parents:
28676
diff
changeset
|
657 fontname = fontp->full_name; |
da7e00e4eaa6
(fs_load_font): By default, use 0x00..0x7f for ASCII.
Kenichi Handa <handa@m17n.org>
parents:
28676
diff
changeset
|
658 /* 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
|
659 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
|
660 fontp->encoding[0] = 0; |
17190
6637001cdb4b
Adjusted for the change of MAX_CHARSET.
Kenichi Handa <handa@m17n.org>
parents:
17112
diff
changeset
|
661 for (i = MIN_CHARSET_OFFICIAL_DIMENSION1; i <= MAX_CHARSET; i++) |
17052 | 662 fontp->encoding[i] = 1; |
663 /* 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
|
664 for (list = Vfont_encoding_alist; CONSP (list); list = XCDR (list)) |
17052 | 665 { |
26164
d39ec0a27081
more XCAR/XCDR/XFLOAT_DATA uses, to help isolete lisp engine
Ken Raeburn <raeburn@raeburn.org>
parents:
25668
diff
changeset
|
666 elt = XCAR (list); |
17052 | 667 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
|
668 && 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
|
669 && (fast_c_string_match_ignore_case (XCAR (elt), fontname) |
17052 | 670 >= 0)) |
671 { | |
672 Lisp_Object tmp; | |
673 | |
26164
d39ec0a27081
more XCAR/XCDR/XFLOAT_DATA uses, to help isolete lisp engine
Ken Raeburn <raeburn@raeburn.org>
parents:
25668
diff
changeset
|
674 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
|
675 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
|
676 && ((i = get_charset_id (XCAR (XCAR (tmp)))) |
17052 | 677 >= 0) |
26164
d39ec0a27081
more XCAR/XCDR/XFLOAT_DATA uses, to help isolete lisp engine
Ken Raeburn <raeburn@raeburn.org>
parents:
25668
diff
changeset
|
678 && 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
|
679 && XFASTINT (XCDR (XCAR (tmp))) < 4) |
17052 | 680 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
|
681 = XFASTINT (XCDR (XCAR (tmp))); |
17052 | 682 } |
683 } | |
684 } | |
685 | |
686 fontp->font_encoder = (struct ccl_program *) 0; | |
21553
2d7afcd11b72
(find_ccl_program_func): New variable.
Kenichi Handa <handa@m17n.org>
parents:
21514
diff
changeset
|
687 |
2d7afcd11b72
(find_ccl_program_func): New variable.
Kenichi Handa <handa@m17n.org>
parents:
21514
diff
changeset
|
688 if (find_ccl_program_func) |
2d7afcd11b72
(find_ccl_program_func): New variable.
Kenichi Handa <handa@m17n.org>
parents:
21514
diff
changeset
|
689 (*find_ccl_program_func) (fontp); |
17052 | 690 |
28963 | 691 /* If we loaded a font for a face that has fontset, record the face |
692 ID in the fontset for C. */ | |
693 if (face | |
694 && !NILP (fontset) | |
695 && !BASE_FONTSET_P (fontset)) | |
696 FONTSET_SET (fontset, c, make_number (face->id)); | |
17052 | 697 return fontp; |
698 } | |
699 | |
40028
392c2fe9edd7
(fs_load_font) [WINDOWSNT && _MSC_VER]: Disable
Andrew Innes <andrewi@gnu.org>
parents:
39973
diff
changeset
|
700 #if defined(WINDOWSNT) && defined (_MSC_VER) |
392c2fe9edd7
(fs_load_font) [WINDOWSNT && _MSC_VER]: Disable
Andrew Innes <andrewi@gnu.org>
parents:
39973
diff
changeset
|
701 #pragma optimize("", on) |
392c2fe9edd7
(fs_load_font) [WINDOWSNT && _MSC_VER]: Disable
Andrew Innes <andrewi@gnu.org>
parents:
39973
diff
changeset
|
702 #endif |
392c2fe9edd7
(fs_load_font) [WINDOWSNT && _MSC_VER]: Disable
Andrew Innes <andrewi@gnu.org>
parents:
39973
diff
changeset
|
703 |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
704 |
17052 | 705 /* Cache data used by fontset_pattern_regexp. The car part is a |
706 pattern string containing at least one wild card, the cdr part is | |
707 the corresponding regular expression. */ | |
708 static Lisp_Object Vcached_fontset_data; | |
709 | |
26164
d39ec0a27081
more XCAR/XCDR/XFLOAT_DATA uses, to help isolete lisp engine
Ken Raeburn <raeburn@raeburn.org>
parents:
25668
diff
changeset
|
710 #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
|
711 #define CACHED_FONTSET_REGEX (XCDR (Vcached_fontset_data)) |
17052 | 712 |
713 /* If fontset name PATTERN contains any wild card, return regular | |
714 expression corresponding to PATTERN. */ | |
715 | |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
716 static Lisp_Object |
17052 | 717 fontset_pattern_regexp (pattern) |
718 Lisp_Object pattern; | |
719 { | |
720 if (!index (XSTRING (pattern)->data, '*') | |
721 && !index (XSTRING (pattern)->data, '?')) | |
722 /* PATTERN does not contain any wild cards. */ | |
17730
4bbcc6804b5d
(Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
17331
diff
changeset
|
723 return Qnil; |
17052 | 724 |
725 if (!CONSP (Vcached_fontset_data) | |
726 || strcmp (XSTRING (pattern)->data, CACHED_FONTSET_NAME)) | |
727 { | |
728 /* We must at first update the cached data. */ | |
35663
e5dea4a61cab
* fontset.c (fontset_pattern_regexp): Allocate three more bytes to
Andrew Choi <akochoi@shaw.ca>
parents:
35658
diff
changeset
|
729 char *regex = (char *) alloca (XSTRING (pattern)->size * 2 + 3); |
17052 | 730 char *p0, *p1 = regex; |
731 | |
17730
4bbcc6804b5d
(Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
17331
diff
changeset
|
732 /* Convert "*" to ".*", "?" to ".". */ |
4bbcc6804b5d
(Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
17331
diff
changeset
|
733 *p1++ = '^'; |
17827
95010205f916
(fontset_pattern_regexp): Cast to (char *) before
Kenichi Handa <handa@m17n.org>
parents:
17730
diff
changeset
|
734 for (p0 = (char *) XSTRING (pattern)->data; *p0; p0++) |
17052 | 735 { |
17730
4bbcc6804b5d
(Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
17331
diff
changeset
|
736 if (*p0 == '*') |
17052 | 737 { |
17730
4bbcc6804b5d
(Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
17331
diff
changeset
|
738 *p1++ = '.'; |
4bbcc6804b5d
(Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
17331
diff
changeset
|
739 *p1++ = '*'; |
17052 | 740 } |
17730
4bbcc6804b5d
(Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
17331
diff
changeset
|
741 else if (*p0 == '?') |
21127
577865651099
(fontset_pattern_regexp): `==' was used instead of `='.
Richard M. Stallman <rms@gnu.org>
parents:
20346
diff
changeset
|
742 *p1++ = '.'; |
17730
4bbcc6804b5d
(Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
17331
diff
changeset
|
743 else |
4bbcc6804b5d
(Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
17331
diff
changeset
|
744 *p1++ = *p0; |
17052 | 745 } |
746 *p1++ = '$'; | |
747 *p1++ = 0; | |
748 | |
749 Vcached_fontset_data = Fcons (build_string (XSTRING (pattern)->data), | |
750 build_string (regex)); | |
751 } | |
752 | |
753 return CACHED_FONTSET_REGEX; | |
754 } | |
755 | |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
756 /* 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
|
757 fontset, return -1. */ |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
758 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
759 int |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
760 fs_query_fontset (name, regexpp) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
761 Lisp_Object name; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
762 int regexpp; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
763 { |
34975
0d69e2d2724e
(fontset_ref): Remove unused variable `i'.
Eli Zaretskii <eliz@gnu.org>
parents:
32978
diff
changeset
|
764 Lisp_Object tem; |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
765 int i; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
766 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
767 name = Fdowncase (name); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
768 if (!regexpp) |
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 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
|
771 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
|
772 name = XCAR (tem); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
773 else |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
774 { |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
775 tem = fontset_pattern_regexp (name); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
776 if (STRINGP (tem)) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
777 { |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
778 name = tem; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
779 regexpp = 1; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
780 } |
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 } |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
783 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
784 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
|
785 { |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
786 Lisp_Object fontset; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
787 unsigned char *this_name; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
788 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
789 fontset = FONTSET_FROM_ID (i); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
790 if (NILP (fontset) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
791 || !BASE_FONTSET_P (fontset)) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
792 continue; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
793 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
794 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
|
795 if (regexpp |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
796 ? 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
|
797 : !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
|
798 return i; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
799 } |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
800 return -1; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
801 } |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
802 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
803 |
21553
2d7afcd11b72
(find_ccl_program_func): New variable.
Kenichi Handa <handa@m17n.org>
parents:
21514
diff
changeset
|
804 DEFUN ("query-fontset", Fquery_fontset, Squery_fontset, 1, 2, 0, |
41001
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
805 doc: /* Return the name of a fontset that matches PATTERN. |
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
806 The value is nil if there is no matching fontset. |
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
807 PATTERN can contain `*' or `?' as a wildcard |
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
808 just as X font name matching algorithm allows. |
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
809 If REGEXPP is non-nil, PATTERN is a regular expression. */) |
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
810 (pattern, regexpp) |
21553
2d7afcd11b72
(find_ccl_program_func): New variable.
Kenichi Handa <handa@m17n.org>
parents:
21514
diff
changeset
|
811 Lisp_Object pattern, regexpp; |
17052 | 812 { |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
813 Lisp_Object fontset; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
814 int id; |
17052 | 815 |
816 (*check_window_system_func) (); | |
817 | |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40028
diff
changeset
|
818 CHECK_STRING (pattern); |
17052 | 819 |
820 if (XSTRING (pattern)->size == 0) | |
821 return Qnil; | |
822 | |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
823 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
|
824 if (id < 0) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
825 return Qnil; |
17052 | 826 |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
827 fontset = FONTSET_FROM_ID (id); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
828 return FONTSET_NAME (fontset); |
17052 | 829 } |
830 | |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
831 /* 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
|
832 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
|
833 to be listed. */ |
17052 | 834 |
835 Lisp_Object | |
836 list_fontsets (f, pattern, size) | |
837 FRAME_PTR f; | |
838 Lisp_Object pattern; | |
839 int size; | |
840 { | |
34975
0d69e2d2724e
(fontset_ref): Remove unused variable `i'.
Eli Zaretskii <eliz@gnu.org>
parents:
32978
diff
changeset
|
841 Lisp_Object frame, regexp, val; |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
842 int id; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
843 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
844 XSETFRAME (frame, f); |
17052 | 845 |
846 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
|
847 val = Qnil; |
17052 | 848 |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
849 for (id = 0; id < ASIZE (Vfontset_table); id++) |
17052 | 850 { |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
851 Lisp_Object fontset; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
852 unsigned char *name; |
17052 | 853 |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
854 fontset = FONTSET_FROM_ID (id); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
855 if (NILP (fontset) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
856 || !BASE_FONTSET_P (fontset) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
857 || !EQ (frame, FONTSET_FRAME (fontset))) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
858 continue; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
859 name = XSTRING (FONTSET_NAME (fontset))->data; |
17052 | 860 |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
861 if (!NILP (regexp) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
862 ? (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
|
863 : strcmp (XSTRING (pattern)->data, name)) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
864 continue; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
865 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
866 if (size) |
17052 | 867 { |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
868 struct font_info *fontp; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
869 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
|
870 if (!fontp || size != fontp->size) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
871 continue; |
17052 | 872 } |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
873 val = Fcons (Fcopy_sequence (FONTSET_NAME (fontset)), val); |
17052 | 874 } |
875 | |
876 return val; | |
877 } | |
878 | |
879 DEFUN ("new-fontset", Fnew_fontset, Snew_fontset, 2, 2, 0, | |
41001
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
880 doc: /* Create a new fontset NAME that contains font information in FONTLIST. |
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
881 FONTLIST is an alist of charsets vs corresponding font name patterns. */) |
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
882 (name, fontlist) |
17052 | 883 Lisp_Object name, fontlist; |
884 { | |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
885 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
|
886 Lisp_Object tem, tail, elt; |
17052 | 887 |
888 (*check_window_system_func) (); | |
889 | |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40028
diff
changeset
|
890 CHECK_STRING (name); |
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40028
diff
changeset
|
891 CHECK_LIST (fontlist); |
17052 | 892 |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
893 name = Fdowncase (name); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
894 tem = Fquery_fontset (name, Qnil); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
895 if (!NILP (tem)) |
24585
6810d6fb639f
(Fquery_fontset): Don't check for fontset aliases here.
Richard M. Stallman <rms@gnu.org>
parents:
23517
diff
changeset
|
896 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
|
897 XSTRING (name)->data, XSTRING (tem)->data); |
17052 | 898 |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
899 /* 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
|
900 fontset elements. */ |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
901 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
|
902 for (tail = fontlist; CONSP (tail); tail = XCDR (tail)) |
17052 | 903 { |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
904 int c, charset; |
17052 | 905 |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
906 tem = XCAR (tail); |
17052 | 907 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
|
908 || (charset = get_charset_id (XCAR (tem))) < 0 |
36370
751cb07c5f11
(Fnew_fontset): Fix handling of the case that an
Kenichi Handa <handa@m17n.org>
parents:
35663
diff
changeset
|
909 || (!STRINGP (XCDR (tem)) && !CONSP (XCDR (tem)))) |
751cb07c5f11
(Fnew_fontset): Fix handling of the case that an
Kenichi Handa <handa@m17n.org>
parents:
35663
diff
changeset
|
910 error ("Elements of fontlist must be a cons of charset and font name pattern"); |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
911 |
36370
751cb07c5f11
(Fnew_fontset): Fix handling of the case that an
Kenichi Handa <handa@m17n.org>
parents:
35663
diff
changeset
|
912 tem = XCDR (tem); |
751cb07c5f11
(Fnew_fontset): Fix handling of the case that an
Kenichi Handa <handa@m17n.org>
parents:
35663
diff
changeset
|
913 if (STRINGP (tem)) |
751cb07c5f11
(Fnew_fontset): Fix handling of the case that an
Kenichi Handa <handa@m17n.org>
parents:
35663
diff
changeset
|
914 tem = Fdowncase (tem); |
751cb07c5f11
(Fnew_fontset): Fix handling of the case that an
Kenichi Handa <handa@m17n.org>
parents:
35663
diff
changeset
|
915 else |
751cb07c5f11
(Fnew_fontset): Fix handling of the case that an
Kenichi Handa <handa@m17n.org>
parents:
35663
diff
changeset
|
916 tem = Fcons (Fdowncase (Fcar (tem)), Fdowncase (Fcdr (tem))); |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
917 if (charset == CHARSET_ASCII) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
918 ascii_font = tem; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
919 else |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
920 { |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
921 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
|
922 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
|
923 } |
17052 | 924 } |
925 | |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
926 if (NILP (ascii_font)) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
927 error ("No ASCII font in the fontlist"); |
17052 | 928 |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
929 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
|
930 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
|
931 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
|
932 { |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
933 elt = XCAR (elements); |
36370
751cb07c5f11
(Fnew_fontset): Fix handling of the case that an
Kenichi Handa <handa@m17n.org>
parents:
35663
diff
changeset
|
934 tem = XCDR (elt); |
751cb07c5f11
(Fnew_fontset): Fix handling of the case that an
Kenichi Handa <handa@m17n.org>
parents:
35663
diff
changeset
|
935 if (STRINGP (tem)) |
751cb07c5f11
(Fnew_fontset): Fix handling of the case that an
Kenichi Handa <handa@m17n.org>
parents:
35663
diff
changeset
|
936 tem = font_family_registry (tem, 0); |
751cb07c5f11
(Fnew_fontset): Fix handling of the case that an
Kenichi Handa <handa@m17n.org>
parents:
35663
diff
changeset
|
937 tem = Fcons (XCAR (elt), tem); |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
938 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
|
939 } |
17052 | 940 |
941 return Qnil; | |
942 } | |
943 | |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
944 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
945 /* 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
|
946 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
947 static void |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
948 clear_fontset_elements (fontset) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
949 Lisp_Object fontset; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
950 { |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
951 int i; |
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 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
|
954 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
|
955 } |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
956 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
957 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
958 /* 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
|
959 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
|
960 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
|
961 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
962 static Lisp_Object |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
963 check_fontset_name (name) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
964 Lisp_Object name; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
965 { |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
966 int id; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
967 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
968 if (EQ (name, Qt)) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
969 return Vdefault_fontset; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
970 |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40028
diff
changeset
|
971 CHECK_STRING (name); |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
972 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
|
973 if (id < 0) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
974 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
|
975 return FONTSET_FROM_ID (id); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
976 } |
17052 | 977 |
978 DEFUN ("set-fontset-font", Fset_fontset_font, Sset_fontset_font, 3, 4, 0, | |
41001
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
979 doc: /* Modify fontset NAME to use FONTNAME for CHARACTER. |
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
980 |
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
981 CHARACTER may be a cons; (FROM . TO), where FROM and TO are |
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
982 non-generic characters. In that case, use FONTNAME |
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
983 for all characters in the range FROM and TO (inclusive). |
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
984 CHARACTER may be a charset. In that case, use FONTNAME |
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
985 for all character in the charsets. |
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
986 |
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
987 FONTNAME may be a cons; (FAMILY . REGISTRY), where FAMILY is a family |
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
988 name of a font, REGSITRY is a registry name of a font. */) |
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
989 (name, character, fontname, frame) |
28676
0a677c35ad99
(Fset_fontset_font): Fix docstring. Local variable
Kenichi Handa <handa@m17n.org>
parents:
28511
diff
changeset
|
990 Lisp_Object name, character, fontname, frame; |
17052 | 991 { |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
992 Lisp_Object fontset, elt; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
993 Lisp_Object realized; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
994 int from, to; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
995 int id; |
29233
a09ee5c15dcb
(check_registry_encoding): This function deleted.
Kenichi Handa <handa@m17n.org>
parents:
29231
diff
changeset
|
996 Lisp_Object family, registry; |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
997 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
998 fontset = check_fontset_name (name); |
17052 | 999 |
28676
0a677c35ad99
(Fset_fontset_font): Fix docstring. Local variable
Kenichi Handa <handa@m17n.org>
parents:
28511
diff
changeset
|
1000 if (CONSP (character)) |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1001 { |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1002 /* 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
|
1003 characters. */ |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40028
diff
changeset
|
1004 CHECK_NUMBER_CAR (character); |
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40028
diff
changeset
|
1005 CHECK_NUMBER_CDR (character); |
28676
0a677c35ad99
(Fset_fontset_font): Fix docstring. Local variable
Kenichi Handa <handa@m17n.org>
parents:
28511
diff
changeset
|
1006 from = XINT (XCAR (character)); |
0a677c35ad99
(Fset_fontset_font): Fix docstring. Local variable
Kenichi Handa <handa@m17n.org>
parents:
28511
diff
changeset
|
1007 to = XINT (XCDR (character)); |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1008 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
|
1009 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
|
1010 if (!NILP (name) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1011 && (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
|
1012 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
|
1013 } |
29501
f901ec87b147
(Fset_fontset_font): The arg CHARACTER may be a charset.
Kenichi Handa <handa@m17n.org>
parents:
29233
diff
changeset
|
1014 else if (SYMBOLP (character)) |
f901ec87b147
(Fset_fontset_font): The arg CHARACTER may be a charset.
Kenichi Handa <handa@m17n.org>
parents:
29233
diff
changeset
|
1015 { |
f901ec87b147
(Fset_fontset_font): The arg CHARACTER may be a charset.
Kenichi Handa <handa@m17n.org>
parents:
29233
diff
changeset
|
1016 elt = Fget (character, Qcharset); |
f901ec87b147
(Fset_fontset_font): The arg CHARACTER may be a charset.
Kenichi Handa <handa@m17n.org>
parents:
29233
diff
changeset
|
1017 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
|
1018 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
|
1019 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
|
1020 to = from; |
f901ec87b147
(Fset_fontset_font): The arg CHARACTER may be a charset.
Kenichi Handa <handa@m17n.org>
parents:
29233
diff
changeset
|
1021 } |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1022 else |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1023 { |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40028
diff
changeset
|
1024 CHECK_NUMBER (character); |
28676
0a677c35ad99
(Fset_fontset_font): Fix docstring. Local variable
Kenichi Handa <handa@m17n.org>
parents:
28511
diff
changeset
|
1025 from = XINT (character); |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1026 to = from; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1027 } |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1028 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
|
1029 invalid_character (from); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1030 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
|
1031 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
|
1032 if (from < to) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1033 { |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1034 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
|
1035 invalid_character (to); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1036 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
|
1037 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
|
1038 } |
17052 | 1039 |
29233
a09ee5c15dcb
(check_registry_encoding): This function deleted.
Kenichi Handa <handa@m17n.org>
parents:
29231
diff
changeset
|
1040 if (STRINGP (fontname)) |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1041 { |
29233
a09ee5c15dcb
(check_registry_encoding): This function deleted.
Kenichi Handa <handa@m17n.org>
parents:
29231
diff
changeset
|
1042 fontname = Fdowncase (fontname); |
35658
3551e8549d4e
(font_family_registry): Even if FONTNAME conform to
Kenichi Handa <handa@m17n.org>
parents:
34975
diff
changeset
|
1043 elt = Fcons (make_number (from), font_family_registry (fontname, 0)); |
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 else |
29233
a09ee5c15dcb
(check_registry_encoding): This function deleted.
Kenichi Handa <handa@m17n.org>
parents:
29231
diff
changeset
|
1046 { |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40028
diff
changeset
|
1047 CHECK_CONS (fontname); |
29233
a09ee5c15dcb
(check_registry_encoding): This function deleted.
Kenichi Handa <handa@m17n.org>
parents:
29231
diff
changeset
|
1048 family = XCAR (fontname); |
a09ee5c15dcb
(check_registry_encoding): This function deleted.
Kenichi Handa <handa@m17n.org>
parents:
29231
diff
changeset
|
1049 registry = XCDR (fontname); |
a09ee5c15dcb
(check_registry_encoding): This function deleted.
Kenichi Handa <handa@m17n.org>
parents:
29231
diff
changeset
|
1050 if (!NILP (family)) |
30398
dde5ab185aad
(fontset_ref): Remove INLINE declaration.
Kenichi Handa <handa@m17n.org>
parents:
30172
diff
changeset
|
1051 { |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40028
diff
changeset
|
1052 CHECK_STRING (family); |
30398
dde5ab185aad
(fontset_ref): Remove INLINE declaration.
Kenichi Handa <handa@m17n.org>
parents:
30172
diff
changeset
|
1053 family = Fdowncase (family); |
dde5ab185aad
(fontset_ref): Remove INLINE declaration.
Kenichi Handa <handa@m17n.org>
parents:
30172
diff
changeset
|
1054 } |
29233
a09ee5c15dcb
(check_registry_encoding): This function deleted.
Kenichi Handa <handa@m17n.org>
parents:
29231
diff
changeset
|
1055 if (!NILP (registry)) |
30398
dde5ab185aad
(fontset_ref): Remove INLINE declaration.
Kenichi Handa <handa@m17n.org>
parents:
30172
diff
changeset
|
1056 { |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40028
diff
changeset
|
1057 CHECK_STRING (registry); |
30398
dde5ab185aad
(fontset_ref): Remove INLINE declaration.
Kenichi Handa <handa@m17n.org>
parents:
30172
diff
changeset
|
1058 registry = Fdowncase (registry); |
dde5ab185aad
(fontset_ref): Remove INLINE declaration.
Kenichi Handa <handa@m17n.org>
parents:
30172
diff
changeset
|
1059 } |
29233
a09ee5c15dcb
(check_registry_encoding): This function deleted.
Kenichi Handa <handa@m17n.org>
parents:
29231
diff
changeset
|
1060 elt = Fcons (make_number (from), Fcons (family, registry)); |
a09ee5c15dcb
(check_registry_encoding): This function deleted.
Kenichi Handa <handa@m17n.org>
parents:
29231
diff
changeset
|
1061 } |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1062 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1063 /* 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
|
1064 the validity. */ |
17052 | 1065 if (!NILP (frame)) |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40028
diff
changeset
|
1066 CHECK_LIVE_FRAME (frame); |
17052 | 1067 |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1068 for (; from <= to; from++) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1069 FONTSET_SET (fontset, from, elt); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1070 Foptimize_char_table (fontset); |
17052 | 1071 |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1072 /* 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
|
1073 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
|
1074 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
|
1075 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
|
1076 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
|
1077 { |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1078 realized = AREF (Vfontset_table, id); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1079 if (!NILP (realized) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1080 && !BASE_FONTSET_P (realized) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1081 && EQ (FONTSET_BASE (realized), fontset)) |
17052 | 1082 { |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1083 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
|
1084 clear_fontset_elements (realized); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1085 free_realized_multibyte_face (f, id); |
17052 | 1086 } |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1087 } |
17052 | 1088 |
1089 return Qnil; | |
1090 } | |
1091 | |
1092 DEFUN ("font-info", Ffont_info, Sfont_info, 1, 2, 0, | |
41001
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
1093 doc: /* Return information about a font named NAME on frame FRAME. |
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
1094 If FRAME is omitted or nil, use the selected frame. |
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
1095 The returned value is a vector of OPENED-NAME, FULL-NAME, CHARSET, SIZE, |
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
1096 HEIGHT, BASELINE-OFFSET, RELATIVE-COMPOSE, and DEFAULT-ASCENT, |
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
1097 where |
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
1098 OPENED-NAME is the name used for opening the font, |
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
1099 FULL-NAME is the full name of the font, |
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
1100 SIZE is the maximum bound width of the font, |
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
1101 HEIGHT is the height of the font, |
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
1102 BASELINE-OFFSET is the upward offset pixels from ASCII baseline, |
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
1103 RELATIVE-COMPOSE and DEFAULT-ASCENT are the numbers controlling |
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
1104 how to compose characters. |
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
1105 If the named font is not yet loaded, return nil. */) |
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
1106 (name, frame) |
17052 | 1107 Lisp_Object name, frame; |
1108 { | |
1109 FRAME_PTR f; | |
1110 struct font_info *fontp; | |
1111 Lisp_Object info; | |
1112 | |
1113 (*check_window_system_func) (); | |
1114 | |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40028
diff
changeset
|
1115 CHECK_STRING (name); |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1116 name = Fdowncase (name); |
17052 | 1117 if (NILP (frame)) |
25668
99290b59352d
(Ffont_info): Change for Lisp_Object selected_frame.
Gerd Moellmann <gerd@gnu.org>
parents:
24611
diff
changeset
|
1118 frame = selected_frame; |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40028
diff
changeset
|
1119 CHECK_LIVE_FRAME (frame); |
25668
99290b59352d
(Ffont_info): Change for Lisp_Object selected_frame.
Gerd Moellmann <gerd@gnu.org>
parents:
24611
diff
changeset
|
1120 f = XFRAME (frame); |
17052 | 1121 |
1122 if (!query_font_func) | |
1123 error ("Font query function is not supported"); | |
1124 | |
1125 fontp = (*query_font_func) (f, XSTRING (name)->data); | |
1126 if (!fontp) | |
1127 return Qnil; | |
1128 | |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1129 info = Fmake_vector (make_number (7), Qnil); |
17052 | 1130 |
1131 XVECTOR (info)->contents[0] = build_string (fontp->name); | |
1132 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
|
1133 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
|
1134 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
|
1135 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
|
1136 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
|
1137 XVECTOR (info)->contents[6] = make_number (fontp->default_ascent); |
17052 | 1138 |
1139 return info; | |
1140 } | |
1141 | |
28963 | 1142 |
1143 /* Return the font name for the character at POSITION in the current | |
1144 buffer. This is computed from all the text properties and overlays | |
1145 that apply to POSITION. It returns nil in the following cases: | |
1146 | |
1147 (1) The window system doesn't have a font for the character (thus | |
1148 it is displayed by an empty box). | |
1149 | |
1150 (2) The character code is invalid. | |
1151 | |
1152 (3) The current buffer is not displayed in any window. | |
1153 | |
1154 In addition, the returned font name may not take into account of | |
1155 such redisplay engine hooks as what used in jit-lock-mode if | |
1156 POSITION is currently not visible. */ | |
1157 | |
1158 | |
1159 DEFUN ("internal-char-font", Finternal_char_font, Sinternal_char_font, 1, 1, 0, | |
41001
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
1160 doc: /* For internal use only. */) |
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
1161 (position) |
28963 | 1162 Lisp_Object position; |
1163 { | |
1164 int pos, pos_byte, dummy; | |
1165 int face_id; | |
1166 int c; | |
1167 Lisp_Object window; | |
1168 struct window *w; | |
1169 struct frame *f; | |
1170 struct face *face; | |
1171 | |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40028
diff
changeset
|
1172 CHECK_NUMBER_COERCE_MARKER (position); |
28963 | 1173 pos = XINT (position); |
1174 if (pos < BEGV || pos >= ZV) | |
1175 args_out_of_range_3 (position, make_number (BEGV), make_number (ZV)); | |
1176 pos_byte = CHAR_TO_BYTE (pos); | |
1177 c = FETCH_CHAR (pos_byte); | |
1178 if (! CHAR_VALID_P (c, 0)) | |
1179 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
|
1180 window = Fget_buffer_window (Fcurrent_buffer (), Qnil); |
28963 | 1181 if (NILP (window)) |
1182 return Qnil; | |
1183 w = XWINDOW (window); | |
1184 f = XFRAME (w->frame); | |
1185 face_id = face_at_buffer_position (w, pos, -1, -1, &dummy, pos + 100, 0); | |
1186 face_id = FACE_FOR_CHAR (f, FACE_FROM_ID (f, face_id), c); | |
1187 face = FACE_FROM_ID (f, face_id); | |
1188 return (face->font && face->font_name | |
1189 ? build_string (face->font_name) | |
1190 : Qnil); | |
1191 } | |
1192 | |
1193 | |
1194 /* Called from Ffontset_info via map_char_table on each leaf of | |
1195 fontset. ARG is a list (LAST FONT-INFO ...), where LAST is `(last | |
1196 ARG)' and FONT-INFOs have this form: | |
1197 (CHAR FONT-SPEC) or ((FROM . TO) FONT-SPEC) | |
1198 The current leaf is indexed by CHARACTER and has value ELT. This | |
1199 function add the information of the current leaf to ARG by | |
1200 appending a new element or modifying the last element.. */ | |
1201 | |
1202 static void | |
1203 accumulate_font_info (arg, character, elt) | |
1204 Lisp_Object arg, character, elt; | |
1205 { | |
34975
0d69e2d2724e
(fontset_ref): Remove unused variable `i'.
Eli Zaretskii <eliz@gnu.org>
parents:
32978
diff
changeset
|
1206 Lisp_Object last, last_char, last_elt; |
28963 | 1207 |
29767
c8e5453dc85d
(FONTSET_ASCII): Use the first element of char table
Kenichi Handa <handa@m17n.org>
parents:
29501
diff
changeset
|
1208 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
|
1209 elt = FONTSET_REF (Vdefault_fontset, XINT (character)); |
28963 | 1210 if (!CONSP (elt)) |
1211 return; | |
1212 last = XCAR (arg); | |
1213 last_char = XCAR (XCAR (last)); | |
1214 last_elt = XCAR (XCDR (XCAR (last))); | |
1215 elt = XCDR (elt); | |
1216 if (!NILP (Fequal (elt, last_elt))) | |
1217 { | |
1218 int this_charset = CHAR_CHARSET (XINT (character)); | |
1219 | |
1220 if (CONSP (last_char)) /* LAST_CHAR == (FROM . TO) */ | |
1221 { | |
1222 if (this_charset == CHAR_CHARSET (XINT (XCAR (last_char)))) | |
1223 { | |
39973
579177964efa
Avoid (most) uses of XCAR/XCDR as lvalues, for flexibility in experimenting
Ken Raeburn <raeburn@raeburn.org>
parents:
37744
diff
changeset
|
1224 XSETCDR (last_char, character); |
28963 | 1225 return; |
1226 } | |
1227 } | |
29767
c8e5453dc85d
(FONTSET_ASCII): Use the first element of char table
Kenichi Handa <handa@m17n.org>
parents:
29501
diff
changeset
|
1228 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
|
1229 return; |
c8e5453dc85d
(FONTSET_ASCII): Use the first element of char table
Kenichi Handa <handa@m17n.org>
parents:
29501
diff
changeset
|
1230 else if (this_charset == CHAR_CHARSET (XINT (last_char))) |
28963 | 1231 { |
39973
579177964efa
Avoid (most) uses of XCAR/XCDR as lvalues, for flexibility in experimenting
Ken Raeburn <raeburn@raeburn.org>
parents:
37744
diff
changeset
|
1232 XSETCAR (XCAR (last), Fcons (last_char, character)); |
29767
c8e5453dc85d
(FONTSET_ASCII): Use the first element of char table
Kenichi Handa <handa@m17n.org>
parents:
29501
diff
changeset
|
1233 return; |
28963 | 1234 } |
1235 } | |
39973
579177964efa
Avoid (most) uses of XCAR/XCDR as lvalues, for flexibility in experimenting
Ken Raeburn <raeburn@raeburn.org>
parents:
37744
diff
changeset
|
1236 XSETCDR (last, Fcons (Fcons (character, Fcons (elt, Qnil)), Qnil)); |
579177964efa
Avoid (most) uses of XCAR/XCDR as lvalues, for flexibility in experimenting
Ken Raeburn <raeburn@raeburn.org>
parents:
37744
diff
changeset
|
1237 XSETCAR (arg, XCDR (last)); |
28963 | 1238 } |
1239 | |
1240 | |
17052 | 1241 DEFUN ("fontset-info", Ffontset_info, Sfontset_info, 1, 2, 0, |
41001
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
1242 doc: /* Return information about a fontset named NAME on frame FRAME. |
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
1243 The value is a vector: |
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
1244 [ SIZE HEIGHT ((CHARSET-OR-RANGE FONT-SPEC OPENED ...) ...) ], |
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
1245 where, |
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
1246 SIZE is the maximum bound width of ASCII font in the fontset, |
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
1247 HEIGHT is the maximum bound height of ASCII font in the fontset, |
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
1248 CHARSET-OR-RANGE is a charset, a character (may be a generic character) |
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
1249 or a cons of two characters specifying the range of characters. |
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
1250 FONT-SPEC is a fontname pattern string or a cons (FAMILY . REGISTRY), |
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
1251 where FAMILY is a `FAMILY' field of a XLFD font name, |
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
1252 REGISTRY is a `CHARSET_REGISTRY' field of a XLDF font name. |
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
1253 FAMILY may contain a `FOUNDARY' field at the head. |
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
1254 REGISTRY may contain a `CHARSET_ENCODING' field at the tail. |
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
1255 OPENEDs are names of fonts actually opened. |
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
1256 If the ASCII font is not yet opened, SIZE and HEIGHT are 0. |
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
1257 If FRAME is omitted, it defaults to the currently selected frame. */) |
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
1258 (name, frame) |
17052 | 1259 Lisp_Object name, frame; |
1260 { | |
28963 | 1261 Lisp_Object fontset; |
17052 | 1262 FRAME_PTR f; |
28963 | 1263 Lisp_Object indices[3]; |
1264 Lisp_Object val, tail, elt; | |
1265 Lisp_Object *realized; | |
30124
26076259e03f
(Ffontset_info): Make the return value more compatible
Kenichi Handa <handa@m17n.org>
parents:
29767
diff
changeset
|
1266 struct font_info *fontp = NULL; |
28963 | 1267 int n_realized = 0; |
17052 | 1268 int i; |
1269 | |
1270 (*check_window_system_func) (); | |
1271 | |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1272 fontset = check_fontset_name (name); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1273 |
17052 | 1274 if (NILP (frame)) |
25668
99290b59352d
(Ffont_info): Change for Lisp_Object selected_frame.
Gerd Moellmann <gerd@gnu.org>
parents:
24611
diff
changeset
|
1275 frame = selected_frame; |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40028
diff
changeset
|
1276 CHECK_LIVE_FRAME (frame); |
25668
99290b59352d
(Ffont_info): Change for Lisp_Object selected_frame.
Gerd Moellmann <gerd@gnu.org>
parents:
24611
diff
changeset
|
1277 f = XFRAME (frame); |
17052 | 1278 |
29767
c8e5453dc85d
(FONTSET_ASCII): Use the first element of char table
Kenichi Handa <handa@m17n.org>
parents:
29501
diff
changeset
|
1279 /* Recode realized fontsets whose base is FONTSET in the table |
28963 | 1280 `realized'. */ |
1281 realized = (Lisp_Object *) alloca (sizeof (Lisp_Object) | |
1282 * ASIZE (Vfontset_table)); | |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1283 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
|
1284 { |
28963 | 1285 elt = FONTSET_FROM_ID (i); |
1286 if (!NILP (elt) | |
1287 && EQ (FONTSET_BASE (elt), fontset)) | |
1288 realized[n_realized++] = elt; | |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1289 } |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1290 |
28963 | 1291 /* Accumulate information of the fontset in VAL. The format is |
1292 (LAST FONT-INFO FONT-INFO ...), where FONT-INFO is (CHAR-OR-RANGE | |
1293 FONT-SPEC). See the comment for accumulate_font_info for the | |
1294 detail. */ | |
1295 val = Fcons (Fcons (make_number (0), | |
1296 Fcons (XCDR (FONTSET_ASCII (fontset)), Qnil)), | |
1297 Qnil); | |
1298 val = Fcons (val, val); | |
1299 map_char_table (accumulate_font_info, Qnil, fontset, val, 0, indices); | |
1300 val = XCDR (val); | |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1301 |
28963 | 1302 /* 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
|
1303 character for a charset, replace it with the charset symbol. If |
28963 | 1304 fonts are opened for FONT-SPEC, append the names of the fonts to |
1305 FONT-SPEC. */ | |
1306 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
|
1307 { |
28963 | 1308 int c; |
1309 elt = XCAR (tail); | |
1310 if (INTEGERP (XCAR (elt))) | |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1311 { |
28963 | 1312 int charset, c1, c2; |
1313 c = XINT (XCAR (elt)); | |
1314 SPLIT_CHAR (c, charset, c1, c2); | |
1315 if (c1 == 0) | |
39973
579177964efa
Avoid (most) uses of XCAR/XCDR as lvalues, for flexibility in experimenting
Ken Raeburn <raeburn@raeburn.org>
parents:
37744
diff
changeset
|
1316 XSETCAR (elt, CHARSET_SYMBOL (charset)); |
28963 | 1317 } |
1318 else | |
1319 c = XINT (XCAR (XCAR (elt))); | |
1320 for (i = 0; i < n_realized; i++) | |
1321 { | |
1322 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
|
1323 struct face *face; |
17052 | 1324 |
28963 | 1325 face_id = FONTSET_REF_VIA_BASE (realized[i], c); |
1326 if (INTEGERP (face_id)) | |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1327 { |
28963 | 1328 face = FACE_FROM_ID (f, XINT (face_id)); |
37744
7893c43d43c2
(Ffontset_info): Check that face is non-null
Gerd Moellmann <gerd@gnu.org>
parents:
36759
diff
changeset
|
1329 if (face && face->font && face->font_name) |
28963 | 1330 { |
1331 font = build_string (face->font_name); | |
1332 if (NILP (Fmember (font, XCDR (XCDR (elt))))) | |
39973
579177964efa
Avoid (most) uses of XCAR/XCDR as lvalues, for flexibility in experimenting
Ken Raeburn <raeburn@raeburn.org>
parents:
37744
diff
changeset
|
1333 XSETCDR (XCDR (elt), Fcons (font, XCDR (XCDR (elt)))); |
28963 | 1334 } |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1335 } |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1336 } |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1337 } |
30124
26076259e03f
(Ffontset_info): Make the return value more compatible
Kenichi Handa <handa@m17n.org>
parents:
29767
diff
changeset
|
1338 |
26076259e03f
(Ffontset_info): Make the return value more compatible
Kenichi Handa <handa@m17n.org>
parents:
29767
diff
changeset
|
1339 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
|
1340 if (CONSP (elt)) |
26076259e03f
(Ffontset_info): Make the return value more compatible
Kenichi Handa <handa@m17n.org>
parents:
29767
diff
changeset
|
1341 { |
26076259e03f
(Ffontset_info): Make the return value more compatible
Kenichi Handa <handa@m17n.org>
parents:
29767
diff
changeset
|
1342 elt = XCAR (elt); |
26076259e03f
(Ffontset_info): Make the return value more compatible
Kenichi Handa <handa@m17n.org>
parents:
29767
diff
changeset
|
1343 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
|
1344 } |
26076259e03f
(Ffontset_info): Make the return value more compatible
Kenichi Handa <handa@m17n.org>
parents:
29767
diff
changeset
|
1345 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
|
1346 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
|
1347 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
|
1348 return val; |
17052 | 1349 } |
1350 | |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1351 DEFUN ("fontset-font", Ffontset_font, Sfontset_font, 2, 2, 0, |
41001
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
1352 doc: /* Return a font name pattern for character CH in fontset NAME. |
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
1353 If NAME is t, find a font name pattern in the default fontset. */) |
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
1354 (name, ch) |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1355 Lisp_Object name, ch; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1356 { |
34975
0d69e2d2724e
(fontset_ref): Remove unused variable `i'.
Eli Zaretskii <eliz@gnu.org>
parents:
32978
diff
changeset
|
1357 int c; |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1358 Lisp_Object fontset, elt; |
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 fontset = check_fontset_name (name); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1361 |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40028
diff
changeset
|
1362 CHECK_NUMBER (ch); |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1363 c = XINT (ch); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1364 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
|
1365 invalid_character (c); |
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 elt = FONTSET_REF (fontset, c); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1368 if (CONSP (elt)) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1369 elt = XCDR (elt); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1370 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1371 return elt; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1372 } |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1373 |
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 DEFUN ("fontset-list", Ffontset_list, Sfontset_list, 0, 0, 0, |
41001
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
1376 doc: /* Return a list of all defined fontset names. */) |
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
1377 () |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1378 { |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1379 Lisp_Object fontset, list; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1380 int i; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1381 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1382 list = Qnil; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1383 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
|
1384 { |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1385 fontset = FONTSET_FROM_ID (i); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1386 if (!NILP (fontset) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1387 && BASE_FONTSET_P (fontset)) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1388 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
|
1389 } |
28963 | 1390 |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1391 return list; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1392 } |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1393 |
21514 | 1394 void |
17052 | 1395 syms_of_fontset () |
1396 { | |
1397 if (!load_font_func) | |
1398 /* Window system initializer should have set proper functions. */ | |
1399 abort (); | |
1400 | |
17112
5c48ff325655
(syms_of_fontset): Intern Qfontset. Declare new lisp
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
1401 Qfontset = intern ("fontset"); |
17052 | 1402 staticpro (&Qfontset); |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1403 Fput (Qfontset, Qchar_table_extra_slots, make_number (3)); |
17052 | 1404 |
1405 Vcached_fontset_data = Qnil; | |
1406 staticpro (&Vcached_fontset_data); | |
1407 | |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1408 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
|
1409 staticpro (&Vfontset_table); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1410 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1411 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
|
1412 staticpro (&Vdefault_fontset); |
28963 | 1413 FONTSET_ID (Vdefault_fontset) = make_number (0); |
1414 FONTSET_NAME (Vdefault_fontset) | |
1415 = 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
|
1416 #if defined (macintosh) |
32752
923b8d6d8277
Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
31102
diff
changeset
|
1417 FONTSET_ASCII (Vdefault_fontset) |
923b8d6d8277
Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
31102
diff
changeset
|
1418 = Fcons (make_number (0), |
923b8d6d8277
Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
31102
diff
changeset
|
1419 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
|
1420 #elif defined (WINDOWSNT) |
131348208699
(syms_of_fontset) [WINDOWSNT]: Special case for ASCII font of default
Jason Rumney <jasonr@gnu.org>
parents:
32752
diff
changeset
|
1421 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
|
1422 = Fcons (make_number (0), |
32978
ca33eb68d9da
(syms_of_fontset) [WINDOWSNT]: Make default fontsize on w32 10
Jason Rumney <jasonr@gnu.org>
parents:
32790
diff
changeset
|
1423 build_string ("-*-courier new-normal-r-*-*-*-100-*-*-*-*-iso8859-1")); |
32752
923b8d6d8277
Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
31102
diff
changeset
|
1424 #else |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1425 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
|
1426 = Fcons (make_number (0), |
3c444d185d31
(syms_of_fontset): Adjust the font name for ascii of
Kenichi Handa <handa@m17n.org>
parents:
29011
diff
changeset
|
1427 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
|
1428 #endif |
28963 | 1429 AREF (Vfontset_table, 0) = Vdefault_fontset; |
1430 next_fontset_id = 1; | |
17052 | 1431 |
1432 DEFVAR_LISP ("font-encoding-alist", &Vfont_encoding_alist, | |
41001
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
1433 doc: /* Alist of fontname patterns vs corresponding encoding info. |
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
1434 Each element looks like (REGEXP . ENCODING-INFO), |
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
1435 where ENCODING-INFO is an alist of CHARSET vs ENCODING. |
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
1436 ENCODING is one of the following integer values: |
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
1437 0: code points 0x20..0x7F or 0x2020..0x7F7F are used, |
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
1438 1: code points 0xA0..0xFF or 0xA0A0..0xFFFF are used, |
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
1439 2: code points 0x20A0..0x7FFF are used, |
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
1440 3: code points 0xA020..0xFF7F are used. */); |
17052 | 1441 Vfont_encoding_alist = Qnil; |
1442 | |
17112
5c48ff325655
(syms_of_fontset): Intern Qfontset. Declare new lisp
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
1443 DEFVAR_LISP ("use-default-ascent", &Vuse_default_ascent, |
41001
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
1444 doc: /* Char table of characters whose ascent values should be ignored. |
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
1445 If an entry for a character is non-nil, the ascent value of the glyph |
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
1446 is assumed to be what specified by _MULE_DEFAULT_ASCENT property of a font. |
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
1447 |
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
1448 This affects how a composite character which contains |
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
1449 such a character is displayed on screen. */); |
19282
09a1536debb4
(Vignore_relative_composition): New variable.
Kenichi Handa <handa@m17n.org>
parents:
19172
diff
changeset
|
1450 Vuse_default_ascent = Qnil; |
09a1536debb4
(Vignore_relative_composition): New variable.
Kenichi Handa <handa@m17n.org>
parents:
19172
diff
changeset
|
1451 |
09a1536debb4
(Vignore_relative_composition): New variable.
Kenichi Handa <handa@m17n.org>
parents:
19172
diff
changeset
|
1452 DEFVAR_LISP ("ignore-relative-composition", &Vignore_relative_composition, |
41001
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
1453 doc: /* Char table of characters which is not composed relatively. |
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
1454 If an entry for a character is non-nil, a composition sequence |
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
1455 which contains that character is displayed so that |
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
1456 the glyph of that character is put without considering |
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
1457 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
|
1458 Vignore_relative_composition = Qnil; |
17112
5c48ff325655
(syms_of_fontset): Intern Qfontset. Declare new lisp
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
1459 |
19450
895dc2520755
(Valternate_fontname_alist): Name changed from
Kenichi Handa <handa@m17n.org>
parents:
19282
diff
changeset
|
1460 DEFVAR_LISP ("alternate-fontname-alist", &Valternate_fontname_alist, |
41001
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
1461 doc: /* Alist of fontname vs list of the alternate fontnames. |
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
1462 When a specified font name is not found, the corresponding |
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
1463 alternate fontnames (if any) are tried instead. */); |
19450
895dc2520755
(Valternate_fontname_alist): Name changed from
Kenichi Handa <handa@m17n.org>
parents:
19282
diff
changeset
|
1464 Valternate_fontname_alist = Qnil; |
17193
dc4562b0152a
(Valternative_fontname_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
17190
diff
changeset
|
1465 |
17730
4bbcc6804b5d
(Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
17331
diff
changeset
|
1466 DEFVAR_LISP ("fontset-alias-alist", &Vfontset_alias_alist, |
41001
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
1467 doc: /* Alist of fontset names vs the aliases. */); |
28963 | 1468 Vfontset_alias_alist = Fcons (Fcons (FONTSET_NAME (Vdefault_fontset), |
1469 build_string ("fontset-default")), | |
1470 Qnil); | |
17730
4bbcc6804b5d
(Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
17331
diff
changeset
|
1471 |
17331
f91b4d582897
(Vhighlight_wrong_size_font, Vclip_large_size_font):
Kenichi Handa <handa@m17n.org>
parents:
17193
diff
changeset
|
1472 DEFVAR_LISP ("highlight-wrong-size-font", &Vhighlight_wrong_size_font, |
41001
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
1473 doc: /* *This variable is obsolete. */); |
18976
ebb3e71c6dfd
(syms_of_fontset): Set Vhighlight_wrong_size_font to Qnil.
Kenichi Handa <handa@m17n.org>
parents:
18694
diff
changeset
|
1474 Vhighlight_wrong_size_font = Qnil; |
17331
f91b4d582897
(Vhighlight_wrong_size_font, Vclip_large_size_font):
Kenichi Handa <handa@m17n.org>
parents:
17193
diff
changeset
|
1475 |
f91b4d582897
(Vhighlight_wrong_size_font, Vclip_large_size_font):
Kenichi Handa <handa@m17n.org>
parents:
17193
diff
changeset
|
1476 DEFVAR_LISP ("clip-large-size-font", &Vclip_large_size_font, |
41001
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
1477 doc: /* *This variable is obsolete. */); |
17331
f91b4d582897
(Vhighlight_wrong_size_font, Vclip_large_size_font):
Kenichi Handa <handa@m17n.org>
parents:
17193
diff
changeset
|
1478 Vclip_large_size_font = Qt; |
f91b4d582897
(Vhighlight_wrong_size_font, Vclip_large_size_font):
Kenichi Handa <handa@m17n.org>
parents:
17193
diff
changeset
|
1479 |
26858
7cc081b4e084
(Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents:
26164
diff
changeset
|
1480 DEFVAR_LISP ("vertical-centering-font-regexp", |
7cc081b4e084
(Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents:
26164
diff
changeset
|
1481 &Vvertical_centering_font_regexp, |
41001
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
1482 doc: /* *Regexp matching font names that require vertical centering on display. |
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
1483 When a character is displayed with such fonts, the character is displayed |
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
1484 at the vertival center of lines. */); |
26858
7cc081b4e084
(Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents:
26164
diff
changeset
|
1485 Vvertical_centering_font_regexp = Qnil; |
7cc081b4e084
(Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents:
26164
diff
changeset
|
1486 |
17052 | 1487 defsubr (&Squery_fontset); |
1488 defsubr (&Snew_fontset); | |
1489 defsubr (&Sset_fontset_font); | |
1490 defsubr (&Sfont_info); | |
28963 | 1491 defsubr (&Sinternal_char_font); |
17052 | 1492 defsubr (&Sfontset_info); |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1493 defsubr (&Sfontset_font); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1494 defsubr (&Sfontset_list); |
17052 | 1495 } |