Mercurial > emacs
annotate src/fontset.c @ 91224:3ce31df2ea58
(fontset_find_font): Don't prefer a font of
supplementary charset.
| author | Kenichi Handa <handa@m17n.org> |
|---|---|
| date | Mon, 10 Dec 2007 06:23:41 +0000 |
| parents | 8eb408860621 |
| children | 29d8135e8f58 |
| rev | line source |
|---|---|
| 17052 | 1 /* Fontset handler. |
|
75227
e90d04cd455a
Update copyright for years from Emacs 21 to present (mainly adding
Glenn Morris <rgm@gnu.org>
parents:
74605
diff
changeset
|
2 Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 |
|
e90d04cd455a
Update copyright for years from Emacs 21 to present (mainly adding
Glenn Morris <rgm@gnu.org>
parents:
74605
diff
changeset
|
3 Free Software Foundation, Inc. |
|
74605
6ee41fdd69ff
Update AIST copyright years.
Kenichi Handa <handa@m17n.org>
parents:
71605
diff
changeset
|
4 Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, |
| 75364 | 5 2005, 2006, 2007 |
| 67658 | 6 National Institute of Advanced Industrial Science and Technology (AIST) |
| 7 Registration Number H14PRO021 | |
| 90410 | 8 Copyright (C) 2003, 2006 |
| 88405 | 9 National Institute of Advanced Industrial Science and Technology (AIST) |
| 10 Registration Number H13PRO009 | |
|
90261
7beb78bc1f8e
Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-97
Miles Bader <miles@gnu.org>
diff
changeset
|
11 |
| 17071 | 12 This file is part of GNU Emacs. |
| 13 | |
| 14 GNU Emacs is free software; you can redistribute it and/or modify | |
| 15 it under the terms of the GNU General Public License as published by | |
|
78313
2b9404c2f01f
Remove license from trivial file.
Glenn Morris <rgm@gnu.org>
parents:
75364
diff
changeset
|
16 the Free Software Foundation; either version 3, or (at your option) |
| 17071 | 17 any later version. |
| 17052 | 18 |
| 17071 | 19 GNU Emacs is distributed in the hope that it will be useful, |
| 20 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 22 GNU General Public License for more details. | |
| 17052 | 23 |
| 17071 | 24 You should have received a copy of the GNU General Public License |
| 25 along with GNU Emacs; see the file COPYING. If not, write to | |
| 64084 | 26 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 27 Boston, MA 02110-1301, USA. */ | |
| 17052 | 28 |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
29 /* #define FONTSET_DEBUG */ |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
30 |
| 17052 | 31 #include <config.h> |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
32 |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
33 #ifdef FONTSET_DEBUG |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
34 #include <stdio.h> |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
35 #endif |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
36 |
| 17052 | 37 #include "lisp.h" |
| 88405 | 38 #include "blockinput.h" |
| 28963 | 39 #include "buffer.h" |
| 88405 | 40 #include "character.h" |
| 17052 | 41 #include "charset.h" |
| 42 #include "ccl.h" | |
|
31102
6a0caa788013
Include keyboard.h before frame.h.
Andrew Innes <andrewi@gnu.org>
parents:
30941
diff
changeset
|
43 #include "keyboard.h" |
|
23517
73f09e7bc96e
Include frame.h before fontset.h.
Kenichi Handa <handa@m17n.org>
parents:
22719
diff
changeset
|
44 #include "frame.h" |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
45 #include "dispextern.h" |
| 89865 | 46 #include "intervals.h" |
| 17052 | 47 #include "fontset.h" |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
48 #include "window.h" |
|
52654
2e5944e29aa0
(Finternal_char_font): Change return value to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
49 #ifdef HAVE_X_WINDOWS |
|
2e5944e29aa0
(Finternal_char_font): Change return value to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
50 #include "xterm.h" |
|
2e5944e29aa0
(Finternal_char_font): Change return value to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
51 #endif |
|
2e5944e29aa0
(Finternal_char_font): Change return value to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
52 #ifdef WINDOWSNT |
|
2e5944e29aa0
(Finternal_char_font): Change return value to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
53 #include "w32term.h" |
|
2e5944e29aa0
(Finternal_char_font): Change return value to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
54 #endif |
|
2e5944e29aa0
(Finternal_char_font): Change return value to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
55 #ifdef MAC_OS |
|
2e5944e29aa0
(Finternal_char_font): Change return value to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
56 #include "macterm.h" |
|
2e5944e29aa0
(Finternal_char_font): Change return value to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
57 #endif |
|
82992
5de4189e659d
Got rid of the rif (window-based redisplay interface) global variable.
Karoly Lorentey <lorentey@elte.hu>
parents:
53353
diff
changeset
|
58 #include "termhooks.h" |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
59 |
| 90410 | 60 #include "font.h" |
| 61 | |
| 89483 | 62 #undef xassert |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
63 #ifdef FONTSET_DEBUG |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
64 #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
|
65 #undef INLINE |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
66 #define INLINE |
| 89483 | 67 #else /* not FONTSET_DEBUG */ |
| 68 #define xassert(X) (void) 0 | |
| 69 #endif /* not FONTSET_DEBUG */ | |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
70 |
| 88546 | 71 EXFUN (Fclear_face_cache, 1); |
|
28223
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 /* FONTSET |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
74 |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
75 A fontset is a collection of font related information to give |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
76 similar appearance (style, etc) of characters. A fontset has two |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
77 roles. One is to use for the frame parameter `font' as if it is an |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
78 ASCII font. In that case, Emacs uses the font specified for |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
79 `ascii' script for the frame's default font. |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
80 |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
81 Another role, the more important one, is to provide information |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
82 about which font to use for each non-ASCII character. |
|
41987
34952771ae85
Fix typos, remove unnecessary space.
Pavel Jan?k <Pavel@Janik.cz>
parents:
41052
diff
changeset
|
83 |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
84 There are two kinds of fontsets; base and realized. A base fontset |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
85 is created by `new-fontset' from Emacs Lisp explicitly. A realized |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
86 fontset is created implicitly when a face is realized for ASCII |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
87 characters. A face is also realized for non-ASCII characters based |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
88 on an ASCII face. All of non-ASCII faces based on the same ASCII |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
89 face share the same realized fontset. |
| 89483 | 90 |
| 88405 | 91 A fontset object is implemented by a char-table whose default value |
| 92 and parent are always nil. | |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
93 |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
94 An element of a base fontset is a vector of FONT-DEFs which itself |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
95 is a vector [ FONT-SPEC ENCODING REPERTORY ]. |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
96 |
|
91169
8eb408860621
Include "font.h" unconditionally.
Kenichi Handa <handa@m17n.org>
parents:
91136
diff
changeset
|
97 FONT-SPEC is a font-spec created by `font-spec' or |
|
8eb408860621
Include "font.h" unconditionally.
Kenichi Handa <handa@m17n.org>
parents:
91136
diff
changeset
|
98 ( FAMILY . REGISTRY ) |
| 88405 | 99 or |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
100 FONT-NAME |
|
91169
8eb408860621
Include "font.h" unconditionally.
Kenichi Handa <handa@m17n.org>
parents:
91136
diff
changeset
|
101 where FAMILY, REGISTRY, and FONT-NAME are strings. |
|
89898
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
102 |
|
89826
b17725d55ba2
(Fset_fontset_font): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
89811
diff
changeset
|
103 ENCODING is a charset ID that can convert characters to glyph codes |
|
b17725d55ba2
(Fset_fontset_font): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
89811
diff
changeset
|
104 of the corresponding font. |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
105 |
|
89826
b17725d55ba2
(Fset_fontset_font): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
89811
diff
changeset
|
106 REPERTORY is a charset ID, a char-table, or nil. If REPERTORY is a |
|
b17725d55ba2
(Fset_fontset_font): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
89811
diff
changeset
|
107 charset ID, the repertory of the charset exactly matches with that |
|
b17725d55ba2
(Fset_fontset_font): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
89811
diff
changeset
|
108 of the font. If REPERTORY is a char-table, all characters who have |
|
b17725d55ba2
(Fset_fontset_font): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
89811
diff
changeset
|
109 a non-nil value in the table are supported. If REPERTORY is nil, |
|
b17725d55ba2
(Fset_fontset_font): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
89811
diff
changeset
|
110 we consult with the font itself to get the repertory. |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
111 |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
112 ENCODING and REPERTORY are extracted from the variable |
|
89826
b17725d55ba2
(Fset_fontset_font): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
89811
diff
changeset
|
113 Vfont_encoding_alist by using a font name generated from FONT-SPEC |
|
89898
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
114 (if it is a vector) or FONT-NAME as a matching target. |
|
28223
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 |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
117 An element of a realized fontset is nil or t, or has this form: |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
118 |
|
89898
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
119 [CHARSET-ORDERED-LIST-TICK PREFERRED-CHARSET-ID |
|
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
120 PREFERRED-RFONT-DEF RFONT-DEF0 RFONT-DEF1 ...]. |
| 17052 | 121 |
|
89898
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
122 RFONT-DEFn (i.e. Realized FONT-DEF) has this form: |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
123 |
|
89898
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
124 [ FACE-ID FONT-INDEX FONT-DEF OPENED-FONT-NAME ] |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
125 |
|
89898
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
126 RFONT-DEFn is automatically reordered by the current charset |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
127 priority list. |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
128 |
|
89898
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
129 The value nil means that we have not yet generated the above vector |
|
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
130 from the base of the fontset. |
| 88405 | 131 |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
132 The value t means that no font is available for the corresponding |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
133 range of characters. |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
134 |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
135 |
|
89805
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
136 A fontset has 9 extra slots. |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
137 |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
138 The 1st slot: the ID number of the fontset |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
139 |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
140 The 2nd slot: |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
141 base: the name of the fontset |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
142 realized: nil |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
143 |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
144 The 3rd slot: |
|
89349
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
145 base: nil |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
146 realized: the base fontset |
| 17052 | 147 |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
148 The 4th slot: |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
149 base: nil |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
150 realized: the frame that the fontset belongs to |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
151 |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
152 The 5th slot: |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
153 base: the font name for ASCII characters |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
154 realized: nil |
| 88405 | 155 |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
156 The 6th slot: |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
157 base: nil |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
158 realized: the ID number of a face to use for characters that |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
159 has no font in a realized fontset. |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
160 |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
161 The 7th slot: |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
162 base: nil |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
163 realized: Alist of font index vs the corresponding repertory |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
164 char-table. |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
165 |
|
89349
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
166 The 8th slot: |
|
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
167 base: nil |
|
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
168 realized: If the base is not the default fontset, a fontset |
|
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
169 realized from the default fontset, else nil. |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
170 |
|
89805
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
171 The 9th slot: |
|
89811
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
172 base: Same as element value (but for fallback fonts). |
|
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
173 realized: Likewise. |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
174 |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
175 All fontsets are recorded in the vector Vfontset_table. |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
176 |
|
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 DEFAULT FONTSET |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
179 |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
180 There's a special base fontset named `default fontset' which |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
181 defines the default font specifications. When a base fontset |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
182 doesn't specify a font for a specific character, the corresponding |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
183 value in the default fontset is used. |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
184 |
|
30398
dde5ab185aad
(fontset_ref): Remove INLINE declaration.
Kenichi Handa <handa@m17n.org>
parents:
30172
diff
changeset
|
185 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
|
186 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
|
187 |
|
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 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
|
190 The other codes handle fontsets only by their ID numbers. They |
| 88405 | 191 usually use the variable name `fontset' for IDs. But, in this |
| 192 file, we always use varialbe name `id' for IDs, and name `fontset' | |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
193 for an actual fontset object, i.e., char-table. |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
194 |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
195 */ |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
196 |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
197 /********** VARIABLES and FUNCTION PROTOTYPES **********/ |
|
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 extern Lisp_Object Qfont; |
|
89349
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
200 static Lisp_Object Qfontset; |
|
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
201 static Lisp_Object Qfontset_info; |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
202 static Lisp_Object Qprepend, Qappend; |
| 90642 | 203 static Lisp_Object Qlatin; |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
204 |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
205 /* Vector containing all fontsets. */ |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
206 static Lisp_Object Vfontset_table; |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
207 |
|
41987
34952771ae85
Fix typos, remove unnecessary space.
Pavel Jan?k <Pavel@Janik.cz>
parents:
41052
diff
changeset
|
208 /* Next possibly free fontset ID. Usually this keeps the minimum |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
209 fontset ID not yet used. */ |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
210 static int next_fontset_id; |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
211 |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
212 /* The default fontset. This gives default FAMILY and REGISTRY of |
| 88405 | 213 font for each character. */ |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
214 static Lisp_Object Vdefault_fontset; |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
215 |
| 17052 | 216 Lisp_Object Vfont_encoding_alist; |
|
17112
5c48ff325655
(syms_of_fontset): Intern Qfontset. Declare new lisp
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
217 Lisp_Object Vuse_default_ascent; |
|
19282
09a1536debb4
(Vignore_relative_composition): New variable.
Kenichi Handa <handa@m17n.org>
parents:
19172
diff
changeset
|
218 Lisp_Object Vignore_relative_composition; |
|
19450
895dc2520755
(Valternate_fontname_alist): Name changed from
Kenichi Handa <handa@m17n.org>
parents:
19282
diff
changeset
|
219 Lisp_Object Valternate_fontname_alist; |
|
17730
4bbcc6804b5d
(Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
17331
diff
changeset
|
220 Lisp_Object Vfontset_alias_alist; |
|
26858
7cc081b4e084
(Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents:
26164
diff
changeset
|
221 Lisp_Object Vvertical_centering_font_regexp; |
|
90509
c1ec6b950928
(Votf_script_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90475
diff
changeset
|
222 Lisp_Object Votf_script_alist; |
| 17052 | 223 |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
224 /* 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
|
225 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
|
226 detail. */ |
| 17052 | 227 |
| 228 /* 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
|
229 struct font_info *(*get_font_info_func) P_ ((FRAME_PTR f, int font_idx)); |
| 17052 | 230 |
|
41987
34952771ae85
Fix typos, remove unnecessary space.
Pavel Jan?k <Pavel@Janik.cz>
parents:
41052
diff
changeset
|
231 /* Return a list of font names which matches PATTERN. See the documentation |
|
34952771ae85
Fix typos, remove unnecessary space.
Pavel Jan?k <Pavel@Janik.cz>
parents:
41052
diff
changeset
|
232 of `x-list-fonts' for more details. */ |
|
23517
73f09e7bc96e
Include frame.h before fontset.h.
Kenichi Handa <handa@m17n.org>
parents:
22719
diff
changeset
|
233 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
|
234 Lisp_Object pattern, |
|
73f09e7bc96e
Include frame.h before fontset.h.
Kenichi Handa <handa@m17n.org>
parents:
22719
diff
changeset
|
235 int size, |
|
73f09e7bc96e
Include frame.h before fontset.h.
Kenichi Handa <handa@m17n.org>
parents:
22719
diff
changeset
|
236 int maxnames)); |
| 17052 | 237 |
| 238 /* Load a font named NAME for frame F and return a pointer to the | |
| 239 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
|
240 struct font_info *(*load_font_func) P_ ((FRAME_PTR f, char *name, int)); |
| 17052 | 241 |
| 242 /* 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
|
243 struct font_info *(*query_font_func) P_ ((FRAME_PTR f, char *name)); |
| 17052 | 244 |
| 245 /* Additional function for setting fontset or changing fontset | |
| 246 contents of frame F. */ | |
|
20315
931b4ddf7966
Protoize functions declarations.
Andreas Schwab <schwab@suse.de>
parents:
19450
diff
changeset
|
247 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
|
248 Lisp_Object oldval)); |
| 17052 | 249 |
|
21553
2d7afcd11b72
(find_ccl_program_func): New variable.
Kenichi Handa <handa@m17n.org>
parents:
21514
diff
changeset
|
250 /* 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
|
251 The argument is a pointer to the struct font_info. |
|
41987
34952771ae85
Fix typos, remove unnecessary space.
Pavel Jan?k <Pavel@Janik.cz>
parents:
41052
diff
changeset
|
252 This function set the member `encoder' of the structure. */ |
|
21553
2d7afcd11b72
(find_ccl_program_func): New variable.
Kenichi Handa <handa@m17n.org>
parents:
21514
diff
changeset
|
253 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
|
254 |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
255 Lisp_Object (*get_font_repertory_func) P_ ((struct frame *, |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
256 struct font_info *)); |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
257 |
| 17052 | 258 /* Check if any window system is used now. */ |
|
20315
931b4ddf7966
Protoize functions declarations.
Andreas Schwab <schwab@suse.de>
parents:
19450
diff
changeset
|
259 void (*check_window_system_func) P_ ((void)); |
| 17052 | 260 |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
261 |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
262 /* Prototype declarations for static functions. */ |
|
89069
c2201502f37e
(fontset_add): Return Lisp_Object.
Dave Love <fx@gnu.org>
parents:
89006
diff
changeset
|
263 static Lisp_Object fontset_add P_ ((Lisp_Object, Lisp_Object, Lisp_Object, |
|
c2201502f37e
(fontset_add): Return Lisp_Object.
Dave Love <fx@gnu.org>
parents:
89006
diff
changeset
|
264 Lisp_Object)); |
|
89898
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
265 static Lisp_Object fontset_font P_ ((Lisp_Object, int, struct face *, int)); |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
266 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
|
267 static Lisp_Object fontset_pattern_regexp P_ ((Lisp_Object)); |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
268 static void accumulate_script_ranges P_ ((Lisp_Object, Lisp_Object, |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
269 Lisp_Object)); |
| 90410 | 270 Lisp_Object find_font_encoding P_ ((Lisp_Object)); |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
271 |
|
89614
355fc0282e50
(set_fontset_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
89610
diff
changeset
|
272 static void set_fontset_font P_ ((Lisp_Object, Lisp_Object)); |
|
355fc0282e50
(set_fontset_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
89610
diff
changeset
|
273 |
|
88982
d50b0a9ea97a
(fontset_add): Make the type `int'.
Kenichi Handa <handa@m17n.org>
parents:
88968
diff
changeset
|
274 #ifdef FONTSET_DEBUG |
|
d50b0a9ea97a
(fontset_add): Make the type `int'.
Kenichi Handa <handa@m17n.org>
parents:
88968
diff
changeset
|
275 |
|
d50b0a9ea97a
(fontset_add): Make the type `int'.
Kenichi Handa <handa@m17n.org>
parents:
88968
diff
changeset
|
276 /* Return 1 if ID is a valid fontset id, else return 0. */ |
|
d50b0a9ea97a
(fontset_add): Make the type `int'.
Kenichi Handa <handa@m17n.org>
parents:
88968
diff
changeset
|
277 |
|
d50b0a9ea97a
(fontset_add): Make the type `int'.
Kenichi Handa <handa@m17n.org>
parents:
88968
diff
changeset
|
278 static int |
|
d50b0a9ea97a
(fontset_add): Make the type `int'.
Kenichi Handa <handa@m17n.org>
parents:
88968
diff
changeset
|
279 fontset_id_valid_p (id) |
|
d50b0a9ea97a
(fontset_add): Make the type `int'.
Kenichi Handa <handa@m17n.org>
parents:
88968
diff
changeset
|
280 int id; |
|
d50b0a9ea97a
(fontset_add): Make the type `int'.
Kenichi Handa <handa@m17n.org>
parents:
88968
diff
changeset
|
281 { |
|
d50b0a9ea97a
(fontset_add): Make the type `int'.
Kenichi Handa <handa@m17n.org>
parents:
88968
diff
changeset
|
282 return (id >= 0 && id < ASIZE (Vfontset_table) - 1); |
|
d50b0a9ea97a
(fontset_add): Make the type `int'.
Kenichi Handa <handa@m17n.org>
parents:
88968
diff
changeset
|
283 } |
|
d50b0a9ea97a
(fontset_add): Make the type `int'.
Kenichi Handa <handa@m17n.org>
parents:
88968
diff
changeset
|
284 |
|
d50b0a9ea97a
(fontset_add): Make the type `int'.
Kenichi Handa <handa@m17n.org>
parents:
88968
diff
changeset
|
285 #endif |
|
d50b0a9ea97a
(fontset_add): Make the type `int'.
Kenichi Handa <handa@m17n.org>
parents:
88968
diff
changeset
|
286 |
|
28223
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 |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
289 /********** 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
|
290 |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
291 /* 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
|
292 #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
|
293 |
|
30398
dde5ab185aad
(fontset_ref): Remove INLINE declaration.
Kenichi Handa <handa@m17n.org>
parents:
30172
diff
changeset
|
294 /* 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
|
295 #define FONTSET_ID(fontset) XCHAR_TABLE (fontset)->extras[0] |
| 88405 | 296 |
| 297 /* Macros to access special values of (base) FONTSET. */ | |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
298 #define FONTSET_NAME(fontset) XCHAR_TABLE (fontset)->extras[1] |
| 88405 | 299 #define FONTSET_ASCII(fontset) XCHAR_TABLE (fontset)->extras[4] |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
300 |
| 88405 | 301 /* Macros to access special values of (realized) FONTSET. */ |
| 302 #define FONTSET_BASE(fontset) XCHAR_TABLE (fontset)->extras[2] | |
| 303 #define FONTSET_FRAME(fontset) XCHAR_TABLE (fontset)->extras[3] | |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
304 #define FONTSET_NOFONT_FACE(fontset) XCHAR_TABLE (fontset)->extras[5] |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
305 #define FONTSET_REPERTORY(fontset) XCHAR_TABLE (fontset)->extras[6] |
|
89805
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
306 #define FONTSET_DEFAULT(fontset) XCHAR_TABLE (fontset)->extras[7] |
|
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
307 |
|
89811
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
308 /* For both base and realized fontset. */ |
|
89805
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
309 #define FONTSET_FALLBACK(fontset) XCHAR_TABLE (fontset)->extras[8] |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
310 |
|
89428
eed327e0bad3
(BASE_FONTSET_P): Check FONTSET_BASE, not
Kenichi Handa <handa@m17n.org>
parents:
89349
diff
changeset
|
311 #define BASE_FONTSET_P(fontset) (NILP (FONTSET_BASE (fontset))) |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
312 |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
313 |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
314 /* Return the element of FONTSET for the character C. If FONTSET is a |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
315 base fontset other then the default fontset and FONTSET doesn't |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
316 contain information for C, return the information in the default |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
317 fontset. */ |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
318 |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
319 #define FONTSET_REF(fontset, c) \ |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
320 (EQ (fontset, Vdefault_fontset) \ |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
321 ? CHAR_TABLE_REF (fontset, c) \ |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
322 : fontset_ref ((fontset), (c))) |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
323 |
|
30398
dde5ab185aad
(fontset_ref): Remove INLINE declaration.
Kenichi Handa <handa@m17n.org>
parents:
30172
diff
changeset
|
324 static Lisp_Object |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
325 fontset_ref (fontset, c) |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
326 Lisp_Object fontset; |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
327 int c; |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
328 { |
| 88405 | 329 Lisp_Object elt; |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
330 |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
331 elt = CHAR_TABLE_REF (fontset, c); |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
332 if (NILP (elt) && ! EQ (fontset, Vdefault_fontset) |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
333 /* Don't check Vdefault_fontset for a realized fontset. */ |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
334 && NILP (FONTSET_BASE (fontset))) |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
335 elt = CHAR_TABLE_REF (Vdefault_fontset, c); |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
336 return elt; |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
337 } |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
338 |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
339 |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
340 /* Return the element of FONTSET for the character C, set FROM and TO |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
341 to the range of characters around C that have the same value as C. |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
342 If FONTSET is a base fontset other then the default fontset and |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
343 FONTSET doesn't contain information for C, return the information |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
344 in the default fontset. */ |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
345 |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
346 #define FONTSET_REF_AND_RANGE(fontset, c, form, to) \ |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
347 (EQ (fontset, Vdefault_fontset) \ |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
348 ? char_table_ref_and_range (fontset, c, &from, &to) \ |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
349 : fontset_ref_and_range (fontset, c, &from, &to)) |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
350 |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
351 static Lisp_Object |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
352 fontset_ref_and_range (fontset, c, from, to) |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
353 Lisp_Object fontset; |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
354 int c; |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
355 int *from, *to; |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
356 { |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
357 Lisp_Object elt; |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
358 |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
359 elt = char_table_ref_and_range (fontset, c, from, to); |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
360 if (NILP (elt) && ! EQ (fontset, Vdefault_fontset) |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
361 /* Don't check Vdefault_fontset for a realized fontset. */ |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
362 && NILP (FONTSET_BASE (fontset))) |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
363 { |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
364 int from1, to1; |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
365 |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
366 elt = char_table_ref_and_range (Vdefault_fontset, c, &from1, &to1); |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
367 if (*from < from1) |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
368 *from = from1; |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
369 if (*to > to1) |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
370 *to = to1; |
| 88405 | 371 } |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
372 return elt; |
|
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 |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
375 |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
376 /* Set elements of FONTSET for characters in RANGE to the value ELT. |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
377 RANGE is a cons (FROM . TO), where FROM and TO are character codes |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
378 specifying a range. */ |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
379 |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
380 #define FONTSET_SET(fontset, range, elt) \ |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
381 Fset_char_table_range ((fontset), (range), (elt)) |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
382 |
|
53353
b085f18ebcf0
(Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
53072
diff
changeset
|
383 |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
384 /* Modify the elements of FONTSET for characters in RANGE by replacing |
|
89699
cda6f41a592e
(reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
89687
diff
changeset
|
385 with ELT or adding ELT. RANGE is a cons (FROM . TO), where FROM |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
386 and TO are character codes specifying a range. If ADD is nil, |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
387 replace with ELT, if ADD is `prepend', prepend ELT, otherwise, |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
388 append ELT. */ |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
389 |
|
89811
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
390 #define FONTSET_ADD(fontset, range, elt, add) \ |
|
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
391 (NILP (add) \ |
|
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
392 ? (NILP (range) \ |
|
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
393 ? (FONTSET_FALLBACK (fontset) = Fmake_vector (make_number (1), (elt))) \ |
|
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
394 : Fset_char_table_range ((fontset), (range), \ |
|
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
395 Fmake_vector (make_number (1), (elt)))) \ |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
396 : fontset_add ((fontset), (range), (elt), (add))) |
|
53353
b085f18ebcf0
(Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
53072
diff
changeset
|
397 |
|
89069
c2201502f37e
(fontset_add): Return Lisp_Object.
Dave Love <fx@gnu.org>
parents:
89006
diff
changeset
|
398 static Lisp_Object |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
399 fontset_add (fontset, range, elt, add) |
|
88931
74d18470865c
(fontset_add): Declare args. Call make_number
Dave Love <fx@gnu.org>
parents:
88903
diff
changeset
|
400 Lisp_Object fontset, range, elt, add; |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
401 { |
|
89805
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
402 Lisp_Object args[2]; |
|
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
403 int idx = (EQ (add, Qappend) ? 0 : 1); |
|
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
404 |
|
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
405 args[1 - idx] = Fmake_vector (make_number (1), elt); |
|
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
406 |
|
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
407 if (CONSP (range)) |
|
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
408 { |
|
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
409 int from = XINT (XCAR (range)); |
|
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
410 int to = XINT (XCDR (range)); |
|
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
411 int from1, to1; |
| 89483 | 412 |
|
89805
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
413 do { |
|
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
414 args[idx] = char_table_ref_and_range (fontset, from, &from1, &to1); |
|
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
415 if (to < to1) |
|
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
416 to1 = to; |
|
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
417 char_table_set_range (fontset, from, to1, |
|
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
418 NILP (args[idx]) ? args[1 - idx] |
|
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
419 : Fvconcat (2, args)); |
|
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
420 from = to1 + 1; |
|
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
421 } while (from < to); |
|
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
422 } |
|
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
423 else |
|
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
424 { |
|
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
425 args[idx] = FONTSET_FALLBACK (fontset); |
|
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
426 FONTSET_FALLBACK (fontset) |
|
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
427 = NILP (args[idx]) ? args[1 - idx] : Fvconcat (2, args); |
|
53353
b085f18ebcf0
(Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
53072
diff
changeset
|
428 } |
|
b085f18ebcf0
(Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
53072
diff
changeset
|
429 return Qnil; |
|
b085f18ebcf0
(Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
53072
diff
changeset
|
430 } |
|
b085f18ebcf0
(Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
53072
diff
changeset
|
431 |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
432 |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
433 /* Update FONTSET_ELEMENT which has this form: |
|
89898
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
434 [CHARSET-ORDERED-LIST-TICK PREFERRED-CHARSET-ID PREFERRED-RFONT-DEF |
|
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
435 RFONT-DEF0 RFONT-DEF1 ...]. |
|
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
436 Reorder RFONT-DEFs according to the current order of charset |
|
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
437 (Vcharset_ordered_list), and update CHARSET-ORDERED-LIST-TICK to |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
438 the latest value. */ |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
439 |
| 88405 | 440 static void |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
441 reorder_font_vector (fontset_element) |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
442 Lisp_Object fontset_element; |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
443 { |
|
89940
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
444 Lisp_Object list, *new_vec; |
|
89699
cda6f41a592e
(reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
89687
diff
changeset
|
445 Lisp_Object font_def; |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
446 int size; |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
447 int *charset_id_table; |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
448 int i, idx; |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
449 |
|
89699
cda6f41a592e
(reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
89687
diff
changeset
|
450 ASET (fontset_element, 0, make_number (charset_ordered_list_tick)); |
|
cda6f41a592e
(reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
89687
diff
changeset
|
451 size = ASIZE (fontset_element) - 3; |
|
cda6f41a592e
(reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
89687
diff
changeset
|
452 if (size <= 1) |
|
89898
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
453 /* No need to reorder VEC. */ |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
454 return; |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
455 charset_id_table = (int *) alloca (sizeof (int) * size); |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
456 new_vec = (Lisp_Object *) alloca (sizeof (Lisp_Object) * size); |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
457 |
|
89699
cda6f41a592e
(reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
89687
diff
changeset
|
458 /* At first, extract ENCODING (a chaset ID) from each FONT-DEF. |
|
cda6f41a592e
(reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
89687
diff
changeset
|
459 FONT-DEF has this form: |
|
cda6f41a592e
(reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
89687
diff
changeset
|
460 [FACE-ID FONT-INDEX [ FONT-SPEC ENCODING REPERTORY ]] */ |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
461 for (i = 0; i < size; i++) |
|
89699
cda6f41a592e
(reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
89687
diff
changeset
|
462 { |
|
cda6f41a592e
(reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
89687
diff
changeset
|
463 font_def = AREF (fontset_element, i + 3); |
|
90821
5346cefbb15b
(reorder_font_vector): Check contents of font_def.
Kenichi Handa <handa@m17n.org>
parents:
90818
diff
changeset
|
464 if (VECTORP (AREF (font_def, 2)) |
|
5346cefbb15b
(reorder_font_vector): Check contents of font_def.
Kenichi Handa <handa@m17n.org>
parents:
90818
diff
changeset
|
465 && INTEGERP (AREF (AREF (font_def, 2), 1))) |
|
90440
33277d7748f3
(reorder_font_vector): Pay attention to the case that
Kenichi Handa <handa@m17n.org>
parents:
90410
diff
changeset
|
466 charset_id_table[i] = XINT (AREF (AREF (font_def, 2), 1)); |
|
33277d7748f3
(reorder_font_vector): Pay attention to the case that
Kenichi Handa <handa@m17n.org>
parents:
90410
diff
changeset
|
467 else |
|
33277d7748f3
(reorder_font_vector): Pay attention to the case that
Kenichi Handa <handa@m17n.org>
parents:
90410
diff
changeset
|
468 charset_id_table[i] = -1; |
|
89699
cda6f41a592e
(reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
89687
diff
changeset
|
469 } |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
470 |
|
89699
cda6f41a592e
(reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
89687
diff
changeset
|
471 /* Then, store FONT-DEFs in NEW_VEC in the correct order. */ |
|
cda6f41a592e
(reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
89687
diff
changeset
|
472 for (idx = 0, list = Vcharset_ordered_list; |
|
cda6f41a592e
(reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
89687
diff
changeset
|
473 idx < size && CONSP (list); list = XCDR (list)) |
| 88405 | 474 { |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
475 for (i = 0; i < size; i++) |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
476 if (charset_id_table[i] == XINT (XCAR (list))) |
|
89699
cda6f41a592e
(reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
89687
diff
changeset
|
477 new_vec[idx++] = AREF (fontset_element, i + 3); |
| 88405 | 478 } |
|
90440
33277d7748f3
(reorder_font_vector): Pay attention to the case that
Kenichi Handa <handa@m17n.org>
parents:
90410
diff
changeset
|
479 for (i = 0; i < size; i++) |
|
33277d7748f3
(reorder_font_vector): Pay attention to the case that
Kenichi Handa <handa@m17n.org>
parents:
90410
diff
changeset
|
480 if (charset_id_table[i] < 0) |
|
33277d7748f3
(reorder_font_vector): Pay attention to the case that
Kenichi Handa <handa@m17n.org>
parents:
90410
diff
changeset
|
481 new_vec[idx++] = AREF (fontset_element, i + 3); |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
482 |
|
89699
cda6f41a592e
(reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
89687
diff
changeset
|
483 /* At last, update FONT-DEFs. */ |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
484 for (i = 0; i < size; i++) |
|
89699
cda6f41a592e
(reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
89687
diff
changeset
|
485 ASET (fontset_element, i + 3, new_vec[i]); |
|
28223
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 |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
488 |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
489 /* Load a font matching the font related attributes in FACE->lface and |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
490 font pattern in FONT_DEF of FONTSET, and return an index of the |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
491 font. FONT_DEF has this form: |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
492 [ FONT-SPEC ENCODING REPERTORY ] |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
493 If REPERTORY is nil, generate a char-table representing the font |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
494 repertory by looking into the font itself. */ |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
495 |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
496 static int |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
497 load_font_get_repertory (f, face, font_def, fontset) |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
498 FRAME_PTR f; |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
499 struct face *face; |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
500 Lisp_Object font_def; |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
501 Lisp_Object fontset; |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
502 { |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
503 char *font_name; |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
504 struct font_info *font_info; |
|
89572
971778c2578c
(load_font_get_repertory): Pay attention to the case
Kenichi Handa <handa@m17n.org>
parents:
89483
diff
changeset
|
505 int charset; |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
506 |
| 89483 | 507 font_name = choose_face_font (f, face->lface, AREF (font_def, 0), NULL); |
|
89901
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
508 charset = XINT (AREF (font_def, 1)); |
|
89572
971778c2578c
(load_font_get_repertory): Pay attention to the case
Kenichi Handa <handa@m17n.org>
parents:
89483
diff
changeset
|
509 if (! (font_info = fs_load_font (f, font_name, charset))) |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
510 return -1; |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
511 |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
512 if (NILP (AREF (font_def, 2)) |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
513 && NILP (Fassq (make_number (font_info->font_idx), |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
514 FONTSET_REPERTORY (fontset)))) |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
515 { |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
516 /* We must look into the font to get the correct repertory as a |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
517 char-table. */ |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
518 Lisp_Object repertory; |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
519 |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
520 repertory = (*get_font_repertory_func) (f, font_info); |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
521 FONTSET_REPERTORY (fontset) |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
522 = Fcons (Fcons (make_number (font_info->font_idx), repertory), |
| 89483 | 523 FONTSET_REPERTORY (fontset)); |
| 88405 | 524 } |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
525 |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
526 return font_info->font_idx; |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
527 } |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
528 |
|
90802
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
529 static Lisp_Object fontset_find_font P_ ((Lisp_Object, int, struct face *, |
|
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
530 int, int)); |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
531 |
|
89898
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
532 /* Return RFONT-DEF (vector) in the realized fontset FONTSET for the |
|
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
533 character C. If the corresponding font is not yet opened, open it |
|
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
534 (if FACE is not NULL) or return Qnil (if FACE is NULL). |
|
90802
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
535 If no proper font is found for C, return Qnil. |
|
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
536 ID is a charset-id that must be preferred, or -1 meaning no |
|
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
537 preference. |
|
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
538 If FALLBACK if nonzero, search only fallback fonts. */ |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
539 |
|
89898
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
540 static Lisp_Object |
|
90802
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
541 fontset_find_font (fontset, c, face, id, fallback) |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
542 Lisp_Object fontset; |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
543 int c; |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
544 struct face *face; |
|
90802
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
545 int id, fallback; |
| 17052 | 546 { |
|
90821
5346cefbb15b
(reorder_font_vector): Check contents of font_def.
Kenichi Handa <handa@m17n.org>
parents:
90818
diff
changeset
|
547 Lisp_Object base_fontset, elt, vec, font_def; |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
548 int i, from, to; |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
549 int font_idx; |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
550 FRAME_PTR f = XFRAME (FONTSET_FRAME (fontset)); |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
551 |
|
89349
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
552 base_fontset = FONTSET_BASE (fontset); |
|
90802
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
553 if (! fallback) |
|
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
554 vec = CHAR_TABLE_REF (fontset, c); |
|
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
555 else |
|
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
556 vec = FONTSET_FALLBACK (fontset); |
|
89811
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
557 if (NILP (vec)) |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
558 { |
|
90802
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
559 /* We have not yet decided a font for C. */ |
|
89349
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
560 Lisp_Object range; |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
561 |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
562 if (! face) |
|
89898
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
563 return Qnil; |
|
90802
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
564 if (! fallback) |
|
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
565 elt = FONTSET_REF_AND_RANGE (base_fontset, c, from, to); |
|
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
566 else |
|
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
567 elt = FONTSET_FALLBACK (base_fontset); |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
568 range = Fcons (make_number (from), make_number (to)); |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
569 if (NILP (elt)) |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
570 { |
|
90802
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
571 /* Qt means we have no font for characters of this range. */ |
|
89811
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
572 vec = Qt; |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
573 } |
|
90440
33277d7748f3
(reorder_font_vector): Pay attention to the case that
Kenichi Handa <handa@m17n.org>
parents:
90410
diff
changeset
|
574 else |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
575 { |
|
90802
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
576 /* Build a vector [ -1 -1 nil NEW-ELT0 NEW-ELT1 NEW-ELT2 ... ], |
|
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
577 where the first -1 is to force reordering of NEW-ELTn, |
|
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
578 NEW-ELTn is [nil nil AREF (elt, n) nil]. */ |
| 90410 | 579 #ifdef USE_FONT_BACKEND |
|
90802
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
580 if (! fallback |
|
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
581 && enable_font_backend |
|
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
582 && EQ (base_fontset, Vdefault_fontset)) |
|
90818
c307aa794b2d
(fontset_find_font): Pay attention to font size
Kenichi Handa <handa@m17n.org>
parents:
90806
diff
changeset
|
583 /* Extra one element is for an automatically added |
|
c307aa794b2d
(fontset_find_font): Pay attention to font size
Kenichi Handa <handa@m17n.org>
parents:
90806
diff
changeset
|
584 font-def specifying only a script. */ |
|
90802
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
585 vec = Fmake_vector (make_number (ASIZE (elt) + 4), Qnil); |
| 90410 | 586 else |
|
90802
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
587 #endif /* not USE_FONT_BACKEND */ |
|
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
588 vec = Fmake_vector (make_number (ASIZE (elt) + 3), Qnil); |
|
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
589 ASET (vec, 0, make_number (-1)); |
|
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
590 ASET (vec, 1, make_number (-1)); |
|
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
591 for (i = 0; i < ASIZE (elt); i++) |
|
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
592 { |
|
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
593 Lisp_Object tmp; |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
594 |
|
90802
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
595 tmp = Fmake_vector (make_number (5), Qnil); |
|
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
596 ASET (tmp, 2, AREF (elt, i)); |
|
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
597 ASET (vec, 3 + i, tmp); |
|
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
598 } |
|
90440
33277d7748f3
(reorder_font_vector): Pay attention to the case that
Kenichi Handa <handa@m17n.org>
parents:
90410
diff
changeset
|
599 #ifdef USE_FONT_BACKEND |
|
90802
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
600 if (! fallback |
|
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
601 && enable_font_backend |
|
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
602 && EQ (base_fontset, Vdefault_fontset)) |
|
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
603 { |
|
90821
5346cefbb15b
(reorder_font_vector): Check contents of font_def.
Kenichi Handa <handa@m17n.org>
parents:
90818
diff
changeset
|
604 Lisp_Object script, font_spec; |
|
90440
33277d7748f3
(reorder_font_vector): Pay attention to the case that
Kenichi Handa <handa@m17n.org>
parents:
90410
diff
changeset
|
605 |
|
90802
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
606 script = CHAR_TABLE_REF (Vchar_script_table, c); |
|
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
607 if (NILP (script)) |
|
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
608 script = intern ("latin"); |
|
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
609 font_spec = Ffont_spec (0, NULL); |
|
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
610 ASET (font_spec, FONT_REGISTRY_INDEX, Qiso10646_1); |
|
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
611 ASET (font_spec, FONT_EXTRA_INDEX, |
|
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
612 Fcons (Fcons (QCscript, script), Qnil)); |
|
90821
5346cefbb15b
(reorder_font_vector): Check contents of font_def.
Kenichi Handa <handa@m17n.org>
parents:
90818
diff
changeset
|
613 font_def = Fmake_vector (make_number (3), Qnil); |
|
5346cefbb15b
(reorder_font_vector): Check contents of font_def.
Kenichi Handa <handa@m17n.org>
parents:
90818
diff
changeset
|
614 ASET (font_def, 0, font_spec); |
|
5346cefbb15b
(reorder_font_vector): Check contents of font_def.
Kenichi Handa <handa@m17n.org>
parents:
90818
diff
changeset
|
615 elt = Fmake_vector (make_number (5), Qnil); |
|
5346cefbb15b
(reorder_font_vector): Check contents of font_def.
Kenichi Handa <handa@m17n.org>
parents:
90818
diff
changeset
|
616 ASET (elt, 2, font_def); |
|
5346cefbb15b
(reorder_font_vector): Check contents of font_def.
Kenichi Handa <handa@m17n.org>
parents:
90818
diff
changeset
|
617 ASET (vec, 3 + i, elt); |
|
90802
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
618 } |
|
90440
33277d7748f3
(reorder_font_vector): Pay attention to the case that
Kenichi Handa <handa@m17n.org>
parents:
90410
diff
changeset
|
619 #endif /* USE_FONT_BACKEND */ |
|
33277d7748f3
(reorder_font_vector): Pay attention to the case that
Kenichi Handa <handa@m17n.org>
parents:
90410
diff
changeset
|
620 |
|
90802
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
621 /* Then store it in the fontset. */ |
|
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
622 if (! fallback) |
|
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
623 FONTSET_SET (fontset, range, vec); |
|
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
624 else |
|
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
625 FONTSET_FALLBACK (fontset) = vec; |
|
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
626 } |
|
89699
cda6f41a592e
(reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
89687
diff
changeset
|
627 } |
|
90802
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
628 if (EQ (vec, Qt)) |
|
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
629 return Qnil; |
|
89699
cda6f41a592e
(reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
89687
diff
changeset
|
630 |
|
cda6f41a592e
(reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
89687
diff
changeset
|
631 if (XINT (AREF (vec, 0)) != charset_ordered_list_tick) |
|
cda6f41a592e
(reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
89687
diff
changeset
|
632 /* The priority of charsets is changed after we selected a face |
|
cda6f41a592e
(reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
89687
diff
changeset
|
633 for C last time. */ |
|
cda6f41a592e
(reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
89687
diff
changeset
|
634 reorder_font_vector (vec); |
|
cda6f41a592e
(reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
89687
diff
changeset
|
635 |
|
cda6f41a592e
(reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
89687
diff
changeset
|
636 if (id < 0) |
|
cda6f41a592e
(reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
89687
diff
changeset
|
637 i = 3; |
|
cda6f41a592e
(reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
89687
diff
changeset
|
638 else |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
639 { |
|
91224
3ce31df2ea58
(fontset_find_font): Don't prefer a font of
Kenichi Handa <handa@m17n.org>
parents:
91169
diff
changeset
|
640 struct charset *charset = CHARSET_FROM_ID (id); |
|
3ce31df2ea58
(fontset_find_font): Don't prefer a font of
Kenichi Handa <handa@m17n.org>
parents:
91169
diff
changeset
|
641 |
|
3ce31df2ea58
(fontset_find_font): Don't prefer a font of
Kenichi Handa <handa@m17n.org>
parents:
91169
diff
changeset
|
642 if (charset->supplementary_p) |
|
3ce31df2ea58
(fontset_find_font): Don't prefer a font of
Kenichi Handa <handa@m17n.org>
parents:
91169
diff
changeset
|
643 i = 3; |
|
3ce31df2ea58
(fontset_find_font): Don't prefer a font of
Kenichi Handa <handa@m17n.org>
parents:
91169
diff
changeset
|
644 else if (id == XFASTINT (AREF (vec, 1))) |
|
3ce31df2ea58
(fontset_find_font): Don't prefer a font of
Kenichi Handa <handa@m17n.org>
parents:
91169
diff
changeset
|
645 i = 2; |
|
89699
cda6f41a592e
(reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
89687
diff
changeset
|
646 else |
|
cda6f41a592e
(reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
89687
diff
changeset
|
647 { |
|
91224
3ce31df2ea58
(fontset_find_font): Don't prefer a font of
Kenichi Handa <handa@m17n.org>
parents:
91169
diff
changeset
|
648 ASET (vec, 1, make_number (id)); |
|
3ce31df2ea58
(fontset_find_font): Don't prefer a font of
Kenichi Handa <handa@m17n.org>
parents:
91169
diff
changeset
|
649 for (i = 3; i < ASIZE (vec); i++) |
|
3ce31df2ea58
(fontset_find_font): Don't prefer a font of
Kenichi Handa <handa@m17n.org>
parents:
91169
diff
changeset
|
650 if (id == XFASTINT (AREF (AREF (AREF (vec, i), 2), 1))) |
|
3ce31df2ea58
(fontset_find_font): Don't prefer a font of
Kenichi Handa <handa@m17n.org>
parents:
91169
diff
changeset
|
651 break; |
|
3ce31df2ea58
(fontset_find_font): Don't prefer a font of
Kenichi Handa <handa@m17n.org>
parents:
91169
diff
changeset
|
652 if (i < ASIZE (vec)) |
|
3ce31df2ea58
(fontset_find_font): Don't prefer a font of
Kenichi Handa <handa@m17n.org>
parents:
91169
diff
changeset
|
653 { |
|
3ce31df2ea58
(fontset_find_font): Don't prefer a font of
Kenichi Handa <handa@m17n.org>
parents:
91169
diff
changeset
|
654 ASET (vec, 2, AREF (vec, i)); |
|
3ce31df2ea58
(fontset_find_font): Don't prefer a font of
Kenichi Handa <handa@m17n.org>
parents:
91169
diff
changeset
|
655 i = 2; |
|
3ce31df2ea58
(fontset_find_font): Don't prefer a font of
Kenichi Handa <handa@m17n.org>
parents:
91169
diff
changeset
|
656 } |
|
3ce31df2ea58
(fontset_find_font): Don't prefer a font of
Kenichi Handa <handa@m17n.org>
parents:
91169
diff
changeset
|
657 else |
|
3ce31df2ea58
(fontset_find_font): Don't prefer a font of
Kenichi Handa <handa@m17n.org>
parents:
91169
diff
changeset
|
658 { |
|
3ce31df2ea58
(fontset_find_font): Don't prefer a font of
Kenichi Handa <handa@m17n.org>
parents:
91169
diff
changeset
|
659 ASET (vec, 2, Qnil); |
|
3ce31df2ea58
(fontset_find_font): Don't prefer a font of
Kenichi Handa <handa@m17n.org>
parents:
91169
diff
changeset
|
660 i = 3; |
|
3ce31df2ea58
(fontset_find_font): Don't prefer a font of
Kenichi Handa <handa@m17n.org>
parents:
91169
diff
changeset
|
661 } |
|
89699
cda6f41a592e
(reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
89687
diff
changeset
|
662 } |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
663 } |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
664 |
|
89898
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
665 /* Find the first available font in the vector of RFONT-DEF. */ |
|
89699
cda6f41a592e
(reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
89687
diff
changeset
|
666 for (; i < ASIZE (vec); i++) |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
667 { |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
668 elt = AREF (vec, i); |
|
89699
cda6f41a592e
(reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
89687
diff
changeset
|
669 if (NILP (elt)) |
|
cda6f41a592e
(reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
89687
diff
changeset
|
670 continue; |
|
89898
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
671 /* ELT == [ FACE-ID FONT-INDEX FONT-DEF OPENED-FONT-NAME ] */ |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
672 if (INTEGERP (AREF (elt, 1)) && XINT (AREF (elt, 1)) < 0) |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
673 /* We couldn't open this font last time. */ |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
674 continue; |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
675 |
|
89898
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
676 if (!face && NILP (AREF (elt, 1))) |
|
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
677 /* We have not yet opened the font. */ |
|
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
678 return Qnil; |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
679 |
|
89898
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
680 font_def = AREF (elt, 2); |
|
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
681 /* FONT_DEF == [ FONT-SPEC ENCODING REPERTORY ] */ |
| 90410 | 682 |
| 683 #ifdef USE_FONT_BACKEND | |
| 684 if (enable_font_backend) | |
| 61736 | 685 { |
|
91136
d54684fee154
(fontset_find_font) [USE_FONT_BACKEND]: Try multiple
Kenichi Handa <handa@m17n.org>
parents:
91053
diff
changeset
|
686 /* ELT == [ FACE-ID FONT-INDEX FONT-DEF FONT-LIST ] |
|
d54684fee154
(fontset_find_font) [USE_FONT_BACKEND]: Try multiple
Kenichi Handa <handa@m17n.org>
parents:
91053
diff
changeset
|
687 where FONT-LIST is a list of font-entity or font-object. */ |
|
d54684fee154
(fontset_find_font) [USE_FONT_BACKEND]: Try multiple
Kenichi Handa <handa@m17n.org>
parents:
91053
diff
changeset
|
688 Lisp_Object font_list = AREF (elt, 3), prev = Qnil; |
|
d54684fee154
(fontset_find_font) [USE_FONT_BACKEND]: Try multiple
Kenichi Handa <handa@m17n.org>
parents:
91053
diff
changeset
|
689 Lisp_Object font_object; |
| 90410 | 690 int has_char; |
| 691 | |
|
91136
d54684fee154
(fontset_find_font) [USE_FONT_BACKEND]: Try multiple
Kenichi Handa <handa@m17n.org>
parents:
91053
diff
changeset
|
692 for (; CONSP (font_list); |
|
d54684fee154
(fontset_find_font) [USE_FONT_BACKEND]: Try multiple
Kenichi Handa <handa@m17n.org>
parents:
91053
diff
changeset
|
693 prev = font_list, font_list = XCDR (font_list)) |
| 90410 | 694 { |
|
91136
d54684fee154
(fontset_find_font) [USE_FONT_BACKEND]: Try multiple
Kenichi Handa <handa@m17n.org>
parents:
91053
diff
changeset
|
695 font_object = XCAR (font_list); |
|
d54684fee154
(fontset_find_font) [USE_FONT_BACKEND]: Try multiple
Kenichi Handa <handa@m17n.org>
parents:
91053
diff
changeset
|
696 if (! (FONT_ENTITY_P (font_object) |
|
d54684fee154
(fontset_find_font) [USE_FONT_BACKEND]: Try multiple
Kenichi Handa <handa@m17n.org>
parents:
91053
diff
changeset
|
697 && FONT_ENTITY_NOT_LOADABLE (font_object)) |
|
d54684fee154
(fontset_find_font) [USE_FONT_BACKEND]: Try multiple
Kenichi Handa <handa@m17n.org>
parents:
91053
diff
changeset
|
698 && (has_char = font_has_char (f, font_object, c)) != 0) |
|
d54684fee154
(fontset_find_font) [USE_FONT_BACKEND]: Try multiple
Kenichi Handa <handa@m17n.org>
parents:
91053
diff
changeset
|
699 { |
|
d54684fee154
(fontset_find_font) [USE_FONT_BACKEND]: Try multiple
Kenichi Handa <handa@m17n.org>
parents:
91053
diff
changeset
|
700 if (has_char < 0) |
|
d54684fee154
(fontset_find_font) [USE_FONT_BACKEND]: Try multiple
Kenichi Handa <handa@m17n.org>
parents:
91053
diff
changeset
|
701 { |
|
d54684fee154
(fontset_find_font) [USE_FONT_BACKEND]: Try multiple
Kenichi Handa <handa@m17n.org>
parents:
91053
diff
changeset
|
702 Lisp_Object obj = font_open_for_lface (f, font_object, |
|
d54684fee154
(fontset_find_font) [USE_FONT_BACKEND]: Try multiple
Kenichi Handa <handa@m17n.org>
parents:
91053
diff
changeset
|
703 face->lface, Qnil); |
|
d54684fee154
(fontset_find_font) [USE_FONT_BACKEND]: Try multiple
Kenichi Handa <handa@m17n.org>
parents:
91053
diff
changeset
|
704 if (NILP (obj)) |
|
d54684fee154
(fontset_find_font) [USE_FONT_BACKEND]: Try multiple
Kenichi Handa <handa@m17n.org>
parents:
91053
diff
changeset
|
705 { |
|
d54684fee154
(fontset_find_font) [USE_FONT_BACKEND]: Try multiple
Kenichi Handa <handa@m17n.org>
parents:
91053
diff
changeset
|
706 FONT_ENTITY_SET_NOT_LOADABLE (font_object); |
|
d54684fee154
(fontset_find_font) [USE_FONT_BACKEND]: Try multiple
Kenichi Handa <handa@m17n.org>
parents:
91053
diff
changeset
|
707 continue; |
|
d54684fee154
(fontset_find_font) [USE_FONT_BACKEND]: Try multiple
Kenichi Handa <handa@m17n.org>
parents:
91053
diff
changeset
|
708 } |
|
d54684fee154
(fontset_find_font) [USE_FONT_BACKEND]: Try multiple
Kenichi Handa <handa@m17n.org>
parents:
91053
diff
changeset
|
709 font_object = obj; |
|
d54684fee154
(fontset_find_font) [USE_FONT_BACKEND]: Try multiple
Kenichi Handa <handa@m17n.org>
parents:
91053
diff
changeset
|
710 XSETCAR (font_list, font_object); |
|
d54684fee154
(fontset_find_font) [USE_FONT_BACKEND]: Try multiple
Kenichi Handa <handa@m17n.org>
parents:
91053
diff
changeset
|
711 if (! font_has_char (f, font_object, c)) |
|
d54684fee154
(fontset_find_font) [USE_FONT_BACKEND]: Try multiple
Kenichi Handa <handa@m17n.org>
parents:
91053
diff
changeset
|
712 continue; |
|
d54684fee154
(fontset_find_font) [USE_FONT_BACKEND]: Try multiple
Kenichi Handa <handa@m17n.org>
parents:
91053
diff
changeset
|
713 } |
|
d54684fee154
(fontset_find_font) [USE_FONT_BACKEND]: Try multiple
Kenichi Handa <handa@m17n.org>
parents:
91053
diff
changeset
|
714 if (! NILP (prev)) |
|
d54684fee154
(fontset_find_font) [USE_FONT_BACKEND]: Try multiple
Kenichi Handa <handa@m17n.org>
parents:
91053
diff
changeset
|
715 { |
|
d54684fee154
(fontset_find_font) [USE_FONT_BACKEND]: Try multiple
Kenichi Handa <handa@m17n.org>
parents:
91053
diff
changeset
|
716 /* Move this element to the head. */ |
|
d54684fee154
(fontset_find_font) [USE_FONT_BACKEND]: Try multiple
Kenichi Handa <handa@m17n.org>
parents:
91053
diff
changeset
|
717 XSETCDR (prev, XCDR (font_list)); |
|
d54684fee154
(fontset_find_font) [USE_FONT_BACKEND]: Try multiple
Kenichi Handa <handa@m17n.org>
parents:
91053
diff
changeset
|
718 ASET (elt, 3, Fcons (XCAR (font_list), AREF (elt, 3))); |
|
d54684fee154
(fontset_find_font) [USE_FONT_BACKEND]: Try multiple
Kenichi Handa <handa@m17n.org>
parents:
91053
diff
changeset
|
719 } |
|
d54684fee154
(fontset_find_font) [USE_FONT_BACKEND]: Try multiple
Kenichi Handa <handa@m17n.org>
parents:
91053
diff
changeset
|
720 break; |
|
d54684fee154
(fontset_find_font) [USE_FONT_BACKEND]: Try multiple
Kenichi Handa <handa@m17n.org>
parents:
91053
diff
changeset
|
721 } |
|
d54684fee154
(fontset_find_font) [USE_FONT_BACKEND]: Try multiple
Kenichi Handa <handa@m17n.org>
parents:
91053
diff
changeset
|
722 } |
|
d54684fee154
(fontset_find_font) [USE_FONT_BACKEND]: Try multiple
Kenichi Handa <handa@m17n.org>
parents:
91053
diff
changeset
|
723 if (NILP (font_list)) |
|
d54684fee154
(fontset_find_font) [USE_FONT_BACKEND]: Try multiple
Kenichi Handa <handa@m17n.org>
parents:
91053
diff
changeset
|
724 { |
|
d54684fee154
(fontset_find_font) [USE_FONT_BACKEND]: Try multiple
Kenichi Handa <handa@m17n.org>
parents:
91053
diff
changeset
|
725 Lisp_Object font_spec = AREF (font_def, 0); |
|
d54684fee154
(fontset_find_font) [USE_FONT_BACKEND]: Try multiple
Kenichi Handa <handa@m17n.org>
parents:
91053
diff
changeset
|
726 Lisp_Object font_entity; |
|
d54684fee154
(fontset_find_font) [USE_FONT_BACKEND]: Try multiple
Kenichi Handa <handa@m17n.org>
parents:
91053
diff
changeset
|
727 |
|
90818
c307aa794b2d
(fontset_find_font): Pay attention to font size
Kenichi Handa <handa@m17n.org>
parents:
90806
diff
changeset
|
728 if (! FONT_SPEC_P (font_spec)) |
|
c307aa794b2d
(fontset_find_font): Pay attention to font size
Kenichi Handa <handa@m17n.org>
parents:
90806
diff
changeset
|
729 { |
|
c307aa794b2d
(fontset_find_font): Pay attention to font size
Kenichi Handa <handa@m17n.org>
parents:
90806
diff
changeset
|
730 /* FONT_SPEC is FONT-NAME or (FAMILY . REGISTRY). */ |
|
c307aa794b2d
(fontset_find_font): Pay attention to font size
Kenichi Handa <handa@m17n.org>
parents:
90806
diff
changeset
|
731 font_spec = Ffont_spec (0, NULL); |
|
c307aa794b2d
(fontset_find_font): Pay attention to font size
Kenichi Handa <handa@m17n.org>
parents:
90806
diff
changeset
|
732 if (STRINGP (AREF (font_def, 0))) |
|
c307aa794b2d
(fontset_find_font): Pay attention to font size
Kenichi Handa <handa@m17n.org>
parents:
90806
diff
changeset
|
733 font_merge_old_spec (AREF (font_def, 0), Qnil, Qnil, |
|
c307aa794b2d
(fontset_find_font): Pay attention to font size
Kenichi Handa <handa@m17n.org>
parents:
90806
diff
changeset
|
734 font_spec); |
|
c307aa794b2d
(fontset_find_font): Pay attention to font size
Kenichi Handa <handa@m17n.org>
parents:
90806
diff
changeset
|
735 else |
|
c307aa794b2d
(fontset_find_font): Pay attention to font size
Kenichi Handa <handa@m17n.org>
parents:
90806
diff
changeset
|
736 { |
|
c307aa794b2d
(fontset_find_font): Pay attention to font size
Kenichi Handa <handa@m17n.org>
parents:
90806
diff
changeset
|
737 Lisp_Object family = AREF (AREF (font_def, 0), 0); |
|
c307aa794b2d
(fontset_find_font): Pay attention to font size
Kenichi Handa <handa@m17n.org>
parents:
90806
diff
changeset
|
738 Lisp_Object registry = AREF (AREF (font_def, 0), 5);; |
|
c307aa794b2d
(fontset_find_font): Pay attention to font size
Kenichi Handa <handa@m17n.org>
parents:
90806
diff
changeset
|
739 |
|
c307aa794b2d
(fontset_find_font): Pay attention to font size
Kenichi Handa <handa@m17n.org>
parents:
90806
diff
changeset
|
740 font_merge_old_spec (Qnil, family, registry, font_spec); |
|
c307aa794b2d
(fontset_find_font): Pay attention to font size
Kenichi Handa <handa@m17n.org>
parents:
90806
diff
changeset
|
741 } |
|
c307aa794b2d
(fontset_find_font): Pay attention to font size
Kenichi Handa <handa@m17n.org>
parents:
90806
diff
changeset
|
742 ASET (font_def, 0, font_spec); |
|
c307aa794b2d
(fontset_find_font): Pay attention to font size
Kenichi Handa <handa@m17n.org>
parents:
90806
diff
changeset
|
743 } |
|
91136
d54684fee154
(fontset_find_font) [USE_FONT_BACKEND]: Try multiple
Kenichi Handa <handa@m17n.org>
parents:
91053
diff
changeset
|
744 font_entity = font_find_for_lface (f, face->lface, font_spec, c); |
|
90818
c307aa794b2d
(fontset_find_font): Pay attention to font size
Kenichi Handa <handa@m17n.org>
parents:
90806
diff
changeset
|
745 if (NILP (font_entity)) |
|
91136
d54684fee154
(fontset_find_font) [USE_FONT_BACKEND]: Try multiple
Kenichi Handa <handa@m17n.org>
parents:
91053
diff
changeset
|
746 continue; |
|
d54684fee154
(fontset_find_font) [USE_FONT_BACKEND]: Try multiple
Kenichi Handa <handa@m17n.org>
parents:
91053
diff
changeset
|
747 font_list = Fcons (font_entity, AREF (elt, 3)); |
|
d54684fee154
(fontset_find_font) [USE_FONT_BACKEND]: Try multiple
Kenichi Handa <handa@m17n.org>
parents:
91053
diff
changeset
|
748 ASET (elt, 3, font_list); |
|
d54684fee154
(fontset_find_font) [USE_FONT_BACKEND]: Try multiple
Kenichi Handa <handa@m17n.org>
parents:
91053
diff
changeset
|
749 } |
|
d54684fee154
(fontset_find_font) [USE_FONT_BACKEND]: Try multiple
Kenichi Handa <handa@m17n.org>
parents:
91053
diff
changeset
|
750 font_object = XCAR (font_list); |
|
d54684fee154
(fontset_find_font) [USE_FONT_BACKEND]: Try multiple
Kenichi Handa <handa@m17n.org>
parents:
91053
diff
changeset
|
751 if (FONT_ENTITY_P (font_object)) |
|
d54684fee154
(fontset_find_font) [USE_FONT_BACKEND]: Try multiple
Kenichi Handa <handa@m17n.org>
parents:
91053
diff
changeset
|
752 { |
|
d54684fee154
(fontset_find_font) [USE_FONT_BACKEND]: Try multiple
Kenichi Handa <handa@m17n.org>
parents:
91053
diff
changeset
|
753 font_object = font_open_for_lface (f, font_object, |
|
d54684fee154
(fontset_find_font) [USE_FONT_BACKEND]: Try multiple
Kenichi Handa <handa@m17n.org>
parents:
91053
diff
changeset
|
754 face->lface, Qnil); |
|
d54684fee154
(fontset_find_font) [USE_FONT_BACKEND]: Try multiple
Kenichi Handa <handa@m17n.org>
parents:
91053
diff
changeset
|
755 if (NILP (font_object)) |
|
90818
c307aa794b2d
(fontset_find_font): Pay attention to font size
Kenichi Handa <handa@m17n.org>
parents:
90806
diff
changeset
|
756 { |
|
91136
d54684fee154
(fontset_find_font) [USE_FONT_BACKEND]: Try multiple
Kenichi Handa <handa@m17n.org>
parents:
91053
diff
changeset
|
757 FONT_ENTITY_SET_NOT_LOADABLE (XCAR (font_list)); |
|
90818
c307aa794b2d
(fontset_find_font): Pay attention to font size
Kenichi Handa <handa@m17n.org>
parents:
90806
diff
changeset
|
758 continue; |
|
c307aa794b2d
(fontset_find_font): Pay attention to font size
Kenichi Handa <handa@m17n.org>
parents:
90806
diff
changeset
|
759 } |
|
91136
d54684fee154
(fontset_find_font) [USE_FONT_BACKEND]: Try multiple
Kenichi Handa <handa@m17n.org>
parents:
91053
diff
changeset
|
760 XSETCAR (font_list, font_object); |
| 90410 | 761 } |
| 762 ASET (elt, 1, make_number (0)); | |
| 61736 | 763 } |
| 90410 | 764 else |
| 765 #endif /* USE_FONT_BACKEND */ | |
| 766 | |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
767 if (INTEGERP (AREF (font_def, 2))) |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
768 { |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
769 /* The repertory is specified by charset ID. */ |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
770 struct charset *charset |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
771 = CHARSET_FROM_ID (XINT (AREF (font_def, 2))); |
| 88405 | 772 |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
773 if (! CHAR_CHARSET_P (c, charset)) |
|
89349
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
774 /* This font can't display C. */ |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
775 continue; |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
776 } |
|
89826
b17725d55ba2
(Fset_fontset_font): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
89811
diff
changeset
|
777 else if (CHAR_TABLE_P (AREF (font_def, 2))) |
| 61736 | 778 { |
|
89826
b17725d55ba2
(Fset_fontset_font): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
89811
diff
changeset
|
779 /* The repertory is specified by a char table. */ |
|
b17725d55ba2
(Fset_fontset_font): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
89811
diff
changeset
|
780 if (NILP (CHAR_TABLE_REF (AREF (font_def, 2), c))) |
|
b17725d55ba2
(Fset_fontset_font): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
89811
diff
changeset
|
781 /* This font can't display C. */ |
|
b17725d55ba2
(Fset_fontset_font): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
89811
diff
changeset
|
782 continue; |
|
b17725d55ba2
(Fset_fontset_font): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
89811
diff
changeset
|
783 } |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
784 else |
| 61736 | 785 { |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
786 Lisp_Object slot; |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
787 |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
788 if (! INTEGERP (AREF (elt, 1))) |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
789 { |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
790 /* We have not yet opened a font matching this spec. |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
791 Open the best matching font now and register the |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
792 repertory. */ |
|
89898
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
793 struct font_info *font_info; |
|
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
794 |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
795 font_idx = load_font_get_repertory (f, face, font_def, fontset); |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
796 ASET (elt, 1, make_number (font_idx)); |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
797 if (font_idx < 0) |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
798 /* This means that we couldn't find a font matching |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
799 FONT_DEF. */ |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
800 continue; |
|
89898
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
801 font_info = (*get_font_info_func) (f, font_idx); |
|
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
802 ASET (elt, 3, build_string (font_info->full_name)); |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
803 } |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
804 |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
805 slot = Fassq (AREF (elt, 1), FONTSET_REPERTORY (fontset)); |
|
89898
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
806 xassert (CONSP (slot)); |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
807 if (NILP (CHAR_TABLE_REF (XCDR (slot), c))) |
|
89898
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
808 /* This font can't display C. */ |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
809 continue; |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
810 } |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
811 |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
812 /* Now we have decided to use this font spec to display C. */ |
|
89898
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
813 if (! INTEGERP (AREF (elt, 1))) |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
814 { |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
815 /* But not yet opened the best matching font. */ |
|
89898
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
816 struct font_info *font_info; |
|
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
817 |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
818 font_idx = load_font_get_repertory (f, face, font_def, fontset); |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
819 ASET (elt, 1, make_number (font_idx)); |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
820 if (font_idx < 0) |
|
89898
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
821 /* Can't open it. Try the other one. */ |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
822 continue; |
|
89898
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
823 font_info = (*get_font_info_func) (f, font_idx); |
|
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
824 ASET (elt, 3, build_string (font_info->full_name)); |
| 61736 | 825 } |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
826 |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
827 /* Now we have the opened font. */ |
|
89898
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
828 return elt; |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
829 } |
|
90802
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
830 return Qnil; |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
831 } |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
832 |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
833 |
|
90802
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
834 static Lisp_Object |
|
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
835 fontset_font (fontset, c, face, id) |
|
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
836 Lisp_Object fontset; |
|
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
837 int c; |
|
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
838 struct face *face; |
|
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
839 int id; |
|
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
840 { |
|
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
841 Lisp_Object rfont_def; |
|
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
842 Lisp_Object base_fontset; |
|
89811
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
843 |
|
90802
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
844 /* Try a font-group for C. */ |
|
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
845 rfont_def = fontset_find_font (fontset, c, face, id, 0); |
|
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
846 if (! NILP (rfont_def)) |
|
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
847 return rfont_def; |
|
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
848 base_fontset = FONTSET_BASE (fontset); |
|
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
849 /* Try a font-group for C of the default fontset. */ |
|
89349
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
850 if (! EQ (base_fontset, Vdefault_fontset)) |
|
89610
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
851 { |
|
89805
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
852 if (NILP (FONTSET_DEFAULT (fontset))) |
|
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
853 FONTSET_DEFAULT (fontset) |
|
89610
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
854 = make_fontset (FONTSET_FRAME (fontset), Qnil, Vdefault_fontset); |
|
90802
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
855 rfont_def = fontset_find_font (FONTSET_DEFAULT (fontset), c, face, id, 0); |
|
89610
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
856 } |
|
90802
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
857 if (! NILP (rfont_def)) |
|
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
858 return rfont_def; |
|
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
859 /* Try a fallback font-group. */ |
|
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
860 rfont_def = fontset_find_font (fontset, c, face, id, 1); |
|
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
861 if (! NILP (rfont_def)) |
|
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
862 return rfont_def; |
|
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
863 /* Try a fallback font-group of the default fontset . */ |
|
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
864 if (! EQ (base_fontset, Vdefault_fontset)) |
|
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
865 rfont_def = fontset_find_font (FONTSET_DEFAULT (fontset), c, face, id, 1); |
|
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
866 return rfont_def; |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
867 } |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
868 |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
869 /* Return a newly created fontset with NAME. If BASE is nil, make a |
| 88405 | 870 base fontset. Otherwise make a realized fontset whose base is |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
871 BASE. */ |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
872 |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
873 static Lisp_Object |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
874 make_fontset (frame, name, base) |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
875 Lisp_Object frame, name, base; |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
876 { |
|
34975
0d69e2d2724e
(fontset_ref): Remove unused variable `i'.
Eli Zaretskii <eliz@gnu.org>
parents:
32978
diff
changeset
|
877 Lisp_Object fontset; |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
878 int size = ASIZE (Vfontset_table); |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
879 int id = next_fontset_id; |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
880 |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
881 /* 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
|
882 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
|
883 terminates quickly. In addition, as the last element of |
|
41987
34952771ae85
Fix typos, remove unnecessary space.
Pavel Jan?k <Pavel@Janik.cz>
parents:
41052
diff
changeset
|
884 Vfontset_table is always nil, we don't have to check the range of |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
885 id. */ |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
886 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
|
887 |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
888 if (id + 1 == size) |
| 91053 | 889 Vfontset_table = larger_vector (Vfontset_table, size + 32, Qnil); |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
890 |
|
29767
c8e5453dc85d
(FONTSET_ASCII): Use the first element of char table
Kenichi Handa <handa@m17n.org>
parents:
29501
diff
changeset
|
891 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
|
892 |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
893 FONTSET_ID (fontset) = make_number (id); |
| 88405 | 894 if (NILP (base)) |
| 895 { | |
| 896 FONTSET_NAME (fontset) = name; | |
| 897 } | |
| 898 else | |
| 899 { | |
| 900 FONTSET_NAME (fontset) = Qnil; | |
| 901 FONTSET_FRAME (fontset) = frame; | |
| 902 FONTSET_BASE (fontset) = base; | |
| 903 } | |
| 17052 | 904 |
| 88405 | 905 ASET (Vfontset_table, id, fontset); |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
906 next_fontset_id = id + 1; |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
907 return fontset; |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
908 } |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
909 |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
910 |
|
60511
7ee9d8cb89cb
(set_default_ascii_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
58025
diff
changeset
|
911 /* Set the ASCII font of the default fontset to FONTNAME if that is |
|
7ee9d8cb89cb
(set_default_ascii_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
58025
diff
changeset
|
912 not yet set. */ |
|
7ee9d8cb89cb
(set_default_ascii_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
58025
diff
changeset
|
913 void |
|
7ee9d8cb89cb
(set_default_ascii_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
58025
diff
changeset
|
914 set_default_ascii_font (fontname) |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
915 Lisp_Object fontname; |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
916 { |
|
90121
4465a2011c2d
(set_default_ascii_font): Fix the change for syncing with CVS head.
Kenichi Handa <handa@m17n.org>
parents:
90116
diff
changeset
|
917 if (! STRINGP (FONTSET_ASCII (Vdefault_fontset))) |
|
60511
7ee9d8cb89cb
(set_default_ascii_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
58025
diff
changeset
|
918 { |
|
7ee9d8cb89cb
(set_default_ascii_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
58025
diff
changeset
|
919 int id = fs_query_fontset (fontname, 2); |
|
41987
34952771ae85
Fix typos, remove unnecessary space.
Pavel Jan?k <Pavel@Janik.cz>
parents:
41052
diff
changeset
|
920 |
|
60511
7ee9d8cb89cb
(set_default_ascii_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
58025
diff
changeset
|
921 if (id >= 0) |
|
90121
4465a2011c2d
(set_default_ascii_font): Fix the change for syncing with CVS head.
Kenichi Handa <handa@m17n.org>
parents:
90116
diff
changeset
|
922 fontname = FONTSET_ASCII (FONTSET_FROM_ID (id)); |
|
4465a2011c2d
(set_default_ascii_font): Fix the change for syncing with CVS head.
Kenichi Handa <handa@m17n.org>
parents:
90116
diff
changeset
|
923 FONTSET_ASCII (Vdefault_fontset)= fontname; |
|
60511
7ee9d8cb89cb
(set_default_ascii_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
58025
diff
changeset
|
924 } |
| 17052 | 925 } |
| 926 | |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
927 |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
928 /********** INTERFACES TO xfaces.c, xfns.c, and dispextern.h **********/ |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
929 |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
930 /* Return the name of the fontset who has ID. */ |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
931 |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
932 Lisp_Object |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
933 fontset_name (id) |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
934 int id; |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
935 { |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
936 Lisp_Object fontset; |
| 88405 | 937 |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
938 fontset = FONTSET_FROM_ID (id); |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
939 return FONTSET_NAME (fontset); |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
940 } |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
941 |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
942 |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
943 /* Return the ASCII font name of the fontset who has ID. */ |
|
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 Lisp_Object |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
946 fontset_ascii (id) |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
947 int id; |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
948 { |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
949 Lisp_Object fontset, elt; |
| 88405 | 950 |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
951 fontset= FONTSET_FROM_ID (id); |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
952 elt = FONTSET_ASCII (fontset); |
| 90410 | 953 #ifdef USE_FONT_BACKEND |
| 954 if (CONSP (elt)) | |
| 955 elt = XCAR (elt); | |
| 956 #endif /* USE_FONT_BACKEND */ | |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
957 /* It is assured that ELT is always a string (i.e. fontname |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
958 pattern). */ |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
959 return elt; |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
960 } |
|
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 |
| 88405 | 963 /* Free fontset of FACE defined on frame F. Called from |
| 964 free_realized_face. */ | |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
965 |
| 17052 | 966 void |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
967 free_face_fontset (f, face) |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
968 FRAME_PTR f; |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
969 struct face *face; |
| 17052 | 970 { |
|
89610
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
971 Lisp_Object fontset; |
|
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
972 |
|
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
973 fontset = AREF (Vfontset_table, face->fontset); |
|
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
974 xassert (!NILP (fontset) && ! BASE_FONTSET_P (fontset)); |
|
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
975 xassert (f == XFRAME (FONTSET_FRAME (fontset))); |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
976 ASET (Vfontset_table, face->fontset, Qnil); |
| 88405 | 977 if (face->fontset < next_fontset_id) |
| 978 next_fontset_id = face->fontset; | |
|
89805
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
979 if (! NILP (FONTSET_DEFAULT (fontset))) |
| 17052 | 980 { |
| 89865 | 981 int id = XINT (FONTSET_ID (FONTSET_DEFAULT (fontset))); |
|
89610
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
982 |
|
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
983 fontset = AREF (Vfontset_table, id); |
|
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
984 xassert (!NILP (fontset) && ! BASE_FONTSET_P (fontset)); |
|
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
985 xassert (f == XFRAME (FONTSET_FRAME (fontset))); |
|
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
986 ASET (Vfontset_table, id, Qnil); |
|
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
987 if (id < next_fontset_id) |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
988 next_fontset_id = face->fontset; |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
989 } |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
990 } |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
991 |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
992 |
| 78501 | 993 /* Return 1 if FACE is suitable for displaying character C. |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
994 Otherwise return 0. Called from the macro FACE_SUITABLE_FOR_CHAR_P |
| 88405 | 995 when C is not an ASCII character. */ |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
996 |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
997 int |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
998 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
|
999 struct face *face; |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1000 int c; |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1001 { |
|
89898
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
1002 Lisp_Object fontset, rfont_def; |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1003 |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1004 fontset = FONTSET_FROM_ID (face->fontset); |
|
89898
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
1005 rfont_def = fontset_font (fontset, c, NULL, -1); |
|
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
1006 return (VECTORP (rfont_def) |
|
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
1007 && INTEGERP (AREF (rfont_def, 0)) |
|
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
1008 && face->id == XINT (AREF (rfont_def, 0))); |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1009 } |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1010 |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1011 |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1012 /* Return ID of face suitable for displaying character C on frame F. |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1013 FACE must be reazlied for ASCII characters in advance. Called from |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1014 the macro FACE_FOR_CHAR. */ |
| 17052 | 1015 |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1016 int |
|
89699
cda6f41a592e
(reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
89687
diff
changeset
|
1017 face_for_char (f, face, c, pos, object) |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1018 FRAME_PTR f; |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1019 struct face *face; |
|
89699
cda6f41a592e
(reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
89687
diff
changeset
|
1020 int c, pos; |
|
cda6f41a592e
(reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
89687
diff
changeset
|
1021 Lisp_Object object; |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1022 { |
|
89898
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
1023 Lisp_Object fontset, charset, rfont_def; |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1024 int face_id; |
|
89699
cda6f41a592e
(reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
89687
diff
changeset
|
1025 int id; |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1026 |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1027 if (ASCII_CHAR_P (c)) |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1028 return face->ascii_face->id; |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1029 |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1030 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
|
1031 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
|
1032 xassert (!BASE_FONTSET_P (fontset)); |
|
89699
cda6f41a592e
(reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
89687
diff
changeset
|
1033 if (pos < 0) |
|
cda6f41a592e
(reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
89687
diff
changeset
|
1034 id = -1; |
|
cda6f41a592e
(reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
89687
diff
changeset
|
1035 else |
|
cda6f41a592e
(reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
89687
diff
changeset
|
1036 { |
|
cda6f41a592e
(reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
89687
diff
changeset
|
1037 charset = Fget_char_property (make_number (pos), Qcharset, object); |
|
cda6f41a592e
(reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
89687
diff
changeset
|
1038 if (NILP (charset)) |
|
cda6f41a592e
(reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
89687
diff
changeset
|
1039 id = -1; |
|
cda6f41a592e
(reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
89687
diff
changeset
|
1040 else if (CHARSETP (charset)) |
|
cda6f41a592e
(reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
89687
diff
changeset
|
1041 id = XINT (CHARSET_SYMBOL_ID (charset)); |
|
cda6f41a592e
(reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
89687
diff
changeset
|
1042 } |
|
89898
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
1043 rfont_def = fontset_font (fontset, c, face, id); |
|
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
1044 if (VECTORP (rfont_def)) |
|
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
1045 { |
| 90410 | 1046 #ifdef USE_FONT_BACKEND |
| 1047 if (enable_font_backend | |
| 1048 && NILP (AREF (rfont_def, 0))) | |
| 1049 { | |
|
91136
d54684fee154
(fontset_find_font) [USE_FONT_BACKEND]: Try multiple
Kenichi Handa <handa@m17n.org>
parents:
91053
diff
changeset
|
1050 struct font *font = XSAVE_VALUE (XCAR (AREF (rfont_def, 3)))->pointer; |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1051 |
| 90410 | 1052 face_id = face_for_font (f, font, face); |
| 1053 ASET (rfont_def, 0, make_number (face_id)); | |
| 1054 } | |
| 1055 else | |
| 1056 #endif /* USE_FONT_BACKEND */ | |
|
89898
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
1057 if (NILP (AREF (rfont_def, 0))) |
|
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
1058 { |
|
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
1059 /* We have not yet made a realized face that uses this font. */ |
|
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
1060 int font_idx = XINT (AREF (rfont_def, 1)); |
|
41987
34952771ae85
Fix typos, remove unnecessary space.
Pavel Jan?k <Pavel@Janik.cz>
parents:
41052
diff
changeset
|
1061 |
|
89898
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
1062 face_id = lookup_non_ascii_face (f, font_idx, face); |
|
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
1063 ASET (rfont_def, 0, make_number (face_id)); |
|
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
1064 } |
|
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
1065 return XINT (AREF (rfont_def, 0)); |
|
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
1066 } |
|
41987
34952771ae85
Fix typos, remove unnecessary space.
Pavel Jan?k <Pavel@Janik.cz>
parents:
41052
diff
changeset
|
1067 |
|
89898
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
1068 if (NILP (FONTSET_NOFONT_FACE (fontset))) |
|
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
1069 { |
|
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
1070 face_id = lookup_non_ascii_face (f, -1, face); |
|
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
1071 FONTSET_NOFONT_FACE (fontset) = make_number (face_id); |
|
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
1072 } |
|
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
1073 return XINT (FONTSET_NOFONT_FACE (fontset)); |
| 17052 | 1074 } |
| 1075 | |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1076 |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1077 /* 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
|
1078 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
|
1079 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
|
1080 Called from realize_x_face. */ |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1081 |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1082 int |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1083 make_fontset_for_ascii_face (f, base_fontset_id, face) |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1084 FRAME_PTR f; |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1085 int base_fontset_id; |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1086 struct face *face; |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1087 { |
|
34975
0d69e2d2724e
(fontset_ref): Remove unused variable `i'.
Eli Zaretskii <eliz@gnu.org>
parents:
32978
diff
changeset
|
1088 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
|
1089 |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1090 XSETFRAME (frame, f); |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1091 if (base_fontset_id >= 0) |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1092 { |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1093 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
|
1094 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
|
1095 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
|
1096 xassert (BASE_FONTSET_P (base_fontset)); |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1097 if (! BASE_FONTSET_P (base_fontset)) |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1098 abort (); |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1099 } |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1100 else |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1101 base_fontset = Vdefault_fontset; |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1102 |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1103 fontset = make_fontset (frame, Qnil, base_fontset); |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1104 { |
|
90802
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
1105 Lisp_Object elt, rfont_def, val; |
|
18346
c46e9f750033
(font_idx_temp): New temprary variable used in FS_LOAD_FONT.
Kenichi Handa <handa@m17n.org>
parents:
18341
diff
changeset
|
1106 |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1107 elt = FONTSET_REF (base_fontset, 0); |
|
89898
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
1108 xassert (VECTORP (elt) && ASIZE (elt) > 0); |
|
91136
d54684fee154
(fontset_find_font) [USE_FONT_BACKEND]: Try multiple
Kenichi Handa <handa@m17n.org>
parents:
91053
diff
changeset
|
1109 rfont_def = Fmake_vector (make_number (4), Qnil); |
| 90410 | 1110 #ifdef USE_FONT_BACKEND |
| 1111 if (enable_font_backend && face->font_info) | |
| 1112 { | |
| 1113 struct font *font = (struct font *) face->font_info; | |
|
41987
34952771ae85
Fix typos, remove unnecessary space.
Pavel Jan?k <Pavel@Janik.cz>
parents:
41052
diff
changeset
|
1114 |
|
91136
d54684fee154
(fontset_find_font) [USE_FONT_BACKEND]: Try multiple
Kenichi Handa <handa@m17n.org>
parents:
91053
diff
changeset
|
1115 ASET (rfont_def, 3, Fcons (font->entity, Qnil)); |
| 90410 | 1116 } |
|
90449
5956a1352bc4
(make_fontset_for_ascii_face): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
90440
diff
changeset
|
1117 else |
|
5956a1352bc4
(make_fontset_for_ascii_face): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
90440
diff
changeset
|
1118 #endif /* USE_FONT_BACKEND */ |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1119 { |
| 90410 | 1120 ASET (rfont_def, 3, build_string (face->font_name)); |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1121 } |
|
89898
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
1122 ASET (rfont_def, 1, make_number (face->font_info_id)); |
|
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
1123 ASET (rfont_def, 2, AREF (elt, 0)); |
|
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
1124 elt = Fmake_vector (make_number (4), Qnil); |
|
89699
cda6f41a592e
(reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
89687
diff
changeset
|
1125 ASET (elt, 0, make_number (charset_ordered_list_tick)); |
|
89898
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
1126 ASET (elt, 1, make_number (charset_ascii)); |
|
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
1127 ASET (elt, 2, rfont_def); |
|
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
1128 ASET (elt, 3, rfont_def); |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1129 |
|
90802
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
1130 val = Fcons (Qlatin, Qnil); |
|
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
1131 map_char_table (accumulate_script_ranges, Qnil, Vchar_script_table, val); |
|
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
1132 for (val = XCDR (val); CONSP (val); val = XCDR (val)) |
|
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
1133 char_table_set_range (fontset, XINT (XCAR (XCAR (val))), |
|
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
1134 XINT (XCDR (XCAR (val))), elt); |
|
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
1135 FONTSET_FALLBACK (fontset) = elt; |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1136 } |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1137 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
|
1138 } |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1139 |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1140 |
|
40028
392c2fe9edd7
(fs_load_font) [WINDOWSNT && _MSC_VER]: Disable
Andrew Innes <andrewi@gnu.org>
parents:
39973
diff
changeset
|
1141 #if defined(WINDOWSNT) && defined (_MSC_VER) |
|
392c2fe9edd7
(fs_load_font) [WINDOWSNT && _MSC_VER]: Disable
Andrew Innes <andrewi@gnu.org>
parents:
39973
diff
changeset
|
1142 #pragma optimize("", off) |
|
392c2fe9edd7
(fs_load_font) [WINDOWSNT && _MSC_VER]: Disable
Andrew Innes <andrewi@gnu.org>
parents:
39973
diff
changeset
|
1143 #endif |
|
392c2fe9edd7
(fs_load_font) [WINDOWSNT && _MSC_VER]: Disable
Andrew Innes <andrewi@gnu.org>
parents:
39973
diff
changeset
|
1144 |
| 88405 | 1145 /* Load a font named FONTNAME on frame F. Return a pointer to the |
| 1146 struct font_info of the loaded font. If loading fails, return | |
|
88968
a35b7b45baa3
(fs_load_font): If fontp->charset is not negative,
Kenichi Handa <handa@m17n.org>
parents:
88931
diff
changeset
|
1147 NULL. CHARSET is an ID of charset to encode characters for this |
|
a35b7b45baa3
(fs_load_font): If fontp->charset is not negative,
Kenichi Handa <handa@m17n.org>
parents:
88931
diff
changeset
|
1148 font. If it is -1, find one from Vfont_encoding_alist. */ |
| 17052 | 1149 |
| 1150 struct font_info * | |
|
88968
a35b7b45baa3
(fs_load_font): If fontp->charset is not negative,
Kenichi Handa <handa@m17n.org>
parents:
88931
diff
changeset
|
1151 fs_load_font (f, fontname, charset) |
| 17052 | 1152 FRAME_PTR f; |
| 1153 char *fontname; | |
|
88968
a35b7b45baa3
(fs_load_font): If fontp->charset is not negative,
Kenichi Handa <handa@m17n.org>
parents:
88931
diff
changeset
|
1154 int charset; |
| 17052 | 1155 { |
| 1156 struct font_info *fontp; | |
|
90034
dbbe513cabef
(fs_load_font): Use fast_string_match_ignore_case
Kenichi Handa <handa@m17n.org>
parents:
90033
diff
changeset
|
1157 Lisp_Object fullname; |
| 17052 | 1158 |
| 1159 if (!fontname) | |
| 1160 /* No way to get fontname. */ | |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1161 return NULL; |
| 17052 | 1162 |
| 88405 | 1163 fontp = (*load_font_func) (f, fontname, 0); |
|
88968
a35b7b45baa3
(fs_load_font): If fontp->charset is not negative,
Kenichi Handa <handa@m17n.org>
parents:
88931
diff
changeset
|
1164 if (! fontp || fontp->charset >= 0) |
|
a35b7b45baa3
(fs_load_font): If fontp->charset is not negative,
Kenichi Handa <handa@m17n.org>
parents:
88931
diff
changeset
|
1165 return fontp; |
| 17052 | 1166 |
|
88500
3d67875ee2b1
(fs_load_font): Check fontp->full_name (not fontname)
Kenichi Handa <handa@m17n.org>
parents:
88482
diff
changeset
|
1167 fontname = fontp->full_name; |
|
57573
43067aee2f3e
(fs_load_font): Use fast_string_match_ignore_case for
Kenichi Handa <handa@m17n.org>
parents:
56293
diff
changeset
|
1168 fullname = build_string (fontp->full_name); |
|
26858
7cc081b4e084
(Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents:
26164
diff
changeset
|
1169 |
|
88968
a35b7b45baa3
(fs_load_font): If fontp->charset is not negative,
Kenichi Handa <handa@m17n.org>
parents:
88931
diff
changeset
|
1170 if (charset < 0) |
| 17052 | 1171 { |
|
88968
a35b7b45baa3
(fs_load_font): If fontp->charset is not negative,
Kenichi Handa <handa@m17n.org>
parents:
88931
diff
changeset
|
1172 Lisp_Object charset_symbol; |
| 17052 | 1173 |
|
90034
dbbe513cabef
(fs_load_font): Use fast_string_match_ignore_case
Kenichi Handa <handa@m17n.org>
parents:
90033
diff
changeset
|
1174 charset_symbol = find_font_encoding (fullname); |
|
88968
a35b7b45baa3
(fs_load_font): If fontp->charset is not negative,
Kenichi Handa <handa@m17n.org>
parents:
88931
diff
changeset
|
1175 if (CONSP (charset_symbol)) |
|
a35b7b45baa3
(fs_load_font): If fontp->charset is not negative,
Kenichi Handa <handa@m17n.org>
parents:
88931
diff
changeset
|
1176 charset_symbol = XCAR (charset_symbol); |
| 90410 | 1177 if (NILP (charset_symbol)) |
| 1178 charset_symbol = Qascii; | |
|
88968
a35b7b45baa3
(fs_load_font): If fontp->charset is not negative,
Kenichi Handa <handa@m17n.org>
parents:
88931
diff
changeset
|
1179 charset = XINT (CHARSET_SYMBOL_ID (charset_symbol)); |
|
a35b7b45baa3
(fs_load_font): If fontp->charset is not negative,
Kenichi Handa <handa@m17n.org>
parents:
88931
diff
changeset
|
1180 } |
|
a35b7b45baa3
(fs_load_font): If fontp->charset is not negative,
Kenichi Handa <handa@m17n.org>
parents:
88931
diff
changeset
|
1181 fontp->charset = charset; |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1182 fontp->vertical_centering = 0; |
| 88405 | 1183 fontp->font_encoder = NULL; |
| 17052 | 1184 |
|
88968
a35b7b45baa3
(fs_load_font): If fontp->charset is not negative,
Kenichi Handa <handa@m17n.org>
parents:
88931
diff
changeset
|
1185 if (charset != charset_ascii) |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1186 { |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1187 fontp->vertical_centering |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1188 = (STRINGP (Vvertical_centering_font_regexp) |
|
90034
dbbe513cabef
(fs_load_font): Use fast_string_match_ignore_case
Kenichi Handa <handa@m17n.org>
parents:
90033
diff
changeset
|
1189 && (fast_string_match_ignore_case |
|
dbbe513cabef
(fs_load_font): Use fast_string_match_ignore_case
Kenichi Handa <handa@m17n.org>
parents:
90033
diff
changeset
|
1190 (Vvertical_centering_font_regexp, fullname) >= 0)); |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1191 |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1192 if (find_ccl_program_func) |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1193 (*find_ccl_program_func) (fontp); |
| 17052 | 1194 } |
| 1195 | |
| 1196 return fontp; | |
| 1197 } | |
| 1198 | |
|
40028
392c2fe9edd7
(fs_load_font) [WINDOWSNT && _MSC_VER]: Disable
Andrew Innes <andrewi@gnu.org>
parents:
39973
diff
changeset
|
1199 #if defined(WINDOWSNT) && defined (_MSC_VER) |
|
392c2fe9edd7
(fs_load_font) [WINDOWSNT && _MSC_VER]: Disable
Andrew Innes <andrewi@gnu.org>
parents:
39973
diff
changeset
|
1200 #pragma optimize("", on) |
|
392c2fe9edd7
(fs_load_font) [WINDOWSNT && _MSC_VER]: Disable
Andrew Innes <andrewi@gnu.org>
parents:
39973
diff
changeset
|
1201 #endif |
|
392c2fe9edd7
(fs_load_font) [WINDOWSNT && _MSC_VER]: Disable
Andrew Innes <andrewi@gnu.org>
parents:
39973
diff
changeset
|
1202 |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1203 |
|
88968
a35b7b45baa3
(fs_load_font): If fontp->charset is not negative,
Kenichi Handa <handa@m17n.org>
parents:
88931
diff
changeset
|
1204 /* Return ENCODING or a cons of ENCODING and REPERTORY of the font |
|
a35b7b45baa3
(fs_load_font): If fontp->charset is not negative,
Kenichi Handa <handa@m17n.org>
parents:
88931
diff
changeset
|
1205 FONTNAME. ENCODING is a charset symbol that specifies the encoding |
|
a35b7b45baa3
(fs_load_font): If fontp->charset is not negative,
Kenichi Handa <handa@m17n.org>
parents:
88931
diff
changeset
|
1206 of the font. REPERTORY is a charset symbol or nil. */ |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1207 |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1208 |
| 90410 | 1209 Lisp_Object |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1210 find_font_encoding (fontname) |
|
60511
7ee9d8cb89cb
(set_default_ascii_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
58025
diff
changeset
|
1211 Lisp_Object fontname; |
|
7ee9d8cb89cb
(set_default_ascii_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
58025
diff
changeset
|
1212 { |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1213 Lisp_Object tail, elt; |
|
60511
7ee9d8cb89cb
(set_default_ascii_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
58025
diff
changeset
|
1214 |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1215 for (tail = Vfont_encoding_alist; CONSP (tail); tail = XCDR (tail)) |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1216 { |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1217 elt = XCAR (tail); |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1218 if (CONSP (elt) |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1219 && STRINGP (XCAR (elt)) |
|
90034
dbbe513cabef
(fs_load_font): Use fast_string_match_ignore_case
Kenichi Handa <handa@m17n.org>
parents:
90033
diff
changeset
|
1220 && fast_string_match_ignore_case (XCAR (elt), fontname) >= 0 |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1221 && (SYMBOLP (XCDR (elt)) |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1222 ? CHARSETP (XCDR (elt)) |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1223 : CONSP (XCDR (elt)) && CHARSETP (XCAR (XCDR (elt))))) |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1224 return (XCDR (elt)); |
|
60511
7ee9d8cb89cb
(set_default_ascii_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
58025
diff
changeset
|
1225 } |
|
89901
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1226 /* We don't know the encoding of this font. Let's assume `ascii'. */ |
|
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1227 return Qascii; |
|
60511
7ee9d8cb89cb
(set_default_ascii_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
58025
diff
changeset
|
1228 } |
|
7ee9d8cb89cb
(set_default_ascii_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
58025
diff
changeset
|
1229 |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1230 |
| 17052 | 1231 /* Cache data used by fontset_pattern_regexp. The car part is a |
| 1232 pattern string containing at least one wild card, the cdr part is | |
| 1233 the corresponding regular expression. */ | |
| 1234 static Lisp_Object Vcached_fontset_data; | |
| 1235 | |
|
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
45848
diff
changeset
|
1236 #define CACHED_FONTSET_NAME (SDATA (XCAR (Vcached_fontset_data))) |
|
26164
d39ec0a27081
more XCAR/XCDR/XFLOAT_DATA uses, to help isolete lisp engine
Ken Raeburn <raeburn@raeburn.org>
parents:
25668
diff
changeset
|
1237 #define CACHED_FONTSET_REGEX (XCDR (Vcached_fontset_data)) |
| 17052 | 1238 |
| 1239 /* If fontset name PATTERN contains any wild card, return regular | |
| 1240 expression corresponding to PATTERN. */ | |
| 1241 | |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1242 static Lisp_Object |
| 17052 | 1243 fontset_pattern_regexp (pattern) |
| 1244 Lisp_Object pattern; | |
| 1245 { | |
|
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
45848
diff
changeset
|
1246 if (!index (SDATA (pattern), '*') |
|
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
45848
diff
changeset
|
1247 && !index (SDATA (pattern), '?')) |
| 17052 | 1248 /* PATTERN does not contain any wild cards. */ |
|
17730
4bbcc6804b5d
(Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
17331
diff
changeset
|
1249 return Qnil; |
| 17052 | 1250 |
| 1251 if (!CONSP (Vcached_fontset_data) | |
|
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
45848
diff
changeset
|
1252 || strcmp (SDATA (pattern), CACHED_FONTSET_NAME)) |
| 17052 | 1253 { |
| 1254 /* We must at first update the cached data. */ | |
|
57947
678d2c0d522e
(fontset_pattern_regexp): Use unsigned char.
Kim F. Storm <storm@cua.dk>
parents:
57921
diff
changeset
|
1255 unsigned char *regex, *p0, *p1; |
|
57685
b935fc1cb542
(fontset_pattern_regexp): Optimize for the case that
Kenichi Handa <handa@m17n.org>
parents:
57573
diff
changeset
|
1256 int ndashes = 0, nstars = 0; |
|
57947
678d2c0d522e
(fontset_pattern_regexp): Use unsigned char.
Kim F. Storm <storm@cua.dk>
parents:
57921
diff
changeset
|
1257 |
|
57685
b935fc1cb542
(fontset_pattern_regexp): Optimize for the case that
Kenichi Handa <handa@m17n.org>
parents:
57573
diff
changeset
|
1258 for (p0 = SDATA (pattern); *p0; p0++) |
|
b935fc1cb542
(fontset_pattern_regexp): Optimize for the case that
Kenichi Handa <handa@m17n.org>
parents:
57573
diff
changeset
|
1259 { |
|
b935fc1cb542
(fontset_pattern_regexp): Optimize for the case that
Kenichi Handa <handa@m17n.org>
parents:
57573
diff
changeset
|
1260 if (*p0 == '-') |
|
b935fc1cb542
(fontset_pattern_regexp): Optimize for the case that
Kenichi Handa <handa@m17n.org>
parents:
57573
diff
changeset
|
1261 ndashes++; |
|
58025
bcd053632eb2
(fontset_pattern_regexp): Cancel my previous change;
Kenichi Handa <handa@m17n.org>
parents:
57947
diff
changeset
|
1262 else if (*p0 == '*') |
|
57685
b935fc1cb542
(fontset_pattern_regexp): Optimize for the case that
Kenichi Handa <handa@m17n.org>
parents:
57573
diff
changeset
|
1263 nstars++; |
|
b935fc1cb542
(fontset_pattern_regexp): Optimize for the case that
Kenichi Handa <handa@m17n.org>
parents:
57573
diff
changeset
|
1264 } |
| 17052 | 1265 |
|
57685
b935fc1cb542
(fontset_pattern_regexp): Optimize for the case that
Kenichi Handa <handa@m17n.org>
parents:
57573
diff
changeset
|
1266 /* If PATTERN is not full XLFD we conert "*" to ".*". Otherwise |
|
b935fc1cb542
(fontset_pattern_regexp): Optimize for the case that
Kenichi Handa <handa@m17n.org>
parents:
57573
diff
changeset
|
1267 we convert "*" to "[^-]*" which is much faster in regular |
|
b935fc1cb542
(fontset_pattern_regexp): Optimize for the case that
Kenichi Handa <handa@m17n.org>
parents:
57573
diff
changeset
|
1268 expression matching. */ |
|
b935fc1cb542
(fontset_pattern_regexp): Optimize for the case that
Kenichi Handa <handa@m17n.org>
parents:
57573
diff
changeset
|
1269 if (ndashes < 14) |
|
57947
678d2c0d522e
(fontset_pattern_regexp): Use unsigned char.
Kim F. Storm <storm@cua.dk>
parents:
57921
diff
changeset
|
1270 p1 = regex = (unsigned char *) alloca (SBYTES (pattern) + 2 * nstars + 1); |
|
57685
b935fc1cb542
(fontset_pattern_regexp): Optimize for the case that
Kenichi Handa <handa@m17n.org>
parents:
57573
diff
changeset
|
1271 else |
|
57947
678d2c0d522e
(fontset_pattern_regexp): Use unsigned char.
Kim F. Storm <storm@cua.dk>
parents:
57921
diff
changeset
|
1272 p1 = regex = (unsigned char *) alloca (SBYTES (pattern) + 5 * nstars + 1); |
|
57685
b935fc1cb542
(fontset_pattern_regexp): Optimize for the case that
Kenichi Handa <handa@m17n.org>
parents:
57573
diff
changeset
|
1273 |
|
17730
4bbcc6804b5d
(Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
17331
diff
changeset
|
1274 *p1++ = '^'; |
|
57947
678d2c0d522e
(fontset_pattern_regexp): Use unsigned char.
Kim F. Storm <storm@cua.dk>
parents:
57921
diff
changeset
|
1275 for (p0 = SDATA (pattern); *p0; p0++) |
| 17052 | 1276 { |
|
58025
bcd053632eb2
(fontset_pattern_regexp): Cancel my previous change;
Kenichi Handa <handa@m17n.org>
parents:
57947
diff
changeset
|
1277 if (*p0 == '*') |
| 17052 | 1278 { |
|
57685
b935fc1cb542
(fontset_pattern_regexp): Optimize for the case that
Kenichi Handa <handa@m17n.org>
parents:
57573
diff
changeset
|
1279 if (ndashes < 14) |
|
b935fc1cb542
(fontset_pattern_regexp): Optimize for the case that
Kenichi Handa <handa@m17n.org>
parents:
57573
diff
changeset
|
1280 *p1++ = '.'; |
|
b935fc1cb542
(fontset_pattern_regexp): Optimize for the case that
Kenichi Handa <handa@m17n.org>
parents:
57573
diff
changeset
|
1281 else |
|
b935fc1cb542
(fontset_pattern_regexp): Optimize for the case that
Kenichi Handa <handa@m17n.org>
parents:
57573
diff
changeset
|
1282 *p1++ = '[', *p1++ = '^', *p1++ = '-', *p1++ = ']'; |
|
17730
4bbcc6804b5d
(Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
17331
diff
changeset
|
1283 *p1++ = '*'; |
| 17052 | 1284 } |
|
17730
4bbcc6804b5d
(Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
17331
diff
changeset
|
1285 else if (*p0 == '?') |
|
21127
577865651099
(fontset_pattern_regexp): `==' was used instead of `='.
Richard M. Stallman <rms@gnu.org>
parents:
20346
diff
changeset
|
1286 *p1++ = '.'; |
|
17730
4bbcc6804b5d
(Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
17331
diff
changeset
|
1287 else |
|
4bbcc6804b5d
(Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
17331
diff
changeset
|
1288 *p1++ = *p0; |
| 17052 | 1289 } |
| 1290 *p1++ = '$'; | |
| 1291 *p1++ = 0; | |
| 1292 | |
|
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
45848
diff
changeset
|
1293 Vcached_fontset_data = Fcons (build_string (SDATA (pattern)), |
| 17052 | 1294 build_string (regex)); |
| 1295 } | |
| 1296 | |
| 1297 return CACHED_FONTSET_REGEX; | |
| 1298 } | |
| 1299 | |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1300 /* Return ID of the base fontset named NAME. If there's no such |
|
58025
bcd053632eb2
(fontset_pattern_regexp): Cancel my previous change;
Kenichi Handa <handa@m17n.org>
parents:
57947
diff
changeset
|
1301 fontset, return -1. NAME_PATTERN specifies how to treat NAME as this: |
|
bcd053632eb2
(fontset_pattern_regexp): Cancel my previous change;
Kenichi Handa <handa@m17n.org>
parents:
57947
diff
changeset
|
1302 0: pattern containing '*' and '?' as wildcards |
|
bcd053632eb2
(fontset_pattern_regexp): Cancel my previous change;
Kenichi Handa <handa@m17n.org>
parents:
57947
diff
changeset
|
1303 1: regular expression |
|
bcd053632eb2
(fontset_pattern_regexp): Cancel my previous change;
Kenichi Handa <handa@m17n.org>
parents:
57947
diff
changeset
|
1304 2: literal fontset name |
|
bcd053632eb2
(fontset_pattern_regexp): Cancel my previous change;
Kenichi Handa <handa@m17n.org>
parents:
57947
diff
changeset
|
1305 */ |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1306 |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1307 int |
|
58025
bcd053632eb2
(fontset_pattern_regexp): Cancel my previous change;
Kenichi Handa <handa@m17n.org>
parents:
57947
diff
changeset
|
1308 fs_query_fontset (name, name_pattern) |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1309 Lisp_Object name; |
|
58025
bcd053632eb2
(fontset_pattern_regexp): Cancel my previous change;
Kenichi Handa <handa@m17n.org>
parents:
57947
diff
changeset
|
1310 int name_pattern; |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1311 { |
|
34975
0d69e2d2724e
(fontset_ref): Remove unused variable `i'.
Eli Zaretskii <eliz@gnu.org>
parents:
32978
diff
changeset
|
1312 Lisp_Object tem; |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1313 int i; |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1314 |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1315 name = Fdowncase (name); |
|
58025
bcd053632eb2
(fontset_pattern_regexp): Cancel my previous change;
Kenichi Handa <handa@m17n.org>
parents:
57947
diff
changeset
|
1316 if (name_pattern != 1) |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1317 { |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1318 tem = Frassoc (name, Vfontset_alias_alist); |
|
89699
cda6f41a592e
(reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
89687
diff
changeset
|
1319 if (NILP (tem)) |
|
cda6f41a592e
(reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
89687
diff
changeset
|
1320 tem = Fassoc (name, Vfontset_alias_alist); |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1321 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
|
1322 name = XCAR (tem); |
|
58025
bcd053632eb2
(fontset_pattern_regexp): Cancel my previous change;
Kenichi Handa <handa@m17n.org>
parents:
57947
diff
changeset
|
1323 else if (name_pattern == 0) |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1324 { |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1325 tem = fontset_pattern_regexp (name); |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1326 if (STRINGP (tem)) |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1327 { |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1328 name = tem; |
|
58025
bcd053632eb2
(fontset_pattern_regexp): Cancel my previous change;
Kenichi Handa <handa@m17n.org>
parents:
57947
diff
changeset
|
1329 name_pattern = 1; |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1330 } |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1331 } |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1332 } |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1333 |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1334 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
|
1335 { |
|
57573
43067aee2f3e
(fs_load_font): Use fast_string_match_ignore_case for
Kenichi Handa <handa@m17n.org>
parents:
56293
diff
changeset
|
1336 Lisp_Object fontset, this_name; |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1337 |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1338 fontset = FONTSET_FROM_ID (i); |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1339 if (NILP (fontset) |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1340 || !BASE_FONTSET_P (fontset)) |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1341 continue; |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1342 |
|
57573
43067aee2f3e
(fs_load_font): Use fast_string_match_ignore_case for
Kenichi Handa <handa@m17n.org>
parents:
56293
diff
changeset
|
1343 this_name = FONTSET_NAME (fontset); |
|
58025
bcd053632eb2
(fontset_pattern_regexp): Cancel my previous change;
Kenichi Handa <handa@m17n.org>
parents:
57947
diff
changeset
|
1344 if (name_pattern == 1 |
|
57573
43067aee2f3e
(fs_load_font): Use fast_string_match_ignore_case for
Kenichi Handa <handa@m17n.org>
parents:
56293
diff
changeset
|
1345 ? fast_string_match (name, this_name) >= 0 |
|
43067aee2f3e
(fs_load_font): Use fast_string_match_ignore_case for
Kenichi Handa <handa@m17n.org>
parents:
56293
diff
changeset
|
1346 : !strcmp (SDATA (name), SDATA (this_name))) |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1347 return i; |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1348 } |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1349 return -1; |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1350 } |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1351 |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1352 |
|
21553
2d7afcd11b72
(find_ccl_program_func): New variable.
Kenichi Handa <handa@m17n.org>
parents:
21514
diff
changeset
|
1353 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
|
1354 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
|
1355 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
|
1356 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
|
1357 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
|
1358 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
|
1359 (pattern, regexpp) |
|
21553
2d7afcd11b72
(find_ccl_program_func): New variable.
Kenichi Handa <handa@m17n.org>
parents:
21514
diff
changeset
|
1360 Lisp_Object pattern, regexpp; |
| 17052 | 1361 { |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1362 Lisp_Object fontset; |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1363 int id; |
| 17052 | 1364 |
| 1365 (*check_window_system_func) (); | |
| 1366 | |
|
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Jan?k <Pavel@Janik.cz>
parents:
40028
diff
changeset
|
1367 CHECK_STRING (pattern); |
| 17052 | 1368 |
|
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
45848
diff
changeset
|
1369 if (SCHARS (pattern) == 0) |
| 17052 | 1370 return Qnil; |
| 1371 | |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1372 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
|
1373 if (id < 0) |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1374 return Qnil; |
| 17052 | 1375 |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1376 fontset = FONTSET_FROM_ID (id); |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1377 return FONTSET_NAME (fontset); |
| 17052 | 1378 } |
| 1379 | |
| 88405 | 1380 /* Return a list of base fontset names matching PATTERN on frame F. */ |
| 17052 | 1381 |
| 1382 Lisp_Object | |
| 1383 list_fontsets (f, pattern, size) | |
| 1384 FRAME_PTR f; | |
| 1385 Lisp_Object pattern; | |
| 1386 int size; | |
| 1387 { | |
|
34975
0d69e2d2724e
(fontset_ref): Remove unused variable `i'.
Eli Zaretskii <eliz@gnu.org>
parents:
32978
diff
changeset
|
1388 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
|
1389 int id; |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1390 |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1391 XSETFRAME (frame, f); |
| 17052 | 1392 |
| 1393 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
|
1394 val = Qnil; |
| 17052 | 1395 |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1396 for (id = 0; id < ASIZE (Vfontset_table); id++) |
| 17052 | 1397 { |
|
57573
43067aee2f3e
(fs_load_font): Use fast_string_match_ignore_case for
Kenichi Handa <handa@m17n.org>
parents:
56293
diff
changeset
|
1398 Lisp_Object fontset, name; |
| 17052 | 1399 |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1400 fontset = FONTSET_FROM_ID (id); |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1401 if (NILP (fontset) |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1402 || !BASE_FONTSET_P (fontset) |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1403 || !EQ (frame, FONTSET_FRAME (fontset))) |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1404 continue; |
|
57573
43067aee2f3e
(fs_load_font): Use fast_string_match_ignore_case for
Kenichi Handa <handa@m17n.org>
parents:
56293
diff
changeset
|
1405 name = FONTSET_NAME (fontset); |
| 17052 | 1406 |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1407 if (STRINGP (regexp) |
|
57573
43067aee2f3e
(fs_load_font): Use fast_string_match_ignore_case for
Kenichi Handa <handa@m17n.org>
parents:
56293
diff
changeset
|
1408 ? (fast_string_match (regexp, name) < 0) |
|
43067aee2f3e
(fs_load_font): Use fast_string_match_ignore_case for
Kenichi Handa <handa@m17n.org>
parents:
56293
diff
changeset
|
1409 : strcmp (SDATA (pattern), SDATA (name))) |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1410 continue; |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1411 |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1412 val = Fcons (Fcopy_sequence (FONTSET_NAME (fontset)), val); |
| 17052 | 1413 } |
| 1414 | |
| 1415 return val; | |
| 1416 } | |
| 1417 | |
| 88405 | 1418 |
| 89483 | 1419 /* Free all realized fontsets whose base fontset is BASE. */ |
| 17052 | 1420 |
| 88405 | 1421 static void |
| 1422 free_realized_fontsets (base) | |
| 1423 Lisp_Object base; | |
| 17052 | 1424 { |
|
58025
bcd053632eb2
(fontset_pattern_regexp): Cancel my previous change;
Kenichi Handa <handa@m17n.org>
parents:
57947
diff
changeset
|
1425 int id; |
| 17052 | 1426 |
|
90806
1ae136ad0ba0
(free_realized_fontsets): Avoid unnecessary call of
Kenichi Handa <handa@m17n.org>
parents:
90802
diff
changeset
|
1427 #if 0 |
|
88482
effba1417b74
(free_realized_fontsets): Call Fclear_face_cache instead
Kenichi Handa <handa@m17n.org>
parents:
88405
diff
changeset
|
1428 /* For the moment, this doesn't work because free_realized_face |
|
effba1417b74
(free_realized_fontsets): Call Fclear_face_cache instead
Kenichi Handa <handa@m17n.org>
parents:
88405
diff
changeset
|
1429 doesn't remove FACE from a cache. Until we find a solution, we |
|
effba1417b74
(free_realized_fontsets): Call Fclear_face_cache instead
Kenichi Handa <handa@m17n.org>
parents:
88405
diff
changeset
|
1430 suppress this code, and simply use Fclear_face_cache even though |
|
effba1417b74
(free_realized_fontsets): Call Fclear_face_cache instead
Kenichi Handa <handa@m17n.org>
parents:
88405
diff
changeset
|
1431 that is not efficient. */ |
| 88405 | 1432 BLOCK_INPUT; |
| 1433 for (id = 0; id < ASIZE (Vfontset_table); id++) | |
| 17052 | 1434 { |
| 88405 | 1435 Lisp_Object this = AREF (Vfontset_table, id); |
| 17052 | 1436 |
| 88405 | 1437 if (EQ (FONTSET_BASE (this), base)) |
| 1438 { | |
| 1439 Lisp_Object tail; | |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1440 |
| 88405 | 1441 for (tail = FONTSET_FACE_ALIST (this); CONSP (tail); |
| 1442 tail = XCDR (tail)) | |
| 1443 { | |
| 1444 FRAME_PTR f = XFRAME (FONTSET_FRAME (this)); | |
| 1445 int face_id = XINT (XCDR (XCAR (tail))); | |
| 1446 struct face *face = FACE_FROM_ID (f, face_id); | |
| 89483 | 1447 |
| 88405 | 1448 /* Face THIS itself is also freed by the following call. */ |
| 1449 free_realized_face (f, face); | |
| 1450 } | |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1451 } |
| 17052 | 1452 } |
| 88405 | 1453 UNBLOCK_INPUT; |
|
88482
effba1417b74
(free_realized_fontsets): Call Fclear_face_cache instead
Kenichi Handa <handa@m17n.org>
parents:
88405
diff
changeset
|
1454 #else /* not 0 */ |
|
90806
1ae136ad0ba0
(free_realized_fontsets): Avoid unnecessary call of
Kenichi Handa <handa@m17n.org>
parents:
90802
diff
changeset
|
1455 /* But, we don't have to call Fclear_face_cache if no fontset has |
|
1ae136ad0ba0
(free_realized_fontsets): Avoid unnecessary call of
Kenichi Handa <handa@m17n.org>
parents:
90802
diff
changeset
|
1456 been realized from BASE. */ |
|
1ae136ad0ba0
(free_realized_fontsets): Avoid unnecessary call of
Kenichi Handa <handa@m17n.org>
parents:
90802
diff
changeset
|
1457 for (id = 0; id < ASIZE (Vfontset_table); id++) |
|
1ae136ad0ba0
(free_realized_fontsets): Avoid unnecessary call of
Kenichi Handa <handa@m17n.org>
parents:
90802
diff
changeset
|
1458 { |
|
1ae136ad0ba0
(free_realized_fontsets): Avoid unnecessary call of
Kenichi Handa <handa@m17n.org>
parents:
90802
diff
changeset
|
1459 Lisp_Object this = AREF (Vfontset_table, id); |
| 17052 | 1460 |
| 91046 | 1461 if (CHAR_TABLE_P (this) && EQ (FONTSET_BASE (this), base)) |
|
90806
1ae136ad0ba0
(free_realized_fontsets): Avoid unnecessary call of
Kenichi Handa <handa@m17n.org>
parents:
90802
diff
changeset
|
1462 { |
|
1ae136ad0ba0
(free_realized_fontsets): Avoid unnecessary call of
Kenichi Handa <handa@m17n.org>
parents:
90802
diff
changeset
|
1463 Fclear_face_cache (Qt); |
|
1ae136ad0ba0
(free_realized_fontsets): Avoid unnecessary call of
Kenichi Handa <handa@m17n.org>
parents:
90802
diff
changeset
|
1464 break; |
|
1ae136ad0ba0
(free_realized_fontsets): Avoid unnecessary call of
Kenichi Handa <handa@m17n.org>
parents:
90802
diff
changeset
|
1465 } |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1466 } |
|
88482
effba1417b74
(free_realized_fontsets): Call Fclear_face_cache instead
Kenichi Handa <handa@m17n.org>
parents:
88405
diff
changeset
|
1467 #endif /* not 0 */ |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1468 } |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1469 |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1470 |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1471 /* 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
|
1472 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
|
1473 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
|
1474 |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1475 static Lisp_Object |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1476 check_fontset_name (name) |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1477 Lisp_Object name; |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1478 { |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1479 int id; |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1480 |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1481 if (EQ (name, Qt)) |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1482 return Vdefault_fontset; |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1483 |
|
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Jan?k <Pavel@Janik.cz>
parents:
40028
diff
changeset
|
1484 CHECK_STRING (name); |
|
58025
bcd053632eb2
(fontset_pattern_regexp): Cancel my previous change;
Kenichi Handa <handa@m17n.org>
parents:
57947
diff
changeset
|
1485 /* First try NAME as literal. */ |
|
bcd053632eb2
(fontset_pattern_regexp): Cancel my previous change;
Kenichi Handa <handa@m17n.org>
parents:
57947
diff
changeset
|
1486 id = fs_query_fontset (name, 2); |
|
bcd053632eb2
(fontset_pattern_regexp): Cancel my previous change;
Kenichi Handa <handa@m17n.org>
parents:
57947
diff
changeset
|
1487 if (id < 0) |
|
bcd053632eb2
(fontset_pattern_regexp): Cancel my previous change;
Kenichi Handa <handa@m17n.org>
parents:
57947
diff
changeset
|
1488 /* For backward compatibility, try again NAME as pattern. */ |
|
bcd053632eb2
(fontset_pattern_regexp): Cancel my previous change;
Kenichi Handa <handa@m17n.org>
parents:
57947
diff
changeset
|
1489 id = fs_query_fontset (name, 0); |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1490 if (id < 0) |
|
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
45848
diff
changeset
|
1491 error ("Fontset `%s' does not exist", SDATA (name)); |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1492 return FONTSET_FROM_ID (id); |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1493 } |
| 17052 | 1494 |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1495 static void |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1496 accumulate_script_ranges (arg, range, val) |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1497 Lisp_Object arg, range, val; |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1498 { |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1499 if (EQ (XCAR (arg), val)) |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1500 { |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1501 if (CONSP (range)) |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1502 XSETCDR (arg, Fcons (Fcons (XCAR (range), XCDR (range)), XCDR (arg))); |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1503 else |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1504 XSETCDR (arg, Fcons (Fcons (range, range), XCDR (arg))); |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1505 } |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1506 } |
|
53353
b085f18ebcf0
(Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
53072
diff
changeset
|
1507 |
|
b085f18ebcf0
(Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
53072
diff
changeset
|
1508 |
|
89349
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1509 /* Return an ASCII font name generated from fontset name NAME and |
|
91169
8eb408860621
Include "font.h" unconditionally.
Kenichi Handa <handa@m17n.org>
parents:
91136
diff
changeset
|
1510 font-spec ASCII_SPEC. NAME is a string conforming to XLFD. */ |
|
89349
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1511 |
|
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1512 static INLINE Lisp_Object |
|
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1513 generate_ascii_font_name (name, ascii_spec) |
|
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1514 Lisp_Object name, ascii_spec; |
|
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1515 { |
|
91169
8eb408860621
Include "font.h" unconditionally.
Kenichi Handa <handa@m17n.org>
parents:
91136
diff
changeset
|
1516 Lisp_Object font_spec = Ffont_spec (0, NULL); |
|
89349
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1517 Lisp_Object vec; |
|
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1518 int i; |
|
91169
8eb408860621
Include "font.h" unconditionally.
Kenichi Handa <handa@m17n.org>
parents:
91136
diff
changeset
|
1519 char xlfd[256]; |
|
89349
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1520 |
|
91169
8eb408860621
Include "font.h" unconditionally.
Kenichi Handa <handa@m17n.org>
parents:
91136
diff
changeset
|
1521 if (font_parse_xlfd (SDATA (name), font_spec) < 0) |
|
8eb408860621
Include "font.h" unconditionally.
Kenichi Handa <handa@m17n.org>
parents:
91136
diff
changeset
|
1522 error ("Not an XLFD font name: %s", SDATA (name)); |
|
8eb408860621
Include "font.h" unconditionally.
Kenichi Handa <handa@m17n.org>
parents:
91136
diff
changeset
|
1523 for (i = FONT_FOUNDRY_INDEX; i <= FONT_WIDTH_INDEX; i++) |
|
89349
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1524 if (! NILP (AREF (ascii_spec, i))) |
|
91169
8eb408860621
Include "font.h" unconditionally.
Kenichi Handa <handa@m17n.org>
parents:
91136
diff
changeset
|
1525 ASET (font_spec, i, AREF (ascii_spec, i)); |
|
8eb408860621
Include "font.h" unconditionally.
Kenichi Handa <handa@m17n.org>
parents:
91136
diff
changeset
|
1526 i = font_unparse_xlfd (font_spec, 0, xlfd, 256); |
|
8eb408860621
Include "font.h" unconditionally.
Kenichi Handa <handa@m17n.org>
parents:
91136
diff
changeset
|
1527 if (i < 0) |
|
8eb408860621
Include "font.h" unconditionally.
Kenichi Handa <handa@m17n.org>
parents:
91136
diff
changeset
|
1528 error ("Not an XLFD font name: %s", SDATA (name)); |
|
8eb408860621
Include "font.h" unconditionally.
Kenichi Handa <handa@m17n.org>
parents:
91136
diff
changeset
|
1529 return make_unibyte_string (xlfd, i); |
|
53353
b085f18ebcf0
(Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
53072
diff
changeset
|
1530 } |
|
b085f18ebcf0
(Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
53072
diff
changeset
|
1531 |
|
89901
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1532 /* Variables referred in set_fontset_font. They are set before |
|
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1533 map_charset_chars is called in Fset_fontset_font. */ |
|
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1534 static Lisp_Object font_def_arg, add_arg; |
|
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1535 static int from_arg, to_arg; |
|
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1536 |
|
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1537 /* Callback function for map_charset_chars in Fset_fontset_font. In |
|
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1538 FONTSET, set font_def_arg in a fashion specified by add_arg for |
|
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1539 characters in RANGE while ignoring the range between from_arg and |
|
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1540 to_arg. */ |
|
41001
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
1541 |
|
89614
355fc0282e50
(set_fontset_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
89610
diff
changeset
|
1542 static void |
|
89901
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1543 set_fontset_font (fontset, range) |
|
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1544 Lisp_Object fontset, range; |
|
89614
355fc0282e50
(set_fontset_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
89610
diff
changeset
|
1545 { |
|
89901
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1546 if (from_arg < to_arg) |
|
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1547 { |
|
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1548 int from = XINT (XCAR (range)), to = XINT (XCDR (range)); |
|
89614
355fc0282e50
(set_fontset_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
89610
diff
changeset
|
1549 |
|
89901
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1550 if (from < from_arg) |
|
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1551 { |
|
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1552 if (to > to_arg) |
|
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1553 { |
|
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1554 Lisp_Object range2; |
|
41001
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
1555 |
|
89901
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1556 range2 = Fcons (make_number (to_arg), XCDR (range)); |
|
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1557 FONTSET_ADD (fontset, range, font_def_arg, add_arg); |
|
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1558 to = to_arg; |
|
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1559 } |
|
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1560 if (to > from_arg) |
|
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1561 range = Fcons (XCAR (range), make_number (from_arg)); |
|
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1562 } |
|
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1563 else if (to <= to_arg) |
|
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1564 return; |
|
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1565 else |
|
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1566 { |
|
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1567 if (from < to_arg) |
|
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1568 range = Fcons (make_number (to_arg), XCDR (range)); |
|
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1569 } |
|
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1570 } |
|
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1571 FONTSET_ADD (fontset, range, font_def_arg, add_arg); |
|
89614
355fc0282e50
(set_fontset_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
89610
diff
changeset
|
1572 } |
|
355fc0282e50
(set_fontset_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
89610
diff
changeset
|
1573 |
|
91136
d54684fee154
(fontset_find_font) [USE_FONT_BACKEND]: Try multiple
Kenichi Handa <handa@m17n.org>
parents:
91053
diff
changeset
|
1574 extern Lisp_Object QCfamily, QCregistry; |
|
89349
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1575 |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1576 DEFUN ("set-fontset-font", Fset_fontset_font, Sset_fontset_font, 3, 5, 0, |
| 89483 | 1577 doc: /* |
|
89805
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
1578 Modify fontset NAME to use FONT-SPEC for TARGET characters. |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1579 |
|
89805
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
1580 TARGET may be a cons; (FROM . TO), where FROM and TO are characters. |
|
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
1581 In that case, use FONT-SPEC for all characters in the range FROM and |
|
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
1582 TO (inclusive). |
| 88405 | 1583 |
|
89805
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
1584 TARGET may be a script name symbol. In that case, use FONT-SPEC for |
|
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
1585 all characters that belong to the script. |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1586 |
|
89805
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
1587 TARGET may be a charset. In that case, use FONT-SPEC for all |
|
89669
6871c119b186
(Fset_fontset_font): Fix docstring.
Kenichi Handa <handa@m17n.org>
parents:
89614
diff
changeset
|
1588 characters in the charset. |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1589 |
|
89805
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
1590 TARGET may be nil. In that case, use FONT-SPEC for any characters for |
|
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
1591 that no FONT-SPEC is specified. |
|
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
1592 |
|
89940
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
1593 FONT-SPEC may one of these: |
|
89337
6026c8e5664f
(Fset_fontset_font): Fix indentation of docstring.
Kenichi Handa <handa@m17n.org>
parents:
89069
diff
changeset
|
1594 * A cons (FAMILY . REGISTRY), where FAMILY is a font family name and |
|
89940
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
1595 REGISTRY is a font registry name. FAMILY may contains foundry |
|
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
1596 name, and REGISTRY may contains encoding name. |
|
88931
74d18470865c
(fontset_add): Declare args. Call make_number
Dave Love <fx@gnu.org>
parents:
88903
diff
changeset
|
1597 * A font name string. |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1598 |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1599 Optional 4th argument FRAME, if non-nil, is a frame. This argument is |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1600 kept for backward compatibility and has no meaning. |
| 88405 | 1601 |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1602 Optional 5th argument ADD, if non-nil, specifies how to add FONT-SPEC |
|
89805
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
1603 to the font specifications for TARGET previously set. If it is |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1604 `prepend', FONT-SPEC is prepended. If it is `append', FONT-SPEC is |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1605 appended. By default, FONT-SPEC overrides the previous settings. */) |
|
89805
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
1606 (name, target, font_spec, frame, add) |
|
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
1607 Lisp_Object name, target, font_spec, frame, add; |
| 17052 | 1608 { |
| 88405 | 1609 Lisp_Object fontset; |
|
90056
b0c203a8776d
(Fset_fontset_font): Call find_font_encoding with
Kenichi Handa <handa@m17n.org>
parents:
90044
diff
changeset
|
1610 Lisp_Object font_def, registry, family; |
|
88931
74d18470865c
(fontset_add): Declare args. Call make_number
Dave Love <fx@gnu.org>
parents:
88903
diff
changeset
|
1611 Lisp_Object encoding, repertory; |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1612 Lisp_Object range_list; |
|
89901
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1613 struct charset *charset = NULL; |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1614 |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1615 fontset = check_fontset_name (name); |
| 17052 | 1616 |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1617 /* 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
|
1618 the validity. */ |
| 17052 | 1619 if (!NILP (frame)) |
|
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Jan?k <Pavel@Janik.cz>
parents:
40028
diff
changeset
|
1620 CHECK_LIVE_FRAME (frame); |
| 17052 | 1621 |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1622 if (VECTORP (font_spec)) |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1623 { |
|
91169
8eb408860621
Include "font.h" unconditionally.
Kenichi Handa <handa@m17n.org>
parents:
91136
diff
changeset
|
1624 if (! FONT_SPEC_P (font_spec)) |
|
8eb408860621
Include "font.h" unconditionally.
Kenichi Handa <handa@m17n.org>
parents:
91136
diff
changeset
|
1625 Fsignal (Qfont, list2 (build_string ("invalid font-spec"), font_spec)); |
|
8eb408860621
Include "font.h" unconditionally.
Kenichi Handa <handa@m17n.org>
parents:
91136
diff
changeset
|
1626 family = Ffont_get (font_spec, QCfamily); |
|
8eb408860621
Include "font.h" unconditionally.
Kenichi Handa <handa@m17n.org>
parents:
91136
diff
changeset
|
1627 if (! NILP (family) && SYMBOLP (family)) |
|
8eb408860621
Include "font.h" unconditionally.
Kenichi Handa <handa@m17n.org>
parents:
91136
diff
changeset
|
1628 family = SYMBOL_NAME (family); |
|
8eb408860621
Include "font.h" unconditionally.
Kenichi Handa <handa@m17n.org>
parents:
91136
diff
changeset
|
1629 registry = Ffont_get (font_spec, QCregistry); |
|
8eb408860621
Include "font.h" unconditionally.
Kenichi Handa <handa@m17n.org>
parents:
91136
diff
changeset
|
1630 if (! NILP (registry) && SYMBOLP (registry)) |
|
8eb408860621
Include "font.h" unconditionally.
Kenichi Handa <handa@m17n.org>
parents:
91136
diff
changeset
|
1631 registry = SYMBOL_NAME (registry); |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1632 } |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1633 else if (CONSP (font_spec)) |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1634 { |
|
91169
8eb408860621
Include "font.h" unconditionally.
Kenichi Handa <handa@m17n.org>
parents:
91136
diff
changeset
|
1635 Lisp_Object args[4]; |
|
8eb408860621
Include "font.h" unconditionally.
Kenichi Handa <handa@m17n.org>
parents:
91136
diff
changeset
|
1636 int i= 0; |
|
8eb408860621
Include "font.h" unconditionally.
Kenichi Handa <handa@m17n.org>
parents:
91136
diff
changeset
|
1637 |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1638 family = XCAR (font_spec); |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1639 registry = XCDR (font_spec); |
| 17052 | 1640 |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1641 if (! NILP (family)) |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1642 { |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1643 CHECK_STRING (family); |
|
91169
8eb408860621
Include "font.h" unconditionally.
Kenichi Handa <handa@m17n.org>
parents:
91136
diff
changeset
|
1644 args[i++] = QCfamily; |
|
8eb408860621
Include "font.h" unconditionally.
Kenichi Handa <handa@m17n.org>
parents:
91136
diff
changeset
|
1645 args[i++] = family; |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1646 } |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1647 CHECK_STRING (registry); |
|
91169
8eb408860621
Include "font.h" unconditionally.
Kenichi Handa <handa@m17n.org>
parents:
91136
diff
changeset
|
1648 args[i++] = QCregistry; |
|
8eb408860621
Include "font.h" unconditionally.
Kenichi Handa <handa@m17n.org>
parents:
91136
diff
changeset
|
1649 args[i++] = registry; |
|
8eb408860621
Include "font.h" unconditionally.
Kenichi Handa <handa@m17n.org>
parents:
91136
diff
changeset
|
1650 font_spec = Ffont_spec (i, args); |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1651 } |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1652 else |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1653 { |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1654 CHECK_STRING (font_spec); |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1655 font_spec = Fdowncase (font_spec); |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1656 } |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1657 |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1658 if (STRINGP (font_spec)) |
|
90034
dbbe513cabef
(fs_load_font): Use fast_string_match_ignore_case
Kenichi Handa <handa@m17n.org>
parents:
90033
diff
changeset
|
1659 encoding = find_font_encoding (font_spec); |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1660 else |
|
90056
b0c203a8776d
(Fset_fontset_font): Call find_font_encoding with
Kenichi Handa <handa@m17n.org>
parents:
90044
diff
changeset
|
1661 encoding = find_font_encoding (concat2 (family, registry)); |
| 90410 | 1662 if (NILP (encoding)) |
| 1663 encoding = Qascii; | |
| 1664 | |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1665 if (SYMBOLP (encoding)) |
|
89826
b17725d55ba2
(Fset_fontset_font): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
89811
diff
changeset
|
1666 { |
|
b17725d55ba2
(Fset_fontset_font): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
89811
diff
changeset
|
1667 CHECK_CHARSET (encoding); |
|
b17725d55ba2
(Fset_fontset_font): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
89811
diff
changeset
|
1668 encoding = repertory = CHARSET_SYMBOL_ID (encoding); |
|
b17725d55ba2
(Fset_fontset_font): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
89811
diff
changeset
|
1669 } |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1670 else |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1671 { |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1672 repertory = XCDR (encoding); |
|
89826
b17725d55ba2
(Fset_fontset_font): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
89811
diff
changeset
|
1673 encoding = XCAR (encoding); |
|
b17725d55ba2
(Fset_fontset_font): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
89811
diff
changeset
|
1674 CHECK_CHARSET (encoding); |
|
b17725d55ba2
(Fset_fontset_font): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
89811
diff
changeset
|
1675 encoding = CHARSET_SYMBOL_ID (encoding); |
|
b17725d55ba2
(Fset_fontset_font): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
89811
diff
changeset
|
1676 if (! NILP (repertory) && SYMBOLP (repertory)) |
| 17052 | 1677 { |
|
89826
b17725d55ba2
(Fset_fontset_font): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
89811
diff
changeset
|
1678 CHECK_CHARSET (repertory); |
|
b17725d55ba2
(Fset_fontset_font): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
89811
diff
changeset
|
1679 repertory = CHARSET_SYMBOL_ID (repertory); |
| 17052 | 1680 } |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1681 } |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1682 font_def = Fmake_vector (make_number (3), font_spec); |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1683 ASET (font_def, 1, encoding); |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1684 ASET (font_def, 2, repertory); |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1685 |
|
89805
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
1686 if (CHARACTERP (target)) |
|
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
1687 range_list = Fcons (Fcons (target, target), Qnil); |
|
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
1688 else if (CONSP (target)) |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1689 { |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1690 Lisp_Object from, to; |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1691 |
|
89805
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
1692 from = Fcar (target); |
|
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
1693 to = Fcdr (target); |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1694 CHECK_CHARACTER (from); |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1695 CHECK_CHARACTER (to); |
|
89805
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
1696 range_list = Fcons (target, Qnil); |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1697 } |
|
89805
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
1698 else if (SYMBOLP (target) && !NILP (target)) |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1699 { |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1700 Lisp_Object script_list; |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1701 Lisp_Object val; |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1702 |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1703 range_list = Qnil; |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1704 script_list = XCHAR_TABLE (Vchar_script_table)->extras[0]; |
|
89805
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
1705 if (! NILP (Fmemq (target, script_list))) |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1706 { |
|
89805
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
1707 val = Fcons (target, Qnil); |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1708 map_char_table (accumulate_script_ranges, Qnil, Vchar_script_table, |
| 89483 | 1709 val); |
| 1710 range_list = XCDR (val); | |
| 90642 | 1711 if (EQ (target, Qlatin)) |
| 1712 { | |
| 1713 if (VECTORP (font_spec)) | |
| 1714 val = generate_ascii_font_name (FONTSET_NAME (fontset), | |
| 1715 font_spec); | |
| 1716 else | |
| 1717 val = font_spec; | |
| 1718 FONTSET_ASCII (fontset) = val; | |
| 1719 } | |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1720 } |
|
89901
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1721 if (CHARSETP (target)) |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1722 { |
|
89805
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
1723 if (EQ (target, Qascii)) |
|
89006
faa38aebf129
(Fset_fontset_font): Treate `ascii' as charset, not script.
Kenichi Handa <handa@m17n.org>
parents:
88982
diff
changeset
|
1724 { |
|
89349
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1725 if (VECTORP (font_spec)) |
|
89006
faa38aebf129
(Fset_fontset_font): Treate `ascii' as charset, not script.
Kenichi Handa <handa@m17n.org>
parents:
88982
diff
changeset
|
1726 font_spec = generate_ascii_font_name (FONTSET_NAME (fontset), |
|
faa38aebf129
(Fset_fontset_font): Treate `ascii' as charset, not script.
Kenichi Handa <handa@m17n.org>
parents:
88982
diff
changeset
|
1727 font_spec); |
|
faa38aebf129
(Fset_fontset_font): Treate `ascii' as charset, not script.
Kenichi Handa <handa@m17n.org>
parents:
88982
diff
changeset
|
1728 FONTSET_ASCII (fontset) = font_spec; |
|
89614
355fc0282e50
(set_fontset_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
89610
diff
changeset
|
1729 range_list = Fcons (Fcons (make_number (0), make_number (127)), |
|
355fc0282e50
(set_fontset_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
89610
diff
changeset
|
1730 Qnil); |
|
355fc0282e50
(set_fontset_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
89610
diff
changeset
|
1731 } |
|
355fc0282e50
(set_fontset_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
89610
diff
changeset
|
1732 else |
|
355fc0282e50
(set_fontset_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
89610
diff
changeset
|
1733 { |
|
89901
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1734 CHECK_CHARSET_GET_CHARSET (target, charset); |
|
89006
faa38aebf129
(Fset_fontset_font): Treate `ascii' as charset, not script.
Kenichi Handa <handa@m17n.org>
parents:
88982
diff
changeset
|
1735 } |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1736 } |
|
89901
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1737 else if (NILP (range_list)) |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1738 error ("Invalid script or charset name: %s", |
|
89805
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
1739 SDATA (SYMBOL_NAME (target))); |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1740 } |
|
89805
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
1741 else if (NILP (target)) |
|
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
1742 range_list = Fcons (Qnil, Qnil); |
|
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
1743 else |
|
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
1744 error ("Invalid target for setting a font"); |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1745 |
|
89901
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1746 |
|
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1747 if (charset) |
|
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1748 { |
|
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1749 font_def_arg = font_def; |
|
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1750 add_arg = add; |
|
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1751 if (NILP (range_list)) |
|
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1752 from_arg = to_arg = 0; |
|
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1753 else |
|
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1754 from_arg = XINT (XCAR (XCAR (range_list))), |
|
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1755 to_arg = XINT (XCDR (XCAR (range_list))); |
|
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1756 |
|
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1757 map_charset_chars (set_fontset_font, Qnil, fontset, charset, |
|
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1758 CHARSET_MIN_CODE (charset), |
|
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1759 CHARSET_MAX_CODE (charset)); |
|
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1760 } |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1761 for (; CONSP (range_list); range_list = XCDR (range_list)) |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1762 FONTSET_ADD (fontset, XCAR (range_list), font_def, add); |
| 17052 | 1763 |
| 88405 | 1764 /* Free all realized fontsets whose base is FONTSET. This way, the |
| 1765 specified character(s) are surely redisplayed by a correct | |
| 1766 font. */ | |
| 1767 free_realized_fontsets (fontset); | |
| 17052 | 1768 |
| 1769 return Qnil; | |
| 1770 } | |
| 1771 | |
| 88405 | 1772 |
| 1773 DEFUN ("new-fontset", Fnew_fontset, Snew_fontset, 2, 2, 0, | |
| 1774 doc: /* Create a new fontset NAME from font information in FONTLIST. | |
| 1775 | |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1776 FONTLIST is an alist of scripts vs the corresponding font specification list. |
|
89349
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1777 Each element of FONTLIST has the form (SCRIPT FONT-SPEC ...), where a |
|
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1778 character of SCRIPT is displayed by a font that matches one of |
|
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1779 FONT-SPEC. |
| 88405 | 1780 |
|
89349
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1781 SCRIPT is a symbol that appears in the first extra slot of the |
|
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1782 char-table `char-script-table'. |
| 88405 | 1783 |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1784 FONT-SPEC is a vector, a cons, or a string. See the documentation of |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1785 `set-fontset-font' for the meaning. */) |
| 88405 | 1786 (name, fontlist) |
| 1787 Lisp_Object name, fontlist; | |
| 1788 { | |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1789 Lisp_Object fontset; |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1790 Lisp_Object val; |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1791 int id; |
| 88405 | 1792 |
| 1793 CHECK_STRING (name); | |
| 1794 CHECK_LIST (fontlist); | |
| 1795 | |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1796 id = fs_query_fontset (name, 0); |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1797 if (id < 0) |
|
89349
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1798 { |
|
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1799 name = Fdowncase (name); |
|
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1800 val = split_font_name_into_vector (name); |
|
89603
7f9f2d025eee
(Fnew_fontset): Check NAME more rigidly.
Kenichi Handa <handa@m17n.org>
parents:
89572
diff
changeset
|
1801 if (NILP (val) || NILP (AREF (val, 12)) || NILP (AREF (val, 13))) |
|
89349
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1802 error ("Fontset name must be in XLFD format"); |
| 89483 | 1803 if (strcmp (SDATA (AREF (val, 12)), "fontset")) |
|
89349
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1804 error ("Registry field of fontset name must be \"fontset\""); |
|
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1805 Vfontset_alias_alist |
|
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1806 = Fcons (Fcons (name, |
|
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1807 concat2 (concat2 (AREF (val, 12), build_string ("-")), |
|
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1808 AREF (val, 13))), |
|
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1809 Vfontset_alias_alist); |
|
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1810 ASET (val, 12, build_string ("iso8859-1")); |
|
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1811 fontset = make_fontset (Qnil, name, Qnil); |
|
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1812 FONTSET_ASCII (fontset) = build_font_name_from_vector (val); |
|
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1813 } |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1814 else |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1815 { |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1816 fontset = FONTSET_FROM_ID (id);; |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1817 free_realized_fontsets (fontset); |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1818 Fset_char_table_range (fontset, Qt, Qnil); |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1819 } |
| 88405 | 1820 |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1821 for (; ! NILP (fontlist); fontlist = Fcdr (fontlist)) |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1822 { |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1823 Lisp_Object elt, script; |
| 88405 | 1824 |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1825 elt = Fcar (fontlist); |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1826 script = Fcar (elt); |
|
89607
9090f7eba02c
(Fnew_fontset): Check NAME more rigidly.
Kenichi Handa <handa@m17n.org>
parents:
89603
diff
changeset
|
1827 elt = Fcdr (elt); |
|
9090f7eba02c
(Fnew_fontset): Check NAME more rigidly.
Kenichi Handa <handa@m17n.org>
parents:
89603
diff
changeset
|
1828 if (CONSP (elt) && (NILP (XCDR (elt)) || CONSP (XCDR (elt)))) |
|
9090f7eba02c
(Fnew_fontset): Check NAME more rigidly.
Kenichi Handa <handa@m17n.org>
parents:
89603
diff
changeset
|
1829 for (; CONSP (elt); elt = XCDR (elt)) |
|
9090f7eba02c
(Fnew_fontset): Check NAME more rigidly.
Kenichi Handa <handa@m17n.org>
parents:
89603
diff
changeset
|
1830 Fset_fontset_font (name, script, XCAR (elt), Qnil, Qappend); |
|
9090f7eba02c
(Fnew_fontset): Check NAME more rigidly.
Kenichi Handa <handa@m17n.org>
parents:
89603
diff
changeset
|
1831 else |
|
9090f7eba02c
(Fnew_fontset): Check NAME more rigidly.
Kenichi Handa <handa@m17n.org>
parents:
89603
diff
changeset
|
1832 Fset_fontset_font (name, script, elt, Qnil, Qappend); |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1833 } |
| 88405 | 1834 return name; |
| 1835 } | |
| 1836 | |
| 1837 | |
|
89610
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
1838 /* Alist of automatically created fontsets. Each element is a cons |
|
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
1839 (FONTNAME . FONTSET-ID). */ |
|
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
1840 static Lisp_Object auto_fontset_alist; |
|
89349
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1841 |
|
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1842 int |
|
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1843 new_fontset_from_font_name (Lisp_Object fontname) |
|
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1844 { |
|
89610
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
1845 Lisp_Object val; |
|
89349
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1846 Lisp_Object name; |
|
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1847 Lisp_Object vec; |
|
89610
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
1848 int id; |
|
89349
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1849 |
|
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1850 fontname = Fdowncase (fontname); |
|
89610
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
1851 val = Fassoc (fontname, auto_fontset_alist); |
|
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
1852 if (CONSP (val)) |
|
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
1853 return XINT (XCDR (val)); |
|
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
1854 |
|
89349
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1855 vec = split_font_name_into_vector (fontname); |
|
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1856 if ( NILP (vec)) |
|
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1857 vec = Fmake_vector (make_number (14), build_string ("")); |
|
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1858 ASET (vec, 12, build_string ("fontset")); |
|
89610
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
1859 if (NILP (auto_fontset_alist)) |
|
89349
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1860 { |
|
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1861 ASET (vec, 13, build_string ("startup")); |
|
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1862 name = build_font_name_from_vector (vec); |
|
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1863 } |
|
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1864 else |
|
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1865 { |
|
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1866 char temp[20]; |
| 89865 | 1867 int len = XINT (Flength (auto_fontset_alist)); |
|
89349
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1868 |
|
89610
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
1869 sprintf (temp, "auto%d", len); |
|
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
1870 ASET (vec, 13, build_string (temp)); |
|
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
1871 name = build_font_name_from_vector (vec); |
|
89349
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1872 } |
|
89901
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1873 name = Fnew_fontset (name, list2 (list2 (Qascii, fontname), |
|
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1874 list2 (Fcons (make_number (0), |
|
89711
fca3686ff6bb
(new_fontset_from_font_name): Use the specified font
Kenichi Handa <handa@m17n.org>
parents:
89699
diff
changeset
|
1875 make_number (MAX_CHAR)), |
|
89901
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1876 fontname))); |
|
89610
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
1877 id = fs_query_fontset (name, 0); |
|
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
1878 auto_fontset_alist |
|
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
1879 = Fcons (Fcons (fontname, make_number (id)), auto_fontset_alist); |
|
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
1880 return id; |
|
89349
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1881 } |
|
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1882 |
| 90410 | 1883 #ifdef USE_FONT_BACKEND |
| 1884 int | |
|
90466
4c9461c6aef4
(new_fontset_from_font) [USE_FONT_BACKEND]: Argument F
Kenichi Handa <handa@m17n.org>
parents:
90449
diff
changeset
|
1885 new_fontset_from_font (font_object) |
| 90410 | 1886 Lisp_Object font_object; |
| 1887 { | |
|
90466
4c9461c6aef4
(new_fontset_from_font) [USE_FONT_BACKEND]: Argument F
Kenichi Handa <handa@m17n.org>
parents:
90449
diff
changeset
|
1888 Lisp_Object font_name = font_get_name (font_object); |
|
4c9461c6aef4
(new_fontset_from_font) [USE_FONT_BACKEND]: Argument F
Kenichi Handa <handa@m17n.org>
parents:
90449
diff
changeset
|
1889 Lisp_Object font_spec = font_get_spec (font_object); |
|
90802
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
1890 Lisp_Object fontset_spec, short_name, name, fontset; |
|
90466
4c9461c6aef4
(new_fontset_from_font) [USE_FONT_BACKEND]: Argument F
Kenichi Handa <handa@m17n.org>
parents:
90449
diff
changeset
|
1891 |
|
4c9461c6aef4
(new_fontset_from_font) [USE_FONT_BACKEND]: Argument F
Kenichi Handa <handa@m17n.org>
parents:
90449
diff
changeset
|
1892 if (NILP (auto_fontset_alist)) |
|
4c9461c6aef4
(new_fontset_from_font) [USE_FONT_BACKEND]: Argument F
Kenichi Handa <handa@m17n.org>
parents:
90449
diff
changeset
|
1893 short_name = build_string ("fontset-startup"); |
|
4c9461c6aef4
(new_fontset_from_font) [USE_FONT_BACKEND]: Argument F
Kenichi Handa <handa@m17n.org>
parents:
90449
diff
changeset
|
1894 else |
|
4c9461c6aef4
(new_fontset_from_font) [USE_FONT_BACKEND]: Argument F
Kenichi Handa <handa@m17n.org>
parents:
90449
diff
changeset
|
1895 { |
|
4c9461c6aef4
(new_fontset_from_font) [USE_FONT_BACKEND]: Argument F
Kenichi Handa <handa@m17n.org>
parents:
90449
diff
changeset
|
1896 char temp[32]; |
|
4c9461c6aef4
(new_fontset_from_font) [USE_FONT_BACKEND]: Argument F
Kenichi Handa <handa@m17n.org>
parents:
90449
diff
changeset
|
1897 int len = XINT (Flength (auto_fontset_alist)); |
| 90410 | 1898 |
|
90466
4c9461c6aef4
(new_fontset_from_font) [USE_FONT_BACKEND]: Argument F
Kenichi Handa <handa@m17n.org>
parents:
90449
diff
changeset
|
1899 sprintf (temp, "fontset-auto%d", len); |
|
4c9461c6aef4
(new_fontset_from_font) [USE_FONT_BACKEND]: Argument F
Kenichi Handa <handa@m17n.org>
parents:
90449
diff
changeset
|
1900 short_name = build_string (temp); |
|
4c9461c6aef4
(new_fontset_from_font) [USE_FONT_BACKEND]: Argument F
Kenichi Handa <handa@m17n.org>
parents:
90449
diff
changeset
|
1901 } |
|
90802
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
1902 fontset_spec = Fcopy_sequence (font_spec); |
|
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
1903 ASET (fontset_spec, FONT_REGISTRY_INDEX, short_name); |
|
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
1904 name = Ffont_xlfd_name (fontset_spec); |
|
90466
4c9461c6aef4
(new_fontset_from_font) [USE_FONT_BACKEND]: Argument F
Kenichi Handa <handa@m17n.org>
parents:
90449
diff
changeset
|
1905 if (NILP (name)) |
|
4c9461c6aef4
(new_fontset_from_font) [USE_FONT_BACKEND]: Argument F
Kenichi Handa <handa@m17n.org>
parents:
90449
diff
changeset
|
1906 { |
|
4c9461c6aef4
(new_fontset_from_font) [USE_FONT_BACKEND]: Argument F
Kenichi Handa <handa@m17n.org>
parents:
90449
diff
changeset
|
1907 int i; |
| 90410 | 1908 |
|
90466
4c9461c6aef4
(new_fontset_from_font) [USE_FONT_BACKEND]: Argument F
Kenichi Handa <handa@m17n.org>
parents:
90449
diff
changeset
|
1909 for (i = 0; i < FONT_SIZE_INDEX; i++) |
|
4c9461c6aef4
(new_fontset_from_font) [USE_FONT_BACKEND]: Argument F
Kenichi Handa <handa@m17n.org>
parents:
90449
diff
changeset
|
1910 if ((i != FONT_FAMILY_INDEX) && (i != FONT_REGISTRY_INDEX)) |
|
90802
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
1911 ASET (fontset_spec, i, Qnil); |
|
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
1912 name = Ffont_xlfd_name (fontset_spec); |
|
90466
4c9461c6aef4
(new_fontset_from_font) [USE_FONT_BACKEND]: Argument F
Kenichi Handa <handa@m17n.org>
parents:
90449
diff
changeset
|
1913 if (NILP (name)) |
|
4c9461c6aef4
(new_fontset_from_font) [USE_FONT_BACKEND]: Argument F
Kenichi Handa <handa@m17n.org>
parents:
90449
diff
changeset
|
1914 abort (); |
|
4c9461c6aef4
(new_fontset_from_font) [USE_FONT_BACKEND]: Argument F
Kenichi Handa <handa@m17n.org>
parents:
90449
diff
changeset
|
1915 } |
|
4c9461c6aef4
(new_fontset_from_font) [USE_FONT_BACKEND]: Argument F
Kenichi Handa <handa@m17n.org>
parents:
90449
diff
changeset
|
1916 fontset = make_fontset (Qnil, name, Qnil); |
|
4c9461c6aef4
(new_fontset_from_font) [USE_FONT_BACKEND]: Argument F
Kenichi Handa <handa@m17n.org>
parents:
90449
diff
changeset
|
1917 FONTSET_ASCII (fontset) = font_name; |
|
90802
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
1918 font_spec = Fcons (SYMBOL_NAME (AREF (font_spec, FONT_FAMILY_INDEX)), |
|
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
1919 SYMBOL_NAME (AREF (font_spec, FONT_REGISTRY_INDEX))); |
|
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
1920 Fset_fontset_font (name, Qlatin, font_spec, Qnil, Qnil); |
|
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
1921 Fset_fontset_font (name, Qnil, font_spec, Qnil, Qnil); |
|
90466
4c9461c6aef4
(new_fontset_from_font) [USE_FONT_BACKEND]: Argument F
Kenichi Handa <handa@m17n.org>
parents:
90449
diff
changeset
|
1922 return XINT (FONTSET_ID (fontset)); |
| 90410 | 1923 } |
| 1924 | |
| 1925 struct font * | |
| 1926 fontset_ascii_font (f, id) | |
| 1927 FRAME_PTR f; | |
| 1928 int id; | |
| 1929 { | |
| 1930 Lisp_Object fontset = FONTSET_FROM_ID (id); | |
| 1931 Lisp_Object ascii_slot = FONTSET_ASCII (fontset); | |
| 1932 Lisp_Object val, font_object; | |
| 1933 | |
| 1934 if (CONSP (ascii_slot)) | |
| 1935 { | |
| 1936 Lisp_Object ascii_font_name = XCAR (ascii_slot); | |
| 1937 | |
| 1938 font_object = Qnil; | |
| 1939 for (val = XCDR (ascii_slot); ! NILP (val); val = XCDR (val)) | |
| 1940 { | |
| 1941 Lisp_Object frame = font_get_frame (XCAR (val)); | |
| 1942 | |
| 1943 if (NILP (frame) || XFRAME (frame) == f) | |
| 1944 { | |
| 1945 font_object = XCAR (val); | |
| 1946 if (XSAVE_VALUE (font_object)->integer == 0) | |
| 1947 { | |
| 1948 font_object = font_open_by_name (f, SDATA (ascii_font_name)); | |
| 1949 XSETCAR (val, font_object); | |
| 1950 } | |
| 1951 break; | |
| 1952 } | |
| 1953 } | |
| 1954 if (NILP (font_object)) | |
| 1955 { | |
| 1956 font_object = font_open_by_name (f, SDATA (ascii_font_name)); | |
| 1957 XSETCDR (ascii_slot, Fcons (font_object, XCDR (ascii_slot))); | |
| 1958 } | |
| 1959 } | |
| 1960 else | |
| 1961 { | |
| 1962 font_object = font_open_by_name (f, SDATA (ascii_slot)); | |
| 1963 FONTSET_ASCII (fontset) = Fcons (ascii_slot, Fcons (font_object, Qnil)); | |
| 1964 } | |
|
90440
33277d7748f3
(reorder_font_vector): Pay attention to the case that
Kenichi Handa <handa@m17n.org>
parents:
90410
diff
changeset
|
1965 if (NILP (font_object)) |
|
33277d7748f3
(reorder_font_vector): Pay attention to the case that
Kenichi Handa <handa@m17n.org>
parents:
90410
diff
changeset
|
1966 return NULL; |
| 90410 | 1967 return XSAVE_VALUE (font_object)->pointer; |
| 1968 } | |
| 1969 | |
| 1970 #endif /* USE_FONT_BACKEND */ | |
|
89349
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1971 |
| 17052 | 1972 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
|
1973 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
|
1974 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
|
1975 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
|
1976 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
|
1977 where |
|
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
1978 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
|
1979 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
|
1980 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
|
1981 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
|
1982 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
|
1983 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
|
1984 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
|
1985 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
|
1986 (name, frame) |
| 17052 | 1987 Lisp_Object name, frame; |
| 1988 { | |
| 1989 FRAME_PTR f; | |
| 1990 struct font_info *fontp; | |
| 1991 Lisp_Object info; | |
| 90410 | 1992 Lisp_Object font_object; |
| 17052 | 1993 |
| 1994 (*check_window_system_func) (); | |
| 1995 | |
|
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Jan?k <Pavel@Janik.cz>
parents:
40028
diff
changeset
|
1996 CHECK_STRING (name); |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1997 name = Fdowncase (name); |
| 17052 | 1998 if (NILP (frame)) |
|
25668
99290b59352d
(Ffont_info): Change for Lisp_Object selected_frame.
Gerd Moellmann <gerd@gnu.org>
parents:
24611
diff
changeset
|
1999 frame = selected_frame; |
|
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Jan?k <Pavel@Janik.cz>
parents:
40028
diff
changeset
|
2000 CHECK_LIVE_FRAME (frame); |
|
25668
99290b59352d
(Ffont_info): Change for Lisp_Object selected_frame.
Gerd Moellmann <gerd@gnu.org>
parents:
24611
diff
changeset
|
2001 f = XFRAME (frame); |
| 17052 | 2002 |
| 2003 if (!query_font_func) | |
| 2004 error ("Font query function is not supported"); | |
| 2005 | |
| 90410 | 2006 #ifdef USE_FONT_BACKEND |
| 2007 if (enable_font_backend) | |
| 2008 { | |
| 2009 font_object = font_open_by_name (f, SDATA (name)); | |
| 2010 if (NILP (font_object)) | |
| 2011 fontp = NULL; | |
| 2012 else | |
| 2013 fontp = (struct font_info *) XSAVE_VALUE (font_object)->pointer; | |
| 2014 } | |
| 2015 else | |
| 2016 #endif /* USE_FONT_BACKEND */ | |
|
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
45848
diff
changeset
|
2017 fontp = (*query_font_func) (f, SDATA (name)); |
| 17052 | 2018 if (!fontp) |
| 2019 return Qnil; | |
| 2020 | |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
2021 info = Fmake_vector (make_number (7), Qnil); |
| 17052 | 2022 |
| 2023 XVECTOR (info)->contents[0] = build_string (fontp->name); | |
| 2024 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
|
2025 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
|
2026 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
|
2027 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
|
2028 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
|
2029 XVECTOR (info)->contents[6] = make_number (fontp->default_ascent); |
| 17052 | 2030 |
| 90410 | 2031 #ifdef USE_FONT_BACKEND |
| 2032 if (! NILP (font_object)) | |
| 2033 font_close_object (f, font_object); | |
| 2034 #endif /* USE_FONT_BACKEND */ | |
| 17052 | 2035 return info; |
| 2036 } | |
| 2037 | |
| 28963 | 2038 |
|
52654
2e5944e29aa0
(Finternal_char_font): Change return value to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
2039 /* Return a cons (FONT-NAME . GLYPH-CODE). |
|
2e5944e29aa0
(Finternal_char_font): Change return value to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
2040 FONT-NAME is the font name for the character at POSITION in the current |
| 28963 | 2041 buffer. This is computed from all the text properties and overlays |
|
55094
450b41d3c078
(Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents:
54995
diff
changeset
|
2042 that apply to POSITION. POSTION may be nil, in which case, |
|
450b41d3c078
(Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents:
54995
diff
changeset
|
2043 FONT-NAME is the font name for display the character CH with the |
|
450b41d3c078
(Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents:
54995
diff
changeset
|
2044 default face. |
|
450b41d3c078
(Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents:
54995
diff
changeset
|
2045 |
|
52654
2e5944e29aa0
(Finternal_char_font): Change return value to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
2046 GLYPH-CODE is the glyph code in the font to use for the character. |
|
2e5944e29aa0
(Finternal_char_font): Change return value to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
2047 |
|
2e5944e29aa0
(Finternal_char_font): Change return value to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
2048 If the 2nd optional arg CH is non-nil, it is a character to check |
|
2e5944e29aa0
(Finternal_char_font): Change return value to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
2049 the font instead of the character at POSITION. |
|
2e5944e29aa0
(Finternal_char_font): Change return value to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
2050 |
|
2e5944e29aa0
(Finternal_char_font): Change return value to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
2051 It returns nil in the following cases: |
| 28963 | 2052 |
| 2053 (1) The window system doesn't have a font for the character (thus | |
| 2054 it is displayed by an empty box). | |
| 2055 | |
| 2056 (2) The character code is invalid. | |
| 2057 | |
|
55094
450b41d3c078
(Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents:
54995
diff
changeset
|
2058 (3) If POSITION is not nil, and the current buffer is not displayed |
|
450b41d3c078
(Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents:
54995
diff
changeset
|
2059 in any window. |
| 28963 | 2060 |
| 2061 In addition, the returned font name may not take into account of | |
| 2062 such redisplay engine hooks as what used in jit-lock-mode if | |
| 2063 POSITION is currently not visible. */ | |
| 2064 | |
| 2065 | |
|
52654
2e5944e29aa0
(Finternal_char_font): Change return value to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
2066 DEFUN ("internal-char-font", Finternal_char_font, Sinternal_char_font, 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
|
2067 doc: /* For internal use only. */) |
|
52654
2e5944e29aa0
(Finternal_char_font): Change return value to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
2068 (position, ch) |
|
2e5944e29aa0
(Finternal_char_font): Change return value to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
2069 Lisp_Object position, ch; |
| 28963 | 2070 { |
| 2071 int pos, pos_byte, dummy; | |
| 2072 int face_id; | |
| 2073 int c; | |
| 2074 struct frame *f; | |
| 2075 struct face *face; | |
|
89898
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
2076 Lisp_Object charset, rfont_def; |
|
90725
6d8c81691fc8
(Finternal_char_font): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
90716
diff
changeset
|
2077 int cs_id; |
| 28963 | 2078 |
|
55094
450b41d3c078
(Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents:
54995
diff
changeset
|
2079 if (NILP (position)) |
|
52654
2e5944e29aa0
(Finternal_char_font): Change return value to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
2080 { |
| 89904 | 2081 CHECK_CHARACTER (ch); |
|
52654
2e5944e29aa0
(Finternal_char_font): Change return value to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
2082 c = XINT (ch); |
|
55094
450b41d3c078
(Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents:
54995
diff
changeset
|
2083 f = XFRAME (selected_frame); |
|
450b41d3c078
(Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents:
54995
diff
changeset
|
2084 face_id = DEFAULT_FACE_ID; |
|
89943
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
2085 pos = -1; |
|
90725
6d8c81691fc8
(Finternal_char_font): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
90716
diff
changeset
|
2086 cs_id = -1; |
|
55094
450b41d3c078
(Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents:
54995
diff
changeset
|
2087 } |
|
450b41d3c078
(Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents:
54995
diff
changeset
|
2088 else |
|
450b41d3c078
(Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents:
54995
diff
changeset
|
2089 { |
|
90716
f5dc0b9a442c
(Finternal_char_font): Fix for the case of POSITION
Kenichi Handa <handa@m17n.org>
parents:
90642
diff
changeset
|
2090 Lisp_Object window, charset; |
|
55094
450b41d3c078
(Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents:
54995
diff
changeset
|
2091 struct window *w; |
|
450b41d3c078
(Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents:
54995
diff
changeset
|
2092 |
|
450b41d3c078
(Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents:
54995
diff
changeset
|
2093 CHECK_NUMBER_COERCE_MARKER (position); |
|
450b41d3c078
(Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents:
54995
diff
changeset
|
2094 pos = XINT (position); |
|
450b41d3c078
(Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents:
54995
diff
changeset
|
2095 if (pos < BEGV || pos >= ZV) |
|
450b41d3c078
(Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents:
54995
diff
changeset
|
2096 args_out_of_range_3 (position, make_number (BEGV), make_number (ZV)); |
|
450b41d3c078
(Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents:
54995
diff
changeset
|
2097 pos_byte = CHAR_TO_BYTE (pos); |
|
450b41d3c078
(Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents:
54995
diff
changeset
|
2098 if (NILP (ch)) |
|
450b41d3c078
(Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents:
54995
diff
changeset
|
2099 c = FETCH_CHAR (pos_byte); |
|
450b41d3c078
(Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents:
54995
diff
changeset
|
2100 else |
|
450b41d3c078
(Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents:
54995
diff
changeset
|
2101 { |
|
450b41d3c078
(Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents:
54995
diff
changeset
|
2102 CHECK_NATNUM (ch); |
|
450b41d3c078
(Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents:
54995
diff
changeset
|
2103 c = XINT (ch); |
|
450b41d3c078
(Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents:
54995
diff
changeset
|
2104 } |
|
450b41d3c078
(Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents:
54995
diff
changeset
|
2105 window = Fget_buffer_window (Fcurrent_buffer (), Qnil); |
|
450b41d3c078
(Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents:
54995
diff
changeset
|
2106 if (NILP (window)) |
|
450b41d3c078
(Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents:
54995
diff
changeset
|
2107 return Qnil; |
|
450b41d3c078
(Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents:
54995
diff
changeset
|
2108 w = XWINDOW (window); |
|
450b41d3c078
(Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents:
54995
diff
changeset
|
2109 f = XFRAME (w->frame); |
|
450b41d3c078
(Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents:
54995
diff
changeset
|
2110 face_id = face_at_buffer_position (w, pos, -1, -1, &dummy, pos + 100, 0); |
|
90716
f5dc0b9a442c
(Finternal_char_font): Fix for the case of POSITION
Kenichi Handa <handa@m17n.org>
parents:
90642
diff
changeset
|
2111 charset = Fget_char_property (position, Qcharset, Qnil); |
|
f5dc0b9a442c
(Finternal_char_font): Fix for the case of POSITION
Kenichi Handa <handa@m17n.org>
parents:
90642
diff
changeset
|
2112 if (CHARSETP (charset)) |
|
90725
6d8c81691fc8
(Finternal_char_font): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
90716
diff
changeset
|
2113 cs_id = XINT (CHARSET_SYMBOL_ID (charset)); |
|
90716
f5dc0b9a442c
(Finternal_char_font): Fix for the case of POSITION
Kenichi Handa <handa@m17n.org>
parents:
90642
diff
changeset
|
2114 else |
|
90725
6d8c81691fc8
(Finternal_char_font): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
90716
diff
changeset
|
2115 cs_id = -1; |
|
52654
2e5944e29aa0
(Finternal_char_font): Change return value to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
2116 } |
| 28963 | 2117 if (! CHAR_VALID_P (c, 0)) |
| 2118 return Qnil; | |
|
89943
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
2119 face_id = FACE_FOR_CHAR (f, FACE_FROM_ID (f, face_id), c, pos, Qnil); |
| 28963 | 2120 face = FACE_FROM_ID (f, face_id); |
|
90725
6d8c81691fc8
(Finternal_char_font): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
90716
diff
changeset
|
2121 rfont_def = fontset_font (FONTSET_FROM_ID (face->fontset), c, face, cs_id); |
| 90410 | 2122 #ifdef USE_FONT_BACKEND |
| 2123 if (enable_font_backend) | |
| 2124 { | |
|
91136
d54684fee154
(fontset_find_font) [USE_FONT_BACKEND]: Try multiple
Kenichi Handa <handa@m17n.org>
parents:
91053
diff
changeset
|
2125 if (VECTORP (rfont_def) && ! NILP (AREF (rfont_def, 3))) |
| 90410 | 2126 { |
|
91136
d54684fee154
(fontset_find_font) [USE_FONT_BACKEND]: Try multiple
Kenichi Handa <handa@m17n.org>
parents:
91053
diff
changeset
|
2127 Lisp_Object font_object = XCAR (AREF (rfont_def, 3)); |
| 90410 | 2128 struct font *font = XSAVE_VALUE (font_object)->pointer; |
| 2129 unsigned code = font->driver->encode_char (font, c); | |
|
90475
b19205fb08bd
(Finternal_char_font): Use font_get_name, not
Kenichi Handa <handa@m17n.org>
parents:
90466
diff
changeset
|
2130 Lisp_Object fontname = font_get_name (font_object); |
|
49874
3bdee1887901
(check_fontset_name): If NAME is nil, return the
Kenichi Handa <handa@m17n.org>
parents:
49286
diff
changeset
|
2131 |
| 90410 | 2132 if (code == FONT_INVALID_CODE) |
| 2133 return Fcons (fontname, Qnil); | |
| 2134 if (code <= MOST_POSITIVE_FIXNUM) | |
| 2135 return Fcons (fontname, make_number (code)); | |
| 2136 return Fcons (fontname, Fcons (make_number (code >> 16), | |
| 2137 make_number (code & 0xFFFF))); | |
| 2138 } | |
| 2139 return Qnil; | |
| 2140 } | |
| 2141 #endif /* USE_FONT_BACKEND */ | |
| 89904 | 2142 if (VECTORP (rfont_def) && STRINGP (AREF (rfont_def, 3))) |
| 2143 { | |
| 2144 Lisp_Object font_def; | |
| 2145 struct font_info *fontp; | |
| 2146 struct charset *charset; | |
| 2147 XChar2b char2b; | |
| 2148 int code; | |
| 28963 | 2149 |
| 89904 | 2150 font_def = AREF (rfont_def, 2); |
| 2151 charset = CHARSET_FROM_ID (XINT (AREF (font_def, 1))); | |
| 2152 code = ENCODE_CHAR (charset, c); | |
| 2153 if (code == CHARSET_INVALID_CODE (charset)) | |
| 2154 return (Fcons (AREF (rfont_def, 3), Qnil)); | |
| 2155 STORE_XCHAR2B (&char2b, ((code >> 8) & 0xFF), (code & 0xFF)); | |
| 2156 fontp = (*get_font_info_func) (f, XINT (AREF (rfont_def, 1))); | |
| 91041 | 2157 FRAME_RIF (f)->encode_char (c, &char2b, fontp, charset, NULL); |
| 89904 | 2158 code = (XCHAR2B_BYTE1 (&char2b) << 8) | XCHAR2B_BYTE2 (&char2b); |
| 2159 return (Fcons (AREF (rfont_def, 3), make_number (code))); | |
| 28963 | 2160 } |
| 89904 | 2161 return Qnil; |
| 28963 | 2162 } |
| 2163 | |
| 2164 | |
| 17052 | 2165 DEFUN ("fontset-info", Ffontset_info, Sfontset_info, 1, 2, 0, |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
2166 doc: /* Return information about a fontset FONTSET on frame FRAME. |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
2167 The value is a char-table of which elements has this form. |
| 28963 | 2168 |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
2169 ((FONT-PATTERN OPENED-FONT ...) ...) |
| 28963 | 2170 |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
2171 FONT-PATTERN is a vector: |
| 28963 | 2172 |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
2173 [ FAMILY WEIGHT SLANT SWIDTH ADSTYLE REGISTRY ] |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
2174 |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
2175 or a string of font name pattern. |
| 28963 | 2176 |
|
89349
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
2177 OPENED-FONT is a name of a font actually opened. |
|
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
2178 |
|
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
2179 The char-table has one extra slot. The value is a char-table |
|
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
2180 containing the information about the derived fonts from the default |
|
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
2181 fontset. The format is the same as abobe. */) |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
2182 (fontset, frame) |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
2183 Lisp_Object fontset, frame; |
| 17052 | 2184 { |
| 2185 FRAME_PTR f; | |
|
89811
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
2186 Lisp_Object *realized[2], fontsets[2], tables[2]; |
|
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
2187 Lisp_Object val, elt; |
|
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
2188 int c, i, j, k; |
|
41987
34952771ae85
Fix typos, remove unnecessary space.
Pavel Jan?k <Pavel@Janik.cz>
parents:
41052
diff
changeset
|
2189 |
| 17052 | 2190 (*check_window_system_func) (); |
| 2191 | |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
2192 fontset = check_fontset_name (fontset); |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
2193 |
| 17052 | 2194 if (NILP (frame)) |
|
25668
99290b59352d
(Ffont_info): Change for Lisp_Object selected_frame.
Gerd Moellmann <gerd@gnu.org>
parents:
24611
diff
changeset
|
2195 frame = selected_frame; |
|
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Jan?k <Pavel@Janik.cz>
parents:
40028
diff
changeset
|
2196 CHECK_LIVE_FRAME (frame); |
|
25668
99290b59352d
(Ffont_info): Change for Lisp_Object selected_frame.
Gerd Moellmann <gerd@gnu.org>
parents:
24611
diff
changeset
|
2197 f = XFRAME (frame); |
| 17052 | 2198 |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
2199 /* Recode fontsets realized on FRAME from the base fontset FONTSET |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
2200 in the table `realized'. */ |
|
89811
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
2201 realized[0] = (Lisp_Object *) alloca (sizeof (Lisp_Object) |
|
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
2202 * ASIZE (Vfontset_table)); |
|
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
2203 for (i = j = 0; i < ASIZE (Vfontset_table); i++) |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
2204 { |
| 28963 | 2205 elt = FONTSET_FROM_ID (i); |
| 2206 if (!NILP (elt) | |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
2207 && EQ (FONTSET_BASE (elt), fontset) |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
2208 && EQ (FONTSET_FRAME (elt), frame)) |
|
89811
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
2209 realized[0][j++] = elt; |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
2210 } |
|
89811
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
2211 realized[0][j] = Qnil; |
|
49874
3bdee1887901
(check_fontset_name): If NAME is nil, return the
Kenichi Handa <handa@m17n.org>
parents:
49286
diff
changeset
|
2212 |
|
89811
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
2213 realized[1] = (Lisp_Object *) alloca (sizeof (Lisp_Object) |
|
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
2214 * ASIZE (Vfontset_table)); |
|
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
2215 for (i = j = 0; ! NILP (realized[0][i]); i++) |
|
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
2216 { |
|
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
2217 elt = FONTSET_DEFAULT (realized[0][i]); |
|
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
2218 if (! NILP (elt)) |
|
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
2219 realized[1][j++] = elt; |
|
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
2220 } |
|
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
2221 realized[1][j] = Qnil; |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
2222 |
|
89811
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
2223 tables[0] = Fmake_char_table (Qfontset_info, Qnil); |
|
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
2224 tables[1] = Fmake_char_table (Qnil, Qnil); |
|
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
2225 XCHAR_TABLE (tables[0])->extras[0] = tables[1]; |
|
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
2226 fontsets[0] = fontset; |
|
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
2227 fontsets[1] = Vdefault_fontset; |
|
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
2228 |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
2229 /* Accumulate information of the fontset in TABLE. The format of |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
2230 each element is ((FONT-SPEC OPENED-FONT ...) ...). */ |
|
89811
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
2231 for (k = 0; k <= 1; k++) |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
2232 { |
|
89811
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
2233 for (c = 0; c <= MAX_CHAR; ) |
| 28963 | 2234 { |
|
89349
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
2235 int from, to; |
| 17052 | 2236 |
|
89811
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
2237 if (c <= MAX_5_BYTE_CHAR) |
|
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
2238 { |
|
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
2239 val = char_table_ref_and_range (fontsets[k], c, &from, &to); |
|
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
2240 if (to > MAX_5_BYTE_CHAR) |
|
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
2241 to = MAX_5_BYTE_CHAR; |
|
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
2242 } |
|
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
2243 else |
|
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
2244 { |
|
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
2245 val = FONTSET_FALLBACK (fontsets[k]); |
|
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
2246 to = MAX_CHAR; |
|
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
2247 } |
|
89349
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
2248 if (VECTORP (val)) |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
2249 { |
|
89349
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
2250 Lisp_Object alist; |
|
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
2251 |
|
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
2252 /* At first, set ALIST to ((FONT-SPEC) ...). */ |
|
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
2253 for (alist = Qnil, i = 0; i < ASIZE (val); i++) |
|
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
2254 alist = Fcons (Fcons (AREF (AREF (val, i), 0), Qnil), alist); |
|
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
2255 alist = Fnreverse (alist); |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
2256 |
|
89349
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
2257 /* Then store opend font names to cdr of each elements. */ |
|
89811
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
2258 for (i = 0; ! NILP (realized[k][i]); i++) |
| 28963 | 2259 { |
|
89811
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
2260 if (c <= MAX_5_BYTE_CHAR) |
|
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
2261 val = FONTSET_REF (realized[k][i], c); |
|
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
2262 else |
|
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
2263 val = FONTSET_FALLBACK (realized[k][i]); |
|
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
2264 if (! VECTORP (val)) |
|
89349
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
2265 continue; |
|
89898
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
2266 /* VAL is [int int ? |
|
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
2267 [FACE-ID FONT-INDEX FONT-DEF FONT-NAME] ...]. |
|
89349
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
2268 If a font of an element is already opened, |
|
89898
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
2269 FONT-NAME is the name of a opened font. */ |
|
89699
cda6f41a592e
(reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
89687
diff
changeset
|
2270 for (j = 3; j < ASIZE (val); j++) |
|
89898
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
2271 if (STRINGP (AREF (AREF (val, j), 3))) |
|
89349
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
2272 { |
|
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
2273 Lisp_Object font_idx; |
|
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
2274 |
|
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
2275 font_idx = AREF (AREF (val, j), 1); |
|
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
2276 elt = Fassq (AREF (AREF (AREF (val, j), 2), 0), alist); |
|
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
2277 if (CONSP (elt) |
|
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
2278 && NILP (Fmemq (font_idx, XCDR(elt)))) |
|
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
2279 nconc2 (elt, Fcons (font_idx, Qnil)); |
|
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
2280 } |
| 28963 | 2281 } |
|
89349
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
2282 for (val = alist; CONSP (val); val = XCDR (val)) |
|
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
2283 for (elt = XCDR (XCAR (val)); CONSP (elt); elt = XCDR (elt)) |
|
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
2284 { |
|
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
2285 struct font_info *font_info |
|
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
2286 = (*get_font_info_func) (f, XINT (XCAR (elt))); |
|
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
2287 XSETCAR (elt, build_string (font_info->full_name)); |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
2288 } |
|
89349
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
2289 |
|
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
2290 /* Store ALIST in TBL for characters C..TO. */ |
|
89811
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
2291 if (c <= MAX_5_BYTE_CHAR) |
|
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
2292 char_table_set_range (tables[k], c, to, alist); |
|
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
2293 else |
|
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
2294 XCHAR_TABLE (tables[k])->defalt = alist; |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
2295 } |
|
89349
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
2296 c = to + 1; |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
2297 } |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
2298 } |
|
30124
26076259e03f
(Ffontset_info): Make the return value more compatible
Kenichi Handa <handa@m17n.org>
parents:
29767
diff
changeset
|
2299 |
|
89811
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
2300 return tables[0]; |
| 17052 | 2301 } |
| 2302 | |
| 2303 | |
|
89940
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
2304 DEFUN ("fontset-font", Ffontset_font, Sfontset_font, 2, 3, 0, |
|
41001
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
2305 doc: /* Return a font name pattern for character CH in fontset NAME. |
|
89940
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
2306 If NAME is t, find a pattern in the default fontset. |
|
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
2307 |
|
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
2308 The value has the form (FAMILY . REGISTRY), where FAMILY is a font |
|
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
2309 family name and REGISTRY is a font registry name. This is actually |
|
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
2310 the first font name pattern for CH in the fontset or in the default |
|
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
2311 fontset. |
|
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
2312 |
|
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
2313 If the 2nd optional arg ALL is non-nil, return a list of all font name |
|
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
2314 patterns. */) |
|
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
2315 (name, ch, all) |
|
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
2316 Lisp_Object name, ch, all; |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
2317 { |
|
34975
0d69e2d2724e
(fontset_ref): Remove unused variable `i'.
Eli Zaretskii <eliz@gnu.org>
parents:
32978
diff
changeset
|
2318 int c; |
|
89940
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
2319 Lisp_Object fontset, elt, list, repertory, val; |
|
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
2320 int i, j; |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
2321 |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
2322 fontset = check_fontset_name (name); |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
2323 |
| 88405 | 2324 CHECK_CHARACTER (ch); |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
2325 c = XINT (ch); |
|
89940
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
2326 list = Qnil; |
|
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
2327 while (1) |
|
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
2328 { |
|
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
2329 for (i = 0, elt = FONTSET_REF (fontset, c); i < 2; |
|
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
2330 i++, elt = FONTSET_FALLBACK (fontset)) |
|
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
2331 if (VECTORP (elt)) |
|
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
2332 for (j = 0; j < ASIZE (elt); j++) |
|
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
2333 { |
|
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
2334 val = AREF (elt, j); |
|
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
2335 repertory = AREF (val, 1); |
|
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
2336 if (INTEGERP (repertory)) |
|
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
2337 { |
|
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
2338 struct charset *charset = CHARSET_FROM_ID (XINT (repertory)); |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
2339 |
|
89940
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
2340 if (! CHAR_CHARSET_P (c, charset)) |
|
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
2341 continue; |
|
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
2342 } |
|
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
2343 else if (CHAR_TABLE_P (repertory)) |
|
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
2344 { |
|
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
2345 if (NILP (CHAR_TABLE_REF (repertory, c))) |
|
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
2346 continue; |
|
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
2347 } |
|
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
2348 val = AREF (val, 0); |
|
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
2349 val = Fcons (AREF (val, 0), AREF (val, 5)); |
|
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
2350 if (NILP (all)) |
|
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
2351 return val; |
|
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
2352 list = Fcons (val, list); |
|
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
2353 } |
|
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
2354 if (EQ (fontset, Vdefault_fontset)) |
|
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
2355 break; |
|
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
2356 fontset = Vdefault_fontset; |
|
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
2357 } |
|
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
2358 return (Fnreverse (list)); |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
2359 } |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
2360 |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
2361 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
|
2362 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
|
2363 () |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
2364 { |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
2365 Lisp_Object fontset, list; |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
2366 int i; |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
2367 |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
2368 list = Qnil; |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
2369 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
|
2370 { |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
2371 fontset = FONTSET_FROM_ID (i); |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
2372 if (!NILP (fontset) |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
2373 && BASE_FONTSET_P (fontset)) |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
2374 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
|
2375 } |
| 28963 | 2376 |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
2377 return list; |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
2378 } |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
2379 |
|
89610
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
2380 |
|
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
2381 #ifdef FONTSET_DEBUG |
|
53353
b085f18ebcf0
(Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
53072
diff
changeset
|
2382 |
|
89610
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
2383 Lisp_Object |
|
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
2384 dump_fontset (fontset) |
|
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
2385 Lisp_Object fontset; |
|
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
2386 { |
|
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
2387 Lisp_Object vec; |
|
53353
b085f18ebcf0
(Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
53072
diff
changeset
|
2388 |
|
89610
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
2389 vec = Fmake_vector (make_number (3), Qnil); |
|
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
2390 ASET (vec, 0, FONTSET_ID (fontset)); |
|
53353
b085f18ebcf0
(Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
53072
diff
changeset
|
2391 |
|
89610
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
2392 if (BASE_FONTSET_P (fontset)) |
|
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
2393 { |
|
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
2394 ASET (vec, 1, FONTSET_NAME (fontset)); |
|
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
2395 } |
|
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
2396 else |
|
53353
b085f18ebcf0
(Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
53072
diff
changeset
|
2397 { |
|
89610
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
2398 Lisp_Object frame; |
|
53353
b085f18ebcf0
(Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
53072
diff
changeset
|
2399 |
|
89610
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
2400 frame = FONTSET_FRAME (fontset); |
|
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
2401 if (FRAMEP (frame)) |
|
53353
b085f18ebcf0
(Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
53072
diff
changeset
|
2402 { |
|
89610
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
2403 FRAME_PTR f = XFRAME (frame); |
|
53353
b085f18ebcf0
(Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
53072
diff
changeset
|
2404 |
|
89610
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
2405 if (FRAME_LIVE_P (f)) |
|
90802
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
2406 ASET (vec, 1, |
|
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
2407 Fcons (FONTSET_NAME (FONTSET_BASE (fontset)), f->name)); |
|
89610
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
2408 else |
|
90802
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
2409 ASET (vec, 1, |
|
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
2410 Fcons (FONTSET_NAME (FONTSET_BASE (fontset)), Qnil)); |
|
53353
b085f18ebcf0
(Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
53072
diff
changeset
|
2411 } |
|
89805
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
2412 if (!NILP (FONTSET_DEFAULT (fontset))) |
|
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
2413 ASET (vec, 2, FONTSET_ID (FONTSET_DEFAULT (fontset))); |
|
53353
b085f18ebcf0
(Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
53072
diff
changeset
|
2414 } |
|
89610
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
2415 return vec; |
|
53353
b085f18ebcf0
(Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
53072
diff
changeset
|
2416 } |
|
b085f18ebcf0
(Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
53072
diff
changeset
|
2417 |
|
89610
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
2418 DEFUN ("fontset-list-all", Ffontset_list_all, Sfontset_list_all, 0, 0, 0, |
|
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
2419 doc: /* Return a brief summary of all fontsets for debug use. */) |
|
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
2420 () |
|
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
2421 { |
|
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
2422 Lisp_Object val; |
|
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
2423 int i; |
|
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
2424 |
|
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
2425 for (i = 0, val = Qnil; i < ASIZE (Vfontset_table); i++) |
|
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
2426 if (! NILP (AREF (Vfontset_table, i))) |
|
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
2427 val = Fcons (dump_fontset (AREF (Vfontset_table, i)), val); |
|
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
2428 return (Fnreverse (val)); |
|
53353
b085f18ebcf0
(Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
53072
diff
changeset
|
2429 } |
|
89610
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
2430 #endif /* FONTSET_DEBUG */ |
|
53353
b085f18ebcf0
(Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
53072
diff
changeset
|
2431 |
| 21514 | 2432 void |
| 17052 | 2433 syms_of_fontset () |
| 2434 { | |
| 2435 if (!load_font_func) | |
| 2436 /* Window system initializer should have set proper functions. */ | |
| 2437 abort (); | |
| 2438 | |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
2439 DEFSYM (Qfontset, "fontset"); |
|
89805
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
2440 Fput (Qfontset, Qchar_table_extra_slots, make_number (9)); |
|
89349
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
2441 DEFSYM (Qfontset_info, "fontset-info"); |
|
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
2442 Fput (Qfontset_info, Qchar_table_extra_slots, make_number (1)); |
| 17052 | 2443 |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
2444 DEFSYM (Qprepend, "prepend"); |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
2445 DEFSYM (Qappend, "append"); |
| 90642 | 2446 DEFSYM (Qlatin, "latin"); |
| 17052 | 2447 |
| 2448 Vcached_fontset_data = Qnil; | |
| 2449 staticpro (&Vcached_fontset_data); | |
| 2450 | |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
2451 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
|
2452 staticpro (&Vfontset_table); |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
2453 |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
2454 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
|
2455 staticpro (&Vdefault_fontset); |
| 28963 | 2456 FONTSET_ID (Vdefault_fontset) = make_number (0); |
| 2457 FONTSET_NAME (Vdefault_fontset) | |
| 2458 = build_string ("-*-*-*-*-*-*-*-*-*-*-*-*-fontset-default"); | |
| 2459 AREF (Vfontset_table, 0) = Vdefault_fontset; | |
| 2460 next_fontset_id = 1; | |
| 17052 | 2461 |
|
89610
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
2462 auto_fontset_alist = Qnil; |
|
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
2463 staticpro (&auto_fontset_alist); |
|
53353
b085f18ebcf0
(Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
53072
diff
changeset
|
2464 |
| 17052 | 2465 DEFVAR_LISP ("font-encoding-alist", &Vfont_encoding_alist, |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
2466 doc: /* |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
2467 Alist of fontname patterns vs the corresponding encoding and repertory info. |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
2468 Each element looks like (REGEXP . (ENCODING . REPERTORY)), |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
2469 where ENCODING is a charset or a char-table, |
| 89483 | 2470 and REPERTORY is a charset, a char-table, or nil. |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
2471 |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
2472 ENCODING is for converting a character to a glyph code of the font. |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
2473 If ENCODING is a charset, encoding a character by the charset gives |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
2474 the corresponding glyph code. If ENCODING is a char-table, looking up |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
2475 the table by a character gives the corresponding glyph code. |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
2476 |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
2477 REPERTORY specifies a repertory of characters supported by the font. |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
2478 If REPERTORY is a charset, all characters beloging to the charset are |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
2479 supported. If REPERTORY is a char-table, all characters who have a |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
2480 non-nil value in the table are supported. It REPERTORY is nil, Emacs |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
2481 gets the repertory information by an opened font and ENCODING. */); |
| 17052 | 2482 Vfont_encoding_alist = Qnil; |
| 2483 | |
|
17112
5c48ff325655
(syms_of_fontset): Intern Qfontset. Declare new lisp
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
2484 DEFVAR_LISP ("use-default-ascent", &Vuse_default_ascent, |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
2485 doc: /* |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
2486 Char table of characters whose ascent values should be ignored. |
|
41001
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
2487 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
|
2488 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
|
2489 |
|
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
2490 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
|
2491 such a character is displayed on screen. */); |
|
19282
09a1536debb4
(Vignore_relative_composition): New variable.
Kenichi Handa <handa@m17n.org>
parents:
19172
diff
changeset
|
2492 Vuse_default_ascent = Qnil; |
|
09a1536debb4
(Vignore_relative_composition): New variable.
Kenichi Handa <handa@m17n.org>
parents:
19172
diff
changeset
|
2493 |
|
09a1536debb4
(Vignore_relative_composition): New variable.
Kenichi Handa <handa@m17n.org>
parents:
19172
diff
changeset
|
2494 DEFVAR_LISP ("ignore-relative-composition", &Vignore_relative_composition, |
|
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
2495 doc: /* |
|
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
2496 Char table of characters which is not composed relatively. |
|
41001
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Jan?k <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
2497 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
|
2498 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
|
2499 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
|
2500 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
|
2501 Vignore_relative_composition = Qnil; |
|
17112
5c48ff325655
(syms_of_fontset): Intern Qfontset. Declare new lisp
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
2502 |
|
19450
895dc2520755
(Valternate_fontname_alist): Name changed from
Kenichi Handa <handa@m17n.org>
parents:
19282
diff
changeset
|
2503 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
|
2504 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
|
2505 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
|
2506 alternate fontnames (if any) are tried instead. */); |
|
19450
895dc2520755
(Valternate_fontname_alist): Name changed from
Kenichi Handa <handa@m17n.org>
parents:
19282
diff
changeset
|
2507 Valternate_fontname_alist = Qnil; |
|
17193
dc4562b0152a
(Valternative_fontname_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
17190
diff
changeset
|
2508 |
|
17730
4bbcc6804b5d
(Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
17331
diff
changeset
|
2509 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
|
2510 doc: /* Alist of fontset names vs the aliases. */); |
| 28963 | 2511 Vfontset_alias_alist = Fcons (Fcons (FONTSET_NAME (Vdefault_fontset), |
| 2512 build_string ("fontset-default")), | |
| 2513 Qnil); | |
|
17730
4bbcc6804b5d
(Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
17331
diff
changeset
|
2514 |
|
26858
7cc081b4e084
(Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents:
26164
diff
changeset
|
2515 DEFVAR_LISP ("vertical-centering-font-regexp", |
|
7cc081b4e084
(Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents:
26164
diff
changeset
|
2516 &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
|
2517 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
|
2518 When a character is displayed with such fonts, the character is displayed |
|
41987
34952771ae85
Fix typos, remove unnecessary space.
Pavel Jan?k <Pavel@Janik.cz>
parents:
41052
diff
changeset
|
2519 at the vertical center of lines. */); |
|
26858
7cc081b4e084
(Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents:
26164
diff
changeset
|
2520 Vvertical_centering_font_regexp = Qnil; |
|
7cc081b4e084
(Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents:
26164
diff
changeset
|
2521 |
|
90509
c1ec6b950928
(Votf_script_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90475
diff
changeset
|
2522 DEFVAR_LISP ("otf-script-alist", &Votf_script_alist, |
|
c1ec6b950928
(Votf_script_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90475
diff
changeset
|
2523 doc: /* Alist of OpenType script tags vs the corresponding script names. */); |
|
c1ec6b950928
(Votf_script_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90475
diff
changeset
|
2524 Votf_script_alist = Qnil; |
|
c1ec6b950928
(Votf_script_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90475
diff
changeset
|
2525 |
| 17052 | 2526 defsubr (&Squery_fontset); |
| 2527 defsubr (&Snew_fontset); | |
| 2528 defsubr (&Sset_fontset_font); | |
| 2529 defsubr (&Sfont_info); | |
| 28963 | 2530 defsubr (&Sinternal_char_font); |
| 17052 | 2531 defsubr (&Sfontset_info); |
|
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
2532 defsubr (&Sfontset_font); |
|
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
2533 defsubr (&Sfontset_list); |
|
89610
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
2534 #ifdef FONTSET_DEBUG |
|
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
2535 defsubr (&Sfontset_list_all); |
|
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
2536 #endif |
| 17052 | 2537 } |
| 52401 | 2538 |
| 2539 /* arch-tag: ea861585-2f5f-4e5b-9849-d04a9c3a3537 | |
| 2540 (do not change this comment) */ |
