Mercurial > emacs
annotate src/fontset.c @ 102414:5988cd89cf0b
(fontset_find_font): If a font found without
restricting the characters C doen't support C, try to find a font
with C restriction.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Thu, 05 Mar 2009 12:21:41 +0000 |
parents | ef1ec0a2e8dd |
children | 5a5d05398f9e |
rev | line source |
---|---|
17052 | 1 /* Fontset handler. |
100951 | 2 Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 |
75227
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, |
100951 | 5 2005, 2006, 2007, 2008, 2009 |
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 | |
95143
3e0cd839473e
(Ffontset_info): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
95127
diff
changeset
|
11 |
17071 | 12 This file is part of GNU Emacs. |
13 | |
94963
8971ddf55736
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94928
diff
changeset
|
14 GNU Emacs is free software: you can redistribute it and/or modify |
17071 | 15 it under the terms of the GNU General Public License as published by |
94963
8971ddf55736
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94928
diff
changeset
|
16 the Free Software Foundation, either version 3 of the License, or |
8971ddf55736
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94928
diff
changeset
|
17 (at your option) 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 |
94963
8971ddf55736
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94928
diff
changeset
|
25 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ |
17052 | 26 |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
27 /* #define FONTSET_DEBUG */ |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
28 |
17052 | 29 #include <config.h> |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
30 #include <stdio.h> |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
31 |
17052 | 32 #include "lisp.h" |
88405 | 33 #include "blockinput.h" |
28963 | 34 #include "buffer.h" |
88405 | 35 #include "character.h" |
17052 | 36 #include "charset.h" |
37 #include "ccl.h" | |
31102
6a0caa788013
Include keyboard.h before frame.h.
Andrew Innes <andrewi@gnu.org>
parents:
30941
diff
changeset
|
38 #include "keyboard.h" |
23517
73f09e7bc96e
Include frame.h before fontset.h.
Kenichi Handa <handa@m17n.org>
parents:
22719
diff
changeset
|
39 #include "frame.h" |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
40 #include "dispextern.h" |
89865 | 41 #include "intervals.h" |
17052 | 42 #include "fontset.h" |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
43 #include "window.h" |
52654
2e5944e29aa0
(Finternal_char_font): Change return value to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
44 #ifdef HAVE_X_WINDOWS |
2e5944e29aa0
(Finternal_char_font): Change return value to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
45 #include "xterm.h" |
2e5944e29aa0
(Finternal_char_font): Change return value to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
46 #endif |
2e5944e29aa0
(Finternal_char_font): Change return value to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
47 #ifdef WINDOWSNT |
2e5944e29aa0
(Finternal_char_font): Change return value to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
48 #include "w32term.h" |
2e5944e29aa0
(Finternal_char_font): Change return value to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
49 #endif |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96655
diff
changeset
|
50 #ifdef HAVE_NS |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96655
diff
changeset
|
51 #include "nsterm.h" |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96655
diff
changeset
|
52 #endif |
82992
5de4189e659d
Got rid of the rif (window-based redisplay interface) global variable.
Karoly Lorentey <lorentey@elte.hu>
parents:
53353
diff
changeset
|
53 #include "termhooks.h" |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
54 |
90410 | 55 #include "font.h" |
56 | |
89483 | 57 #undef xassert |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
58 #ifdef FONTSET_DEBUG |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
59 #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
|
60 #undef INLINE |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
61 #define INLINE |
89483 | 62 #else /* not FONTSET_DEBUG */ |
63 #define xassert(X) (void) 0 | |
64 #endif /* not FONTSET_DEBUG */ | |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
65 |
88546 | 66 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
|
67 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
68 /* FONTSET |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
69 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
70 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
|
71 similar appearance (style, etc) of characters. A fontset has two |
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
72 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
|
73 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
|
74 `ascii' script for the frame's default font. |
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
75 |
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
76 Another role, the more important one, is to provide information |
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
77 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
|
78 |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
79 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
|
80 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
|
81 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
|
82 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
|
83 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
|
84 face share the same realized fontset. |
89483 | 85 |
88405 | 86 A fontset object is implemented by a char-table whose default value |
87 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
|
88 |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
89 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
|
90 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
|
91 |
101605
b37403eedfa9
(font_for_char): Use assq_no_quit, not assoc_no_quit.
Kenichi Handa <handa@m17n.org>
parents:
101601
diff
changeset
|
92 An element of a realized fontset is nil, t, 0, or a vector of this |
b37403eedfa9
(font_for_char): Use assq_no_quit, not assoc_no_quit.
Kenichi Handa <handa@m17n.org>
parents:
101601
diff
changeset
|
93 form: |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
94 |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
95 [ CHARSET-ORDERED-LIST-TICK PREFERRED-RFONT-DEF |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
96 RFONT-DEF0 RFONT-DEF1 ... ] |
17052 | 97 |
89898
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
98 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
|
99 |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
100 [ FACE-ID FONT-DEF FONT-OBJECT SORTING-SCORE ] |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
101 |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
102 RFONT-DEFn are automatically reordered by the current charset |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
103 priority list. |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
104 |
89898
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
105 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
|
106 from the base of the fontset. |
88405 | 107 |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
108 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
|
109 range of characters. |
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
110 |
101605
b37403eedfa9
(font_for_char): Use assq_no_quit, not assoc_no_quit.
Kenichi Handa <handa@m17n.org>
parents:
101601
diff
changeset
|
111 The value 0 means that no font is available for the corresponding |
b37403eedfa9
(font_for_char): Use assq_no_quit, not assoc_no_quit.
Kenichi Handa <handa@m17n.org>
parents:
101601
diff
changeset
|
112 range of characters in this fontset, but may be available in the |
b37403eedfa9
(font_for_char): Use assq_no_quit, not assoc_no_quit.
Kenichi Handa <handa@m17n.org>
parents:
101601
diff
changeset
|
113 default fontset. |
b37403eedfa9
(font_for_char): Use assq_no_quit, not assoc_no_quit.
Kenichi Handa <handa@m17n.org>
parents:
101601
diff
changeset
|
114 |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
115 |
89805
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
116 A fontset has 9 extra slots. |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
117 |
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
118 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
|
119 |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
120 The 2nd slot: |
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
121 base: the name of the fontset |
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
122 realized: nil |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
123 |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
124 The 3rd slot: |
89349
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
125 base: nil |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
126 realized: the base fontset |
17052 | 127 |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
128 The 4th slot: |
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
129 base: nil |
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
130 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
|
131 |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
132 The 5th slot: |
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
133 base: the font name for ASCII characters |
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
134 realized: nil |
88405 | 135 |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
136 The 6th slot: |
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
137 base: nil |
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
138 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
|
139 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
|
140 |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
141 The 7th slot: |
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
142 base: nil |
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
143 realized: Alist of font index vs the corresponding repertory |
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
144 char-table. |
95143
3e0cd839473e
(Ffontset_info): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
95127
diff
changeset
|
145 |
89349
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
146 The 8th slot: |
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
147 base: nil |
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
148 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
|
149 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
|
150 |
89805
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
151 The 9th slot: |
89811
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
152 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
|
153 realized: Likewise. |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
154 |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
155 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
|
156 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
157 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
158 DEFAULT FONTSET |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
159 |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
160 There's a special base fontset named `default fontset' which |
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
161 defines the default font specifications. When a base fontset |
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
162 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
|
163 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
|
164 |
30398
dde5ab185aad
(fontset_ref): Remove INLINE declaration.
Kenichi Handa <handa@m17n.org>
parents:
30172
diff
changeset
|
165 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
|
166 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
|
167 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
168 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
169 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
|
170 The other codes handle fontsets only by their ID numbers. They |
88405 | 171 usually use the variable name `fontset' for IDs. But, in this |
172 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
|
173 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
|
174 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
175 */ |
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 /********** VARIABLES and FUNCTION PROTOTYPES **********/ |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
178 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
179 extern Lisp_Object Qfont; |
89349
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
180 static Lisp_Object Qfontset; |
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
181 static Lisp_Object Qfontset_info; |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
182 static Lisp_Object Qprepend, Qappend; |
90642 | 183 static Lisp_Object Qlatin; |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
184 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
185 /* Vector containing all fontsets. */ |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
186 static Lisp_Object Vfontset_table; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
187 |
41987
34952771ae85
Fix typos, remove unnecessary space.
Pavel Janík <Pavel@Janik.cz>
parents:
41052
diff
changeset
|
188 /* 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
|
189 fontset ID not yet used. */ |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
190 static int next_fontset_id; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
191 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
192 /* The default fontset. This gives default FAMILY and REGISTRY of |
88405 | 193 font for each character. */ |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
194 static Lisp_Object Vdefault_fontset; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
195 |
91266
3cd59392b3ec
(Vfont_encoding_charset_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
91250
diff
changeset
|
196 Lisp_Object Vfont_encoding_charset_alist; |
17112
5c48ff325655
(syms_of_fontset): Intern Qfontset. Declare new lisp
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
197 Lisp_Object Vuse_default_ascent; |
19282
09a1536debb4
(Vignore_relative_composition): New variable.
Kenichi Handa <handa@m17n.org>
parents:
19172
diff
changeset
|
198 Lisp_Object Vignore_relative_composition; |
19450
895dc2520755
(Valternate_fontname_alist): Name changed from
Kenichi Handa <handa@m17n.org>
parents:
19282
diff
changeset
|
199 Lisp_Object Valternate_fontname_alist; |
17730
4bbcc6804b5d
(Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
17331
diff
changeset
|
200 Lisp_Object Vfontset_alias_alist; |
26858
7cc081b4e084
(Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents:
26164
diff
changeset
|
201 Lisp_Object Vvertical_centering_font_regexp; |
90509
c1ec6b950928
(Votf_script_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90475
diff
changeset
|
202 Lisp_Object Votf_script_alist; |
17052 | 203 |
204 /* Check if any window system is used now. */ | |
20315
931b4ddf7966
Protoize functions declarations.
Andreas Schwab <schwab@suse.de>
parents:
19450
diff
changeset
|
205 void (*check_window_system_func) P_ ((void)); |
17052 | 206 |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
207 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
208 /* Prototype declarations for static functions. */ |
89069
c2201502f37e
(fontset_add): Return Lisp_Object.
Dave Love <fx@gnu.org>
parents:
89006
diff
changeset
|
209 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
|
210 Lisp_Object)); |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
211 static Lisp_Object fontset_find_font P_ ((Lisp_Object, int, struct face *, |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
212 int, int)); |
96556
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
213 static void reorder_font_vector P_ ((Lisp_Object, struct font *)); |
89898
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
214 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
|
215 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
|
216 static Lisp_Object fontset_pattern_regexp P_ ((Lisp_Object)); |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
217 static void accumulate_script_ranges P_ ((Lisp_Object, Lisp_Object, |
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
218 Lisp_Object)); |
90410 | 219 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
|
220 |
89614
355fc0282e50
(set_fontset_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
89610
diff
changeset
|
221 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
|
222 |
88982
d50b0a9ea97a
(fontset_add): Make the type `int'.
Kenichi Handa <handa@m17n.org>
parents:
88968
diff
changeset
|
223 #ifdef FONTSET_DEBUG |
d50b0a9ea97a
(fontset_add): Make the type `int'.
Kenichi Handa <handa@m17n.org>
parents:
88968
diff
changeset
|
224 |
d50b0a9ea97a
(fontset_add): Make the type `int'.
Kenichi Handa <handa@m17n.org>
parents:
88968
diff
changeset
|
225 /* 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
|
226 |
d50b0a9ea97a
(fontset_add): Make the type `int'.
Kenichi Handa <handa@m17n.org>
parents:
88968
diff
changeset
|
227 static int |
d50b0a9ea97a
(fontset_add): Make the type `int'.
Kenichi Handa <handa@m17n.org>
parents:
88968
diff
changeset
|
228 fontset_id_valid_p (id) |
d50b0a9ea97a
(fontset_add): Make the type `int'.
Kenichi Handa <handa@m17n.org>
parents:
88968
diff
changeset
|
229 int id; |
d50b0a9ea97a
(fontset_add): Make the type `int'.
Kenichi Handa <handa@m17n.org>
parents:
88968
diff
changeset
|
230 { |
d50b0a9ea97a
(fontset_add): Make the type `int'.
Kenichi Handa <handa@m17n.org>
parents:
88968
diff
changeset
|
231 return (id >= 0 && id < ASIZE (Vfontset_table) - 1); |
d50b0a9ea97a
(fontset_add): Make the type `int'.
Kenichi Handa <handa@m17n.org>
parents:
88968
diff
changeset
|
232 } |
d50b0a9ea97a
(fontset_add): Make the type `int'.
Kenichi Handa <handa@m17n.org>
parents:
88968
diff
changeset
|
233 |
d50b0a9ea97a
(fontset_add): Make the type `int'.
Kenichi Handa <handa@m17n.org>
parents:
88968
diff
changeset
|
234 #endif |
d50b0a9ea97a
(fontset_add): Make the type `int'.
Kenichi Handa <handa@m17n.org>
parents:
88968
diff
changeset
|
235 |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
236 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
237 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
238 /********** 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
|
239 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
240 /* 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
|
241 #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
|
242 |
30398
dde5ab185aad
(fontset_ref): Remove INLINE declaration.
Kenichi Handa <handa@m17n.org>
parents:
30172
diff
changeset
|
243 /* 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
|
244 #define FONTSET_ID(fontset) XCHAR_TABLE (fontset)->extras[0] |
88405 | 245 |
246 /* 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
|
247 #define FONTSET_NAME(fontset) XCHAR_TABLE (fontset)->extras[1] |
88405 | 248 #define FONTSET_ASCII(fontset) XCHAR_TABLE (fontset)->extras[4] |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
249 #define FONTSET_SPEC(fontset) XCHAR_TABLE (fontset)->extras[5] |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
250 |
88405 | 251 /* Macros to access special values of (realized) FONTSET. */ |
252 #define FONTSET_BASE(fontset) XCHAR_TABLE (fontset)->extras[2] | |
253 #define FONTSET_FRAME(fontset) XCHAR_TABLE (fontset)->extras[3] | |
91908
6916adc8df33
(FONTSET_OBJLIST): New macro.
Kenichi Handa <handa@m17n.org>
parents:
91887
diff
changeset
|
254 #define FONTSET_OBJLIST(fontset) XCHAR_TABLE (fontset)->extras[4] |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
255 #define FONTSET_NOFONT_FACE(fontset) XCHAR_TABLE (fontset)->extras[5] |
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
256 #define FONTSET_REPERTORY(fontset) XCHAR_TABLE (fontset)->extras[6] |
89805
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
257 #define FONTSET_DEFAULT(fontset) XCHAR_TABLE (fontset)->extras[7] |
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
258 |
89811
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
259 /* For both base and realized fontset. */ |
89805
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
260 #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
|
261 |
89428
eed327e0bad3
(BASE_FONTSET_P): Check FONTSET_BASE, not
Kenichi Handa <handa@m17n.org>
parents:
89349
diff
changeset
|
262 #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
|
263 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
264 |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
265 /* Macros for FONT-DEF and RFONT-DEF of fontset. */ |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
266 #define FONT_DEF_NEW(font_def, font_spec, encoding, repertory) \ |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
267 do { \ |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
268 (font_def) = Fmake_vector (make_number (3), (font_spec)); \ |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
269 ASET ((font_def), 1, encoding); \ |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
270 ASET ((font_def), 2, repertory); \ |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
271 } while (0) |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
272 |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
273 #define FONT_DEF_SPEC(font_def) AREF (font_def, 0) |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
274 #define FONT_DEF_ENCODING(font_def) AREF (font_def, 1) |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
275 #define FONT_DEF_REPERTORY(font_def) AREF (font_def, 2) |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
276 |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
277 #define RFONT_DEF_FACE(rfont_def) AREF (rfont_def, 0) |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
278 #define RFONT_DEF_SET_FACE(rfont_def, face_id) \ |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
279 ASET ((rfont_def), 0, make_number (face_id)) |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
280 #define RFONT_DEF_FONT_DEF(rfont_def) AREF (rfont_def, 1) |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
281 #define RFONT_DEF_SPEC(rfont_def) FONT_DEF_SPEC (AREF (rfont_def, 1)) |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
282 #define RFONT_DEF_REPERTORY(rfont_def) FONT_DEF_REPERTORY (AREF (rfont_def, 1)) |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
283 #define RFONT_DEF_OBJECT(rfont_def) AREF (rfont_def, 2) |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
284 #define RFONT_DEF_SET_OBJECT(rfont_def, object) \ |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
285 ASET ((rfont_def), 2, (object)) |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
286 #define RFONT_DEF_SCORE(rfont_def) XINT (AREF (rfont_def, 3)) |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
287 #define RFONT_DEF_SET_SCORE(rfont_def, score) \ |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
288 ASET ((rfont_def), 3, make_number (score)) |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
289 #define RFONT_DEF_NEW(rfont_def, font_def) \ |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
290 do { \ |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
291 (rfont_def) = Fmake_vector (make_number (4), Qnil); \ |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
292 ASET ((rfont_def), 1, (font_def)); \ |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
293 RFONT_DEF_SET_SCORE ((rfont_def), 0); \ |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
294 } while (0) |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
295 |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
296 |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
297 /* 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
|
298 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
|
299 contain information for C, return the information in the default |
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
300 fontset. */ |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
301 |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
302 #define FONTSET_REF(fontset, c) \ |
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
303 (EQ (fontset, Vdefault_fontset) \ |
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
304 ? CHAR_TABLE_REF (fontset, c) \ |
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
305 : fontset_ref ((fontset), (c))) |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
306 |
30398
dde5ab185aad
(fontset_ref): Remove INLINE declaration.
Kenichi Handa <handa@m17n.org>
parents:
30172
diff
changeset
|
307 static Lisp_Object |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
308 fontset_ref (fontset, c) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
309 Lisp_Object fontset; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
310 int c; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
311 { |
88405 | 312 Lisp_Object elt; |
28223
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 elt = CHAR_TABLE_REF (fontset, c); |
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
315 if (NILP (elt) && ! EQ (fontset, Vdefault_fontset) |
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
316 /* Don't check Vdefault_fontset for a realized fontset. */ |
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
317 && NILP (FONTSET_BASE (fontset))) |
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
318 elt = CHAR_TABLE_REF (Vdefault_fontset, c); |
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
319 return elt; |
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
320 } |
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
321 |
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
322 /* 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
|
323 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
|
324 specifying a range. */ |
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
325 |
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
326 #define FONTSET_SET(fontset, range, elt) \ |
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
327 Fset_char_table_range ((fontset), (range), (elt)) |
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
328 |
53353
b085f18ebcf0
(Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
53072
diff
changeset
|
329 |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
330 /* 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
|
331 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
|
332 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
|
333 replace with ELT, if ADD is `prepend', prepend ELT, otherwise, |
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
334 append ELT. */ |
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
335 |
89811
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
336 #define FONTSET_ADD(fontset, range, elt, add) \ |
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
337 (NILP (add) \ |
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
338 ? (NILP (range) \ |
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
339 ? (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
|
340 : Fset_char_table_range ((fontset), (range), \ |
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
341 Fmake_vector (make_number (1), (elt)))) \ |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
342 : fontset_add ((fontset), (range), (elt), (add))) |
53353
b085f18ebcf0
(Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
53072
diff
changeset
|
343 |
89069
c2201502f37e
(fontset_add): Return Lisp_Object.
Dave Love <fx@gnu.org>
parents:
89006
diff
changeset
|
344 static Lisp_Object |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
345 fontset_add (fontset, range, elt, add) |
88931
74d18470865c
(fontset_add): Declare args. Call make_number
Dave Love <fx@gnu.org>
parents:
88903
diff
changeset
|
346 Lisp_Object fontset, range, elt, add; |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
347 { |
89805
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
348 Lisp_Object args[2]; |
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
349 int idx = (EQ (add, Qappend) ? 0 : 1); |
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
350 |
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
351 args[1 - idx] = Fmake_vector (make_number (1), elt); |
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
352 |
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
353 if (CONSP (range)) |
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
354 { |
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
355 int from = XINT (XCAR (range)); |
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
356 int to = XINT (XCDR (range)); |
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
357 int from1, to1; |
89483 | 358 |
89805
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
359 do { |
99980
0a43374c0145
(fontset_add): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
98582
diff
changeset
|
360 from1 = from, to1 = to; |
89805
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
361 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
|
362 char_table_set_range (fontset, from, to1, |
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
363 NILP (args[idx]) ? args[1 - idx] |
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
364 : Fvconcat (2, args)); |
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
365 from = to1 + 1; |
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
366 } while (from < to); |
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
367 } |
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
368 else |
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
369 { |
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
370 args[idx] = FONTSET_FALLBACK (fontset); |
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
371 FONTSET_FALLBACK (fontset) |
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
372 = 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
|
373 } |
b085f18ebcf0
(Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
53072
diff
changeset
|
374 return Qnil; |
b085f18ebcf0
(Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
53072
diff
changeset
|
375 } |
b085f18ebcf0
(Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
53072
diff
changeset
|
376 |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
377 static int |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
378 fontset_compare_rfontdef (val1, val2) |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
379 const void *val1, *val2; |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
380 { |
96556
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
381 return (RFONT_DEF_SCORE (*(Lisp_Object *) val1) |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
382 - RFONT_DEF_SCORE (*(Lisp_Object *) val2)); |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
383 } |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
384 |
91231
29d8135e8f58
(fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents:
91224
diff
changeset
|
385 /* Update FONT-GROUP which has this form: |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
386 [ CHARSET-ORDERED-LIST-TICK PREFERRED-RFONT-DEF |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
387 RFONT-DEF0 RFONT-DEF1 ... ] |
95256
993b2f1f702e
*** empty log message ***
Juanma Barranquero <lekktu@gmail.com>
parents:
95230
diff
changeset
|
388 Reorder RFONT-DEFs according to the current language, and update |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
389 CHARSET-ORDERED-LIST-TICK. |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
390 |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
391 If PREFERRED_FAMILY is not nil, that family has the higher priority |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
392 if the encoding charsets or languages in font-specs are the same. */ |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
393 |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
394 extern Lisp_Object Fassoc_string (); |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
395 |
88405 | 396 static void |
96556
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
397 reorder_font_vector (font_group, font) |
91231
29d8135e8f58
(fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents:
91224
diff
changeset
|
398 Lisp_Object font_group; |
96556
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
399 struct font *font; |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
400 { |
96556
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
401 Lisp_Object vec, font_object; |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
402 int size; |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
403 int i; |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
404 int score_changed = 0; |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
405 |
96556
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
406 if (font) |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
407 XSETFONT (font_object, font); |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
408 else |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
409 font_object = Qnil; |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
410 |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
411 vec = XCDR (font_group); |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
412 size = ASIZE (vec); |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
413 /* Exclude the tailing nil element from the reordering. */ |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
414 if (NILP (AREF (vec, size - 1))) |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
415 size--; |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
416 |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
417 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
|
418 { |
96556
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
419 Lisp_Object rfont_def = AREF (vec, i); |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
420 Lisp_Object font_def = RFONT_DEF_FONT_DEF (rfont_def); |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
421 Lisp_Object font_spec = FONT_DEF_SPEC (font_def); |
96556
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
422 int score = RFONT_DEF_SCORE (rfont_def) & 0xFF; |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
423 |
96556
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
424 if (! font_match_p (font_spec, font_object)) |
95143
3e0cd839473e
(Ffontset_info): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
95127
diff
changeset
|
425 { |
97556
0fc47f017980
(reorder_font_vector): Use encoding charset of fonts
Kenichi Handa <handa@m17n.org>
parents:
97539
diff
changeset
|
426 Lisp_Object encoding = FONT_DEF_ENCODING (font_def); |
96556
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
427 |
97556
0fc47f017980
(reorder_font_vector): Use encoding charset of fonts
Kenichi Handa <handa@m17n.org>
parents:
97539
diff
changeset
|
428 if (! NILP (encoding)) |
96556
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
429 { |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
430 Lisp_Object tail; |
91231
29d8135e8f58
(fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents:
91224
diff
changeset
|
431 |
96556
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
432 for (tail = Vcharset_ordered_list; |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
433 ! EQ (tail, Vcharset_non_preferred_head) && CONSP (tail); |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
434 score += 0x100, tail = XCDR (tail)) |
97556
0fc47f017980
(reorder_font_vector): Use encoding charset of fonts
Kenichi Handa <handa@m17n.org>
parents:
97539
diff
changeset
|
435 if (EQ (encoding, XCAR (tail))) |
96556
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
436 break; |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
437 } |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
438 else |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
439 { |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
440 Lisp_Object lang = Ffont_get (font_spec, QClang); |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
441 |
96556
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
442 if (! NILP (lang) |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
443 && ! EQ (lang, Vcurrent_iso639_language) |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
444 && (! CONSP (Vcurrent_iso639_language) |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
445 || NILP (Fmemq (lang, Vcurrent_iso639_language)))) |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
446 score |= 0x100; |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
447 } |
91231
29d8135e8f58
(fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents:
91224
diff
changeset
|
448 } |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
449 if (RFONT_DEF_SCORE (rfont_def) != score) |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
450 { |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
451 RFONT_DEF_SET_SCORE (rfont_def, score); |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
452 score_changed = 1; |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
453 } |
89699
cda6f41a592e
(reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
89687
diff
changeset
|
454 } |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
455 |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
456 if (score_changed) |
96556
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
457 qsort (XVECTOR (vec)->contents, size, sizeof (Lisp_Object), |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
458 fontset_compare_rfontdef); |
96556
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
459 XSETCAR (font_group, make_number (charset_ordered_list_tick)); |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
460 } |
91266
3cd59392b3ec
(Vfont_encoding_charset_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
91250
diff
changeset
|
461 |
96556
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
462 static Lisp_Object |
96573
3de01ebe30b7
* fontset.c (fontset_get_font_group):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96556
diff
changeset
|
463 fontset_get_font_group (Lisp_Object fontset, int c) |
96556
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
464 { |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
465 Lisp_Object font_group; |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
466 Lisp_Object base_fontset; |
99980
0a43374c0145
(fontset_add): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
98582
diff
changeset
|
467 int from = 0, to = MAX_CHAR, i; |
96556
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
468 |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
469 xassert (! BASE_FONTSET_P (fontset)); |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
470 if (c >= 0) |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
471 font_group = CHAR_TABLE_REF (fontset, c); |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
472 else |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
473 font_group = FONTSET_FALLBACK (fontset); |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
474 if (! NILP (font_group)) |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
475 return font_group; |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
476 base_fontset = FONTSET_BASE (fontset); |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
477 if (c >= 0) |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
478 font_group = char_table_ref_and_range (base_fontset, c, &from, &to); |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
479 else |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
480 font_group = FONTSET_FALLBACK (base_fontset); |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
481 if (NILP (font_group)) |
101605
b37403eedfa9
(font_for_char): Use assq_no_quit, not assoc_no_quit.
Kenichi Handa <handa@m17n.org>
parents:
101601
diff
changeset
|
482 { |
b37403eedfa9
(font_for_char): Use assq_no_quit, not assoc_no_quit.
Kenichi Handa <handa@m17n.org>
parents:
101601
diff
changeset
|
483 if (c >= 0) |
b37403eedfa9
(font_for_char): Use assq_no_quit, not assoc_no_quit.
Kenichi Handa <handa@m17n.org>
parents:
101601
diff
changeset
|
484 char_table_set_range (fontset, from, to, make_number (0)); |
b37403eedfa9
(font_for_char): Use assq_no_quit, not assoc_no_quit.
Kenichi Handa <handa@m17n.org>
parents:
101601
diff
changeset
|
485 return Qnil; |
b37403eedfa9
(font_for_char): Use assq_no_quit, not assoc_no_quit.
Kenichi Handa <handa@m17n.org>
parents:
101601
diff
changeset
|
486 } |
96556
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
487 font_group = Fcopy_sequence (font_group); |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
488 for (i = 0; i < ASIZE (font_group); i++) |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
489 if (! NILP (AREF (font_group, i))) |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
490 { |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
491 Lisp_Object rfont_def; |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
492 |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
493 RFONT_DEF_NEW (rfont_def, AREF (font_group, i)); |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
494 /* Remember the original order. */ |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
495 RFONT_DEF_SET_SCORE (rfont_def, i); |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
496 ASET (font_group, i, rfont_def); |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
497 } |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
498 font_group = Fcons (make_number (-1), font_group); |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
499 if (c >= 0) |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
500 char_table_set_range (fontset, from, to, font_group); |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
501 else |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
502 FONTSET_FALLBACK (fontset) = font_group; |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
503 return font_group; |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
504 } |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
505 |
89898
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
506 /* Return RFONT-DEF (vector) in the realized fontset FONTSET for the |
91352
b6befec471b8
(reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents:
91336
diff
changeset
|
507 character C. If no font is found, return Qnil if there's a |
b6befec471b8
(reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents:
91336
diff
changeset
|
508 possibility that the default fontset or the fallback font groups |
b6befec471b8
(reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents:
91336
diff
changeset
|
509 have a proper font, and return Qt if not. |
b6befec471b8
(reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents:
91336
diff
changeset
|
510 |
b6befec471b8
(reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents:
91336
diff
changeset
|
511 If a font is found but is not yet opened, open it (if FACE is not |
b6befec471b8
(reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents:
91336
diff
changeset
|
512 NULL) or return Qnil (if FACE is NULL). |
b6befec471b8
(reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents:
91336
diff
changeset
|
513 |
90802
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
514 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
|
515 preference. |
91352
b6befec471b8
(reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents:
91336
diff
changeset
|
516 |
91231
29d8135e8f58
(fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents:
91224
diff
changeset
|
517 If FALLBACK is 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
|
518 |
89898
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
519 static Lisp_Object |
90802
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
520 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
|
521 Lisp_Object fontset; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
522 int c; |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
523 struct face *face; |
90802
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
524 int id, fallback; |
17052 | 525 { |
102414
5988cd89cf0b
(fontset_find_font): If a font found without
Kenichi Handa <handa@m17n.org>
parents:
102241
diff
changeset
|
526 Lisp_Object vec, font_group; |
98575
7e4ece224094
(fontset_find_font): Check frame validity.
Chong Yidong <cyd@stupidchicken.com>
parents:
97824
diff
changeset
|
527 int i, charset_matched = -1; |
7e4ece224094
(fontset_find_font): Check frame validity.
Chong Yidong <cyd@stupidchicken.com>
parents:
97824
diff
changeset
|
528 FRAME_PTR f = (FRAMEP (FONTSET_FRAME (fontset))) |
7e4ece224094
(fontset_find_font): Check frame validity.
Chong Yidong <cyd@stupidchicken.com>
parents:
97824
diff
changeset
|
529 ? XFRAME (selected_frame) : XFRAME (FONTSET_FRAME (fontset)); |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
530 |
96556
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
531 font_group = fontset_get_font_group (fontset, fallback ? -1 : c); |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
532 if (! CONSP (font_group)) |
101522
561d416172d0
(fontset_find_font): Fix handling of non-cons return
Chong Yidong <cyd@stupidchicken.com>
parents:
101447
diff
changeset
|
533 return font_group; |
96556
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
534 vec = XCDR (font_group); |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
535 if (ASIZE (vec) == 0) |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
536 return Qnil; |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
537 |
96556
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
538 if (ASIZE (vec) > 1) |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
539 { |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
540 if (XINT (XCAR (font_group)) != charset_ordered_list_tick) |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
541 /* We have just created the font-group, |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
542 or the charset priorities were changed. */ |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
543 reorder_font_vector (font_group, face->ascii_face->font); |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
544 if (id >= 0) |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
545 /* Find a spec matching with the charset ID to try at |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
546 first. */ |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
547 for (i = 0; i < ASIZE (vec); i++) |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
548 { |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
549 Lisp_Object rfont_def = AREF (vec, i); |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
550 Lisp_Object repertory |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
551 = FONT_DEF_REPERTORY (RFONT_DEF_FONT_DEF (rfont_def)); |
91364
1e43b74bf9e5
(reorder_font_vector): Exclude nil elements from the
Kenichi Handa <handa@m17n.org>
parents:
91352
diff
changeset
|
552 |
96556
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
553 if (XINT (repertory) == id) |
91364
1e43b74bf9e5
(reorder_font_vector): Exclude nil elements from the
Kenichi Handa <handa@m17n.org>
parents:
91352
diff
changeset
|
554 { |
96556
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
555 charset_matched = i; |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
556 break; |
91364
1e43b74bf9e5
(reorder_font_vector): Exclude nil elements from the
Kenichi Handa <handa@m17n.org>
parents:
91352
diff
changeset
|
557 } |
96556
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
558 } |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
559 } |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
560 |
89898
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
561 /* Find the first available font in the vector of RFONT-DEF. */ |
96556
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
562 for (i = 0; i < ASIZE (vec); i++) |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
563 { |
102414
5988cd89cf0b
(fontset_find_font): If a font found without
Kenichi Handa <handa@m17n.org>
parents:
102241
diff
changeset
|
564 Lisp_Object rfont_def, font_def; |
95230
fa14617b247e
Delete unused variables and add casting for char *
Kenichi Handa <handa@m17n.org>
parents:
95212
diff
changeset
|
565 Lisp_Object font_entity, font_object; |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
566 |
96556
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
567 if (i == 0 && charset_matched >= 0) |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
568 { |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
569 /* Try the element matching with the charset ID at first. */ |
102414
5988cd89cf0b
(fontset_find_font): If a font found without
Kenichi Handa <handa@m17n.org>
parents:
102241
diff
changeset
|
570 rfont_def = AREF (vec, charset_matched); |
96556
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
571 charset_matched = -1; |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
572 i--; |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
573 } |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
574 else if (i != charset_matched) |
102414
5988cd89cf0b
(fontset_find_font): If a font found without
Kenichi Handa <handa@m17n.org>
parents:
102241
diff
changeset
|
575 rfont_def = AREF (vec, i); |
96556
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
576 else |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
577 continue; |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
578 |
102414
5988cd89cf0b
(fontset_find_font): If a font found without
Kenichi Handa <handa@m17n.org>
parents:
102241
diff
changeset
|
579 if (NILP (rfont_def)) |
96556
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
580 /* This is a sign of not to try the other fonts. */ |
91364
1e43b74bf9e5
(reorder_font_vector): Exclude nil elements from the
Kenichi Handa <handa@m17n.org>
parents:
91352
diff
changeset
|
581 return Qt; |
102414
5988cd89cf0b
(fontset_find_font): If a font found without
Kenichi Handa <handa@m17n.org>
parents:
102241
diff
changeset
|
582 if (INTEGERP (RFONT_DEF_FACE (rfont_def)) |
5988cd89cf0b
(fontset_find_font): If a font found without
Kenichi Handa <handa@m17n.org>
parents:
102241
diff
changeset
|
583 && XINT (RFONT_DEF_FACE (rfont_def)) < 0) |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
584 /* We couldn't open this font last time. */ |
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
585 continue; |
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
586 |
102414
5988cd89cf0b
(fontset_find_font): If a font found without
Kenichi Handa <handa@m17n.org>
parents:
102241
diff
changeset
|
587 font_object = RFONT_DEF_OBJECT (rfont_def); |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
588 if (NILP (font_object)) |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
589 { |
102414
5988cd89cf0b
(fontset_find_font): If a font found without
Kenichi Handa <handa@m17n.org>
parents:
102241
diff
changeset
|
590 font_def = RFONT_DEF_FONT_DEF (rfont_def); |
90410 | 591 |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
592 if (! face) |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
593 /* We have not yet opened the font. */ |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
594 return Qnil; |
102414
5988cd89cf0b
(fontset_find_font): If a font found without
Kenichi Handa <handa@m17n.org>
parents:
102241
diff
changeset
|
595 /* Find a font best-matching with the spec without checking |
5988cd89cf0b
(fontset_find_font): If a font found without
Kenichi Handa <handa@m17n.org>
parents:
102241
diff
changeset
|
596 the support of the character C. That checking is costly, |
5988cd89cf0b
(fontset_find_font): If a font found without
Kenichi Handa <handa@m17n.org>
parents:
102241
diff
changeset
|
597 and even without the checking, the found font supports C |
5988cd89cf0b
(fontset_find_font): If a font found without
Kenichi Handa <handa@m17n.org>
parents:
102241
diff
changeset
|
598 in high possibility. */ |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
599 font_entity = font_find_for_lface (f, face->lface, |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
600 FONT_DEF_SPEC (font_def), -1); |
91352
b6befec471b8
(reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents:
91336
diff
changeset
|
601 if (NILP (font_entity)) |
90410 | 602 { |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
603 /* Record that no font matches the spec. */ |
102414
5988cd89cf0b
(fontset_find_font): If a font found without
Kenichi Handa <handa@m17n.org>
parents:
102241
diff
changeset
|
604 RFONT_DEF_SET_FACE (rfont_def, -1); |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
605 continue; |
91136
d54684fee154
(fontset_find_font) [USE_FONT_BACKEND]: Try multiple
Kenichi Handa <handa@m17n.org>
parents:
91053
diff
changeset
|
606 } |
95570
b18ab5e0d568
(fontset_find_font): Call font_open_for_lface with the
Kenichi Handa <handa@m17n.org>
parents:
95457
diff
changeset
|
607 font_object = font_open_for_lface (f, font_entity, face->lface, |
b18ab5e0d568
(fontset_find_font): Call font_open_for_lface with the
Kenichi Handa <handa@m17n.org>
parents:
95457
diff
changeset
|
608 FONT_DEF_SPEC (font_def)); |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
609 if (NILP (font_object)) |
91136
d54684fee154
(fontset_find_font) [USE_FONT_BACKEND]: Try multiple
Kenichi Handa <handa@m17n.org>
parents:
91053
diff
changeset
|
610 { |
102414
5988cd89cf0b
(fontset_find_font): If a font found without
Kenichi Handa <handa@m17n.org>
parents:
102241
diff
changeset
|
611 /* Something strange happened, perhaps because of a |
5988cd89cf0b
(fontset_find_font): If a font found without
Kenichi Handa <handa@m17n.org>
parents:
102241
diff
changeset
|
612 Font-backend problem. Too avoid crashing, record |
5988cd89cf0b
(fontset_find_font): If a font found without
Kenichi Handa <handa@m17n.org>
parents:
102241
diff
changeset
|
613 that this spec is unsable. It may be better to find |
5988cd89cf0b
(fontset_find_font): If a font found without
Kenichi Handa <handa@m17n.org>
parents:
102241
diff
changeset
|
614 another font of the same spec, but currently we don't |
5988cd89cf0b
(fontset_find_font): If a font found without
Kenichi Handa <handa@m17n.org>
parents:
102241
diff
changeset
|
615 have such an API. */ |
5988cd89cf0b
(fontset_find_font): If a font found without
Kenichi Handa <handa@m17n.org>
parents:
102241
diff
changeset
|
616 RFONT_DEF_SET_FACE (rfont_def, -1); |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
617 continue; |
91352
b6befec471b8
(reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents:
91336
diff
changeset
|
618 } |
102414
5988cd89cf0b
(fontset_find_font): If a font found without
Kenichi Handa <handa@m17n.org>
parents:
102241
diff
changeset
|
619 RFONT_DEF_SET_OBJECT (rfont_def, font_object); |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
620 } |
95143
3e0cd839473e
(Ffontset_info): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
95127
diff
changeset
|
621 |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
622 if (font_has_char (f, font_object, c)) |
102414
5988cd89cf0b
(fontset_find_font): If a font found without
Kenichi Handa <handa@m17n.org>
parents:
102241
diff
changeset
|
623 return rfont_def; |
91364
1e43b74bf9e5
(reorder_font_vector): Exclude nil elements from the
Kenichi Handa <handa@m17n.org>
parents:
91352
diff
changeset
|
624 |
102414
5988cd89cf0b
(fontset_find_font): If a font found without
Kenichi Handa <handa@m17n.org>
parents:
102241
diff
changeset
|
625 /* Find a font already opened, maching with the current spec, |
5988cd89cf0b
(fontset_find_font): If a font found without
Kenichi Handa <handa@m17n.org>
parents:
102241
diff
changeset
|
626 and supporting C. */ |
5988cd89cf0b
(fontset_find_font): If a font found without
Kenichi Handa <handa@m17n.org>
parents:
102241
diff
changeset
|
627 font_def = RFONT_DEF_FONT_DEF (rfont_def); |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
628 for (i++; i < ASIZE (vec); i++) |
61736 | 629 { |
102414
5988cd89cf0b
(fontset_find_font): If a font found without
Kenichi Handa <handa@m17n.org>
parents:
102241
diff
changeset
|
630 rfont_def = AREF (vec, i); |
5988cd89cf0b
(fontset_find_font): If a font found without
Kenichi Handa <handa@m17n.org>
parents:
102241
diff
changeset
|
631 if (! EQ (RFONT_DEF_FONT_DEF (rfont_def), font_def)) |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
632 break; |
102414
5988cd89cf0b
(fontset_find_font): If a font found without
Kenichi Handa <handa@m17n.org>
parents:
102241
diff
changeset
|
633 font_object = RFONT_DEF_OBJECT (AREF (vec, i)); |
5988cd89cf0b
(fontset_find_font): If a font found without
Kenichi Handa <handa@m17n.org>
parents:
102241
diff
changeset
|
634 xassert (! NILP (font_object)); |
5988cd89cf0b
(fontset_find_font): If a font found without
Kenichi Handa <handa@m17n.org>
parents:
102241
diff
changeset
|
635 if (font_has_char (f, font_object, c)) |
5988cd89cf0b
(fontset_find_font): If a font found without
Kenichi Handa <handa@m17n.org>
parents:
102241
diff
changeset
|
636 return rfont_def; |
89826
b17725d55ba2
(Fset_fontset_font): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
89811
diff
changeset
|
637 } |
102414
5988cd89cf0b
(fontset_find_font): If a font found without
Kenichi Handa <handa@m17n.org>
parents:
102241
diff
changeset
|
638 |
5988cd89cf0b
(fontset_find_font): If a font found without
Kenichi Handa <handa@m17n.org>
parents:
102241
diff
changeset
|
639 /* Find a font-entity with the current spec and supporting C. */ |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
640 font_entity = font_find_for_lface (f, face->lface, |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
641 FONT_DEF_SPEC (font_def), c); |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
642 if (! NILP (font_entity)) |
61736 | 643 { |
102414
5988cd89cf0b
(fontset_find_font): If a font found without
Kenichi Handa <handa@m17n.org>
parents:
102241
diff
changeset
|
644 /* We found a font. Open it and insert a new element for |
5988cd89cf0b
(fontset_find_font): If a font found without
Kenichi Handa <handa@m17n.org>
parents:
102241
diff
changeset
|
645 that font in VEC. */ |
5988cd89cf0b
(fontset_find_font): If a font found without
Kenichi Handa <handa@m17n.org>
parents:
102241
diff
changeset
|
646 Lisp_Object new_vec; |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
647 int j; |
89898
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
648 |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
649 font_object = font_open_for_lface (f, font_entity, face->lface, |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
650 Qnil); |
102414
5988cd89cf0b
(fontset_find_font): If a font found without
Kenichi Handa <handa@m17n.org>
parents:
102241
diff
changeset
|
651 if (NILP (font_object)) |
5988cd89cf0b
(fontset_find_font): If a font found without
Kenichi Handa <handa@m17n.org>
parents:
102241
diff
changeset
|
652 continue; |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
653 RFONT_DEF_NEW (rfont_def, font_def); |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
654 RFONT_DEF_SET_OBJECT (rfont_def, font_object); |
102414
5988cd89cf0b
(fontset_find_font): If a font found without
Kenichi Handa <handa@m17n.org>
parents:
102241
diff
changeset
|
655 RFONT_DEF_SET_SCORE (rfont_def, RFONT_DEF_SCORE (rfont_def)); |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
656 new_vec = Fmake_vector (make_number (ASIZE (vec) + 1), Qnil); |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
657 for (j = 0; j < i; j++) |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
658 ASET (new_vec, j, AREF (vec, j)); |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
659 ASET (new_vec, j, rfont_def); |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
660 for (j++; j < ASIZE (new_vec); j++) |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
661 ASET (new_vec, j, AREF (vec, j - 1)); |
102414
5988cd89cf0b
(fontset_find_font): If a font found without
Kenichi Handa <handa@m17n.org>
parents:
102241
diff
changeset
|
662 XSETCDR (font_group, new_vec); |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
663 return rfont_def; |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
664 } |
102414
5988cd89cf0b
(fontset_find_font): If a font found without
Kenichi Handa <handa@m17n.org>
parents:
102241
diff
changeset
|
665 |
5988cd89cf0b
(fontset_find_font): If a font found without
Kenichi Handa <handa@m17n.org>
parents:
102241
diff
changeset
|
666 /* No font of the current spec for C. Try the next spec. */ |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
667 i--; |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
668 } |
91352
b6befec471b8
(reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents:
91336
diff
changeset
|
669 |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
670 FONTSET_SET (fontset, make_number (c), make_number (0)); |
91364
1e43b74bf9e5
(reorder_font_vector): Exclude nil elements from the
Kenichi Handa <handa@m17n.org>
parents:
91352
diff
changeset
|
671 return Qnil; |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
672 } |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
673 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
674 |
53353
b085f18ebcf0
(Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
53072
diff
changeset
|
675 static Lisp_Object |
90802
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
676 fontset_font (fontset, c, face, id) |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
677 Lisp_Object fontset; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
678 int c; |
90802
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
679 struct face *face; |
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
680 int id; |
17052 | 681 { |
90802
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
682 Lisp_Object rfont_def; |
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
683 Lisp_Object base_fontset; |
89811
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
684 |
96556
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
685 /* Try a font-group of FONTSET. */ |
90802
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
686 rfont_def = fontset_find_font (fontset, c, face, id, 0); |
91364
1e43b74bf9e5
(reorder_font_vector): Exclude nil elements from the
Kenichi Handa <handa@m17n.org>
parents:
91352
diff
changeset
|
687 if (VECTORP (rfont_def)) |
1e43b74bf9e5
(reorder_font_vector): Exclude nil elements from the
Kenichi Handa <handa@m17n.org>
parents:
91352
diff
changeset
|
688 return rfont_def; |
1e43b74bf9e5
(reorder_font_vector): Exclude nil elements from the
Kenichi Handa <handa@m17n.org>
parents:
91352
diff
changeset
|
689 if (EQ (rfont_def, Qt)) |
1e43b74bf9e5
(reorder_font_vector): Exclude nil elements from the
Kenichi Handa <handa@m17n.org>
parents:
91352
diff
changeset
|
690 return Qnil; |
96556
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
691 |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
692 /* Try a font-group of the default fontset. */ |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
693 base_fontset = FONTSET_BASE (fontset); |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
694 if (! EQ (base_fontset, Vdefault_fontset)) |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
695 { |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
696 if (NILP (FONTSET_DEFAULT (fontset))) |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
697 FONTSET_DEFAULT (fontset) |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
698 = make_fontset (FONTSET_FRAME (fontset), Qnil, Vdefault_fontset); |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
699 rfont_def = fontset_find_font (FONTSET_DEFAULT (fontset), c, face, id, 0); |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
700 if (VECTORP (rfont_def)) |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
701 return rfont_def; |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
702 if (EQ (rfont_def, Qt)) |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
703 return Qnil; |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
704 } |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
705 |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
706 /* Try a fallback font-group of FONTSET. */ |
90802
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
707 rfont_def = fontset_find_font (fontset, c, face, id, 1); |
95230
fa14617b247e
Delete unused variables and add casting for char *
Kenichi Handa <handa@m17n.org>
parents:
95212
diff
changeset
|
708 if (VECTORP (rfont_def)) |
fa14617b247e
Delete unused variables and add casting for char *
Kenichi Handa <handa@m17n.org>
parents:
95212
diff
changeset
|
709 return rfont_def; |
fa14617b247e
Delete unused variables and add casting for char *
Kenichi Handa <handa@m17n.org>
parents:
95212
diff
changeset
|
710 if (EQ (rfont_def, Qt)) |
fa14617b247e
Delete unused variables and add casting for char *
Kenichi Handa <handa@m17n.org>
parents:
95212
diff
changeset
|
711 return Qnil; |
fa14617b247e
Delete unused variables and add casting for char *
Kenichi Handa <handa@m17n.org>
parents:
95212
diff
changeset
|
712 |
96556
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
713 /* Try a fallback font-group of the default fontset . */ |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
714 if (! EQ (base_fontset, Vdefault_fontset)) |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
715 { |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
716 rfont_def = fontset_find_font (FONTSET_DEFAULT (fontset), c, face, id, 1); |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
717 if (VECTORP (rfont_def)) |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
718 return rfont_def; |
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
719 } |
91352
b6befec471b8
(reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents:
91336
diff
changeset
|
720 |
101447
1b4c2ecbf939
(fontset_font): If we know there is no font, don't do any work.
Chong Yidong <cyd@stupidchicken.com>
parents:
100951
diff
changeset
|
721 /* Remember that we have no font for C. */ |
96556
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
722 FONTSET_SET (fontset, make_number (c), Qt); |
91352
b6befec471b8
(reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents:
91336
diff
changeset
|
723 |
96556
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
724 return Qnil; |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
725 } |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
726 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
727 /* Return a newly created fontset with NAME. If BASE is nil, make a |
88405 | 728 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
|
729 BASE. */ |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
730 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
731 static Lisp_Object |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
732 make_fontset (frame, name, base) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
733 Lisp_Object frame, name, base; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
734 { |
34975
0d69e2d2724e
(fontset_ref): Remove unused variable `i'.
Eli Zaretskii <eliz@gnu.org>
parents:
32978
diff
changeset
|
735 Lisp_Object fontset; |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
736 int size = ASIZE (Vfontset_table); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
737 int id = next_fontset_id; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
738 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
739 /* 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
|
740 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
|
741 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
|
742 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
|
743 id. */ |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
744 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
|
745 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
746 if (id + 1 == size) |
91053 | 747 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
|
748 |
29767
c8e5453dc85d
(FONTSET_ASCII): Use the first element of char table
Kenichi Handa <handa@m17n.org>
parents:
29501
diff
changeset
|
749 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
|
750 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
751 FONTSET_ID (fontset) = make_number (id); |
88405 | 752 if (NILP (base)) |
753 { | |
754 FONTSET_NAME (fontset) = name; | |
755 } | |
756 else | |
757 { | |
758 FONTSET_NAME (fontset) = Qnil; | |
759 FONTSET_FRAME (fontset) = frame; | |
760 FONTSET_BASE (fontset) = base; | |
761 } | |
17052 | 762 |
88405 | 763 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
|
764 next_fontset_id = id + 1; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
765 return fontset; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
766 } |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
767 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
768 |
60511
7ee9d8cb89cb
(set_default_ascii_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
58025
diff
changeset
|
769 /* 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
|
770 not yet set. */ |
7ee9d8cb89cb
(set_default_ascii_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
58025
diff
changeset
|
771 void |
7ee9d8cb89cb
(set_default_ascii_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
58025
diff
changeset
|
772 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
|
773 Lisp_Object fontname; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
774 { |
90121
4465a2011c2d
(set_default_ascii_font): Fix the change for syncing with CVS head.
Kenichi Handa <handa@m17n.org>
parents:
90116
diff
changeset
|
775 if (! STRINGP (FONTSET_ASCII (Vdefault_fontset))) |
60511
7ee9d8cb89cb
(set_default_ascii_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
58025
diff
changeset
|
776 { |
7ee9d8cb89cb
(set_default_ascii_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
58025
diff
changeset
|
777 int id = fs_query_fontset (fontname, 2); |
41987
34952771ae85
Fix typos, remove unnecessary space.
Pavel Janík <Pavel@Janik.cz>
parents:
41052
diff
changeset
|
778 |
60511
7ee9d8cb89cb
(set_default_ascii_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
58025
diff
changeset
|
779 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
|
780 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
|
781 FONTSET_ASCII (Vdefault_fontset)= fontname; |
60511
7ee9d8cb89cb
(set_default_ascii_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
58025
diff
changeset
|
782 } |
17052 | 783 } |
784 | |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
785 |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
786 /********** 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
|
787 |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
788 /* 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
|
789 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
790 Lisp_Object |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
791 fontset_name (id) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
792 int id; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
793 { |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
794 Lisp_Object fontset; |
88405 | 795 |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
796 fontset = FONTSET_FROM_ID (id); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
797 return FONTSET_NAME (fontset); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
798 } |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
799 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
800 |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
801 /* 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
|
802 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
803 Lisp_Object |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
804 fontset_ascii (id) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
805 int id; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
806 { |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
807 Lisp_Object fontset, elt; |
88405 | 808 |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
809 fontset= FONTSET_FROM_ID (id); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
810 elt = FONTSET_ASCII (fontset); |
90410 | 811 if (CONSP (elt)) |
812 elt = XCAR (elt); | |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
813 return elt; |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
814 } |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
815 |
91908
6916adc8df33
(FONTSET_OBJLIST): New macro.
Kenichi Handa <handa@m17n.org>
parents:
91887
diff
changeset
|
816 void |
6916adc8df33
(FONTSET_OBJLIST): New macro.
Kenichi Handa <handa@m17n.org>
parents:
91887
diff
changeset
|
817 free_realized_fontset (f, fontset) |
6916adc8df33
(FONTSET_OBJLIST): New macro.
Kenichi Handa <handa@m17n.org>
parents:
91887
diff
changeset
|
818 FRAME_PTR f; |
6916adc8df33
(FONTSET_OBJLIST): New macro.
Kenichi Handa <handa@m17n.org>
parents:
91887
diff
changeset
|
819 Lisp_Object fontset; |
6916adc8df33
(FONTSET_OBJLIST): New macro.
Kenichi Handa <handa@m17n.org>
parents:
91887
diff
changeset
|
820 { |
6916adc8df33
(FONTSET_OBJLIST): New macro.
Kenichi Handa <handa@m17n.org>
parents:
91887
diff
changeset
|
821 Lisp_Object tail; |
6916adc8df33
(FONTSET_OBJLIST): New macro.
Kenichi Handa <handa@m17n.org>
parents:
91887
diff
changeset
|
822 |
6916adc8df33
(FONTSET_OBJLIST): New macro.
Kenichi Handa <handa@m17n.org>
parents:
91887
diff
changeset
|
823 return; |
6916adc8df33
(FONTSET_OBJLIST): New macro.
Kenichi Handa <handa@m17n.org>
parents:
91887
diff
changeset
|
824 for (tail = FONTSET_OBJLIST (fontset); CONSP (tail); tail = XCDR (tail)) |
6916adc8df33
(FONTSET_OBJLIST): New macro.
Kenichi Handa <handa@m17n.org>
parents:
91887
diff
changeset
|
825 { |
6916adc8df33
(FONTSET_OBJLIST): New macro.
Kenichi Handa <handa@m17n.org>
parents:
91887
diff
changeset
|
826 xassert (FONT_OBJECT_P (XCAR (tail))); |
6916adc8df33
(FONTSET_OBJLIST): New macro.
Kenichi Handa <handa@m17n.org>
parents:
91887
diff
changeset
|
827 font_close_object (f, XCAR (tail)); |
6916adc8df33
(FONTSET_OBJLIST): New macro.
Kenichi Handa <handa@m17n.org>
parents:
91887
diff
changeset
|
828 } |
6916adc8df33
(FONTSET_OBJLIST): New macro.
Kenichi Handa <handa@m17n.org>
parents:
91887
diff
changeset
|
829 } |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
830 |
88405 | 831 /* Free fontset of FACE defined on frame F. Called from |
832 free_realized_face. */ | |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
833 |
17052 | 834 void |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
835 free_face_fontset (f, face) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
836 FRAME_PTR f; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
837 struct face *face; |
17052 | 838 { |
89610
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
839 Lisp_Object fontset; |
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
840 |
91668
aeadaa72f7b1
(free_face_fontset): Use FONTSET_FROM_ID.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91513
diff
changeset
|
841 fontset = FONTSET_FROM_ID (face->fontset); |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
842 if (NILP (fontset)) |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
843 return; |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
844 xassert (! BASE_FONTSET_P (fontset)); |
89610
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
845 xassert (f == XFRAME (FONTSET_FRAME (fontset))); |
91908
6916adc8df33
(FONTSET_OBJLIST): New macro.
Kenichi Handa <handa@m17n.org>
parents:
91887
diff
changeset
|
846 free_realized_fontset (f, fontset); |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
847 ASET (Vfontset_table, face->fontset, Qnil); |
88405 | 848 if (face->fontset < next_fontset_id) |
849 next_fontset_id = face->fontset; | |
89805
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
850 if (! NILP (FONTSET_DEFAULT (fontset))) |
17052 | 851 { |
89865 | 852 int id = XINT (FONTSET_ID (FONTSET_DEFAULT (fontset))); |
95143
3e0cd839473e
(Ffontset_info): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
95127
diff
changeset
|
853 |
89610
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
854 fontset = AREF (Vfontset_table, id); |
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
855 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
|
856 xassert (f == XFRAME (FONTSET_FRAME (fontset))); |
91908
6916adc8df33
(FONTSET_OBJLIST): New macro.
Kenichi Handa <handa@m17n.org>
parents:
91887
diff
changeset
|
857 free_realized_fontset (f, fontset); |
89610
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
858 ASET (Vfontset_table, id, Qnil); |
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
859 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
|
860 next_fontset_id = face->fontset; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
861 } |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
862 face->fontset = -1; |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
863 } |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
864 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
865 |
78501 | 866 /* 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
|
867 Otherwise return 0. Called from the macro FACE_SUITABLE_FOR_CHAR_P |
88405 | 868 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
|
869 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
870 int |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
871 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
|
872 struct face *face; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
873 int c; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
874 { |
89898
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
875 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
|
876 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
877 fontset = FONTSET_FROM_ID (face->fontset); |
89898
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
878 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
|
879 return (VECTORP (rfont_def) |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
880 && INTEGERP (RFONT_DEF_FACE (rfont_def)) |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
881 && face->id == XINT (RFONT_DEF_FACE (rfont_def))); |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
882 } |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
883 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
884 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
885 /* 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
|
886 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
|
887 the macro FACE_FOR_CHAR. */ |
17052 | 888 |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
889 int |
89699
cda6f41a592e
(reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
89687
diff
changeset
|
890 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
|
891 FRAME_PTR f; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
892 struct face *face; |
89699
cda6f41a592e
(reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
89687
diff
changeset
|
893 int c, pos; |
cda6f41a592e
(reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
89687
diff
changeset
|
894 Lisp_Object object; |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
895 { |
97539
cc7d396b5612
(face_for_char): Add font log.
Kenichi Handa <handa@m17n.org>
parents:
97043
diff
changeset
|
896 Lisp_Object fontset, rfont_def, charset; |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
897 int face_id; |
89699
cda6f41a592e
(reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
89687
diff
changeset
|
898 int id; |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
899 |
98582
13af2a2ff3db
(face_for_char): If face->fontset is negative, just return ascii_face.
Kenichi Handa <handa@m17n.org>
parents:
98575
diff
changeset
|
900 /* If face->fontset is negative (that happens when no font is found |
13af2a2ff3db
(face_for_char): If face->fontset is negative, just return ascii_face.
Kenichi Handa <handa@m17n.org>
parents:
98575
diff
changeset
|
901 for face), just return face->ascii_face because we can't do |
13af2a2ff3db
(face_for_char): If face->fontset is negative, just return ascii_face.
Kenichi Handa <handa@m17n.org>
parents:
98575
diff
changeset
|
902 anything. Perhaps, we should fix the callers to assure |
13af2a2ff3db
(face_for_char): If face->fontset is negative, just return ascii_face.
Kenichi Handa <handa@m17n.org>
parents:
98575
diff
changeset
|
903 that face->fontset is always valid. */ |
13af2a2ff3db
(face_for_char): If face->fontset is negative, just return ascii_face.
Kenichi Handa <handa@m17n.org>
parents:
98575
diff
changeset
|
904 if (ASCII_CHAR_P (c) || face->fontset < 0) |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
905 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
|
906 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
907 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
|
908 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
|
909 xassert (!BASE_FONTSET_P (fontset)); |
96556
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
910 |
89699
cda6f41a592e
(reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
89687
diff
changeset
|
911 if (pos < 0) |
97539
cc7d396b5612
(face_for_char): Add font log.
Kenichi Handa <handa@m17n.org>
parents:
97043
diff
changeset
|
912 { |
cc7d396b5612
(face_for_char): Add font log.
Kenichi Handa <handa@m17n.org>
parents:
97043
diff
changeset
|
913 id = -1; |
cc7d396b5612
(face_for_char): Add font log.
Kenichi Handa <handa@m17n.org>
parents:
97043
diff
changeset
|
914 charset = Qnil; |
cc7d396b5612
(face_for_char): Add font log.
Kenichi Handa <handa@m17n.org>
parents:
97043
diff
changeset
|
915 } |
89699
cda6f41a592e
(reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
89687
diff
changeset
|
916 else |
cda6f41a592e
(reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
89687
diff
changeset
|
917 { |
cda6f41a592e
(reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
89687
diff
changeset
|
918 charset = Fget_char_property (make_number (pos), Qcharset, object); |
100168
acef56f002fc
(face_for_char): Handle invalid charset property
Kenichi Handa <handa@m17n.org>
parents:
99980
diff
changeset
|
919 if (CHARSETP (charset)) |
91266
3cd59392b3ec
(Vfont_encoding_charset_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
91250
diff
changeset
|
920 { |
3cd59392b3ec
(Vfont_encoding_charset_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
91250
diff
changeset
|
921 Lisp_Object val; |
3cd59392b3ec
(Vfont_encoding_charset_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
91250
diff
changeset
|
922 |
101553
a44c0bbce387
(font_for_char): Use assq_no_quit, not assoc_no_quit.
Kenichi Handa <handa@m17n.org>
parents:
101522
diff
changeset
|
923 val = assq_no_quit (charset, Vfont_encoding_charset_alist); |
91266
3cd59392b3ec
(Vfont_encoding_charset_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
91250
diff
changeset
|
924 if (CONSP (val) && CHARSETP (XCDR (val))) |
3cd59392b3ec
(Vfont_encoding_charset_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
91250
diff
changeset
|
925 charset = XCDR (val); |
3cd59392b3ec
(Vfont_encoding_charset_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
91250
diff
changeset
|
926 id = XINT (CHARSET_SYMBOL_ID (charset)); |
3cd59392b3ec
(Vfont_encoding_charset_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
91250
diff
changeset
|
927 } |
100168
acef56f002fc
(face_for_char): Handle invalid charset property
Kenichi Handa <handa@m17n.org>
parents:
99980
diff
changeset
|
928 else |
acef56f002fc
(face_for_char): Handle invalid charset property
Kenichi Handa <handa@m17n.org>
parents:
99980
diff
changeset
|
929 id = -1; |
89699
cda6f41a592e
(reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
89687
diff
changeset
|
930 } |
95291
5ad7b7aaa2a5
(face_for_char): Optimize for the case of no charset property.
Kenichi Handa <handa@m17n.org>
parents:
95256
diff
changeset
|
931 |
97556
0fc47f017980
(reorder_font_vector): Use encoding charset of fonts
Kenichi Handa <handa@m17n.org>
parents:
97539
diff
changeset
|
932 font_deferred_log ("font for", Fcons (make_number (c), charset), Qnil); |
89898
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
933 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
|
934 if (VECTORP (rfont_def)) |
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
935 { |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
936 if (INTEGERP (RFONT_DEF_FACE (rfont_def))) |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
937 face_id = XINT (RFONT_DEF_FACE (rfont_def)); |
90410 | 938 else |
89898
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
939 { |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
940 Lisp_Object font_object; |
41987
34952771ae85
Fix typos, remove unnecessary space.
Pavel Janík <Pavel@Janik.cz>
parents:
41052
diff
changeset
|
941 |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
942 font_object = RFONT_DEF_OBJECT (rfont_def); |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
943 face_id = face_for_font (f, font_object, face); |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
944 RFONT_DEF_SET_FACE (rfont_def, face_id); |
89898
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
945 } |
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
946 } |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
947 else |
89898
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
948 { |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
949 if (INTEGERP (FONTSET_NOFONT_FACE (fontset))) |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
950 face_id = XINT (FONTSET_NOFONT_FACE (fontset)); |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
951 else |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
952 { |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
953 face_id = face_for_font (f, Qnil, face); |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
954 FONTSET_NOFONT_FACE (fontset) = make_number (face_id); |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
955 } |
89898
0167306cb580
(fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents:
89865
diff
changeset
|
956 } |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
957 xassert (face_id >= 0); |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
958 return face_id; |
17052 | 959 } |
960 | |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
961 |
97824
991e41e2d92a
(font_for_char): New function.
Kenichi Handa <handa@m17n.org>
parents:
97556
diff
changeset
|
962 Lisp_Object |
991e41e2d92a
(font_for_char): New function.
Kenichi Handa <handa@m17n.org>
parents:
97556
diff
changeset
|
963 font_for_char (face, c, pos, object) |
991e41e2d92a
(font_for_char): New function.
Kenichi Handa <handa@m17n.org>
parents:
97556
diff
changeset
|
964 struct face *face; |
991e41e2d92a
(font_for_char): New function.
Kenichi Handa <handa@m17n.org>
parents:
97556
diff
changeset
|
965 int c, pos; |
991e41e2d92a
(font_for_char): New function.
Kenichi Handa <handa@m17n.org>
parents:
97556
diff
changeset
|
966 Lisp_Object object; |
991e41e2d92a
(font_for_char): New function.
Kenichi Handa <handa@m17n.org>
parents:
97556
diff
changeset
|
967 { |
991e41e2d92a
(font_for_char): New function.
Kenichi Handa <handa@m17n.org>
parents:
97556
diff
changeset
|
968 Lisp_Object fontset, rfont_def, charset; |
991e41e2d92a
(font_for_char): New function.
Kenichi Handa <handa@m17n.org>
parents:
97556
diff
changeset
|
969 int face_id; |
991e41e2d92a
(font_for_char): New function.
Kenichi Handa <handa@m17n.org>
parents:
97556
diff
changeset
|
970 int id; |
991e41e2d92a
(font_for_char): New function.
Kenichi Handa <handa@m17n.org>
parents:
97556
diff
changeset
|
971 |
991e41e2d92a
(font_for_char): New function.
Kenichi Handa <handa@m17n.org>
parents:
97556
diff
changeset
|
972 if (ASCII_CHAR_P (c)) |
991e41e2d92a
(font_for_char): New function.
Kenichi Handa <handa@m17n.org>
parents:
97556
diff
changeset
|
973 { |
991e41e2d92a
(font_for_char): New function.
Kenichi Handa <handa@m17n.org>
parents:
97556
diff
changeset
|
974 Lisp_Object font_object; |
991e41e2d92a
(font_for_char): New function.
Kenichi Handa <handa@m17n.org>
parents:
97556
diff
changeset
|
975 |
991e41e2d92a
(font_for_char): New function.
Kenichi Handa <handa@m17n.org>
parents:
97556
diff
changeset
|
976 XSETFONT (font_object, face->ascii_face->font); |
991e41e2d92a
(font_for_char): New function.
Kenichi Handa <handa@m17n.org>
parents:
97556
diff
changeset
|
977 return font_object; |
991e41e2d92a
(font_for_char): New function.
Kenichi Handa <handa@m17n.org>
parents:
97556
diff
changeset
|
978 } |
991e41e2d92a
(font_for_char): New function.
Kenichi Handa <handa@m17n.org>
parents:
97556
diff
changeset
|
979 |
991e41e2d92a
(font_for_char): New function.
Kenichi Handa <handa@m17n.org>
parents:
97556
diff
changeset
|
980 xassert (fontset_id_valid_p (face->fontset)); |
991e41e2d92a
(font_for_char): New function.
Kenichi Handa <handa@m17n.org>
parents:
97556
diff
changeset
|
981 fontset = FONTSET_FROM_ID (face->fontset); |
991e41e2d92a
(font_for_char): New function.
Kenichi Handa <handa@m17n.org>
parents:
97556
diff
changeset
|
982 xassert (!BASE_FONTSET_P (fontset)); |
991e41e2d92a
(font_for_char): New function.
Kenichi Handa <handa@m17n.org>
parents:
97556
diff
changeset
|
983 if (pos < 0) |
991e41e2d92a
(font_for_char): New function.
Kenichi Handa <handa@m17n.org>
parents:
97556
diff
changeset
|
984 { |
991e41e2d92a
(font_for_char): New function.
Kenichi Handa <handa@m17n.org>
parents:
97556
diff
changeset
|
985 id = -1; |
991e41e2d92a
(font_for_char): New function.
Kenichi Handa <handa@m17n.org>
parents:
97556
diff
changeset
|
986 charset = Qnil; |
991e41e2d92a
(font_for_char): New function.
Kenichi Handa <handa@m17n.org>
parents:
97556
diff
changeset
|
987 } |
991e41e2d92a
(font_for_char): New function.
Kenichi Handa <handa@m17n.org>
parents:
97556
diff
changeset
|
988 else |
991e41e2d92a
(font_for_char): New function.
Kenichi Handa <handa@m17n.org>
parents:
97556
diff
changeset
|
989 { |
991e41e2d92a
(font_for_char): New function.
Kenichi Handa <handa@m17n.org>
parents:
97556
diff
changeset
|
990 charset = Fget_char_property (make_number (pos), Qcharset, object); |
100168
acef56f002fc
(face_for_char): Handle invalid charset property
Kenichi Handa <handa@m17n.org>
parents:
99980
diff
changeset
|
991 if (CHARSETP (charset)) |
97824
991e41e2d92a
(font_for_char): New function.
Kenichi Handa <handa@m17n.org>
parents:
97556
diff
changeset
|
992 { |
991e41e2d92a
(font_for_char): New function.
Kenichi Handa <handa@m17n.org>
parents:
97556
diff
changeset
|
993 Lisp_Object val; |
991e41e2d92a
(font_for_char): New function.
Kenichi Handa <handa@m17n.org>
parents:
97556
diff
changeset
|
994 |
101601
58bce94ff020
(font_for_char): Use assq_no_quit, not assoc_no_quit.
Kenichi Handa <handa@m17n.org>
parents:
101553
diff
changeset
|
995 val = assq_no_quit (charset, Vfont_encoding_charset_alist); |
97824
991e41e2d92a
(font_for_char): New function.
Kenichi Handa <handa@m17n.org>
parents:
97556
diff
changeset
|
996 if (CONSP (val) && CHARSETP (XCDR (val))) |
991e41e2d92a
(font_for_char): New function.
Kenichi Handa <handa@m17n.org>
parents:
97556
diff
changeset
|
997 charset = XCDR (val); |
991e41e2d92a
(font_for_char): New function.
Kenichi Handa <handa@m17n.org>
parents:
97556
diff
changeset
|
998 id = XINT (CHARSET_SYMBOL_ID (charset)); |
991e41e2d92a
(font_for_char): New function.
Kenichi Handa <handa@m17n.org>
parents:
97556
diff
changeset
|
999 } |
100168
acef56f002fc
(face_for_char): Handle invalid charset property
Kenichi Handa <handa@m17n.org>
parents:
99980
diff
changeset
|
1000 else |
acef56f002fc
(face_for_char): Handle invalid charset property
Kenichi Handa <handa@m17n.org>
parents:
99980
diff
changeset
|
1001 id = -1; |
97824
991e41e2d92a
(font_for_char): New function.
Kenichi Handa <handa@m17n.org>
parents:
97556
diff
changeset
|
1002 } |
991e41e2d92a
(font_for_char): New function.
Kenichi Handa <handa@m17n.org>
parents:
97556
diff
changeset
|
1003 |
991e41e2d92a
(font_for_char): New function.
Kenichi Handa <handa@m17n.org>
parents:
97556
diff
changeset
|
1004 font_deferred_log ("font for", Fcons (make_number (c), charset), Qnil); |
991e41e2d92a
(font_for_char): New function.
Kenichi Handa <handa@m17n.org>
parents:
97556
diff
changeset
|
1005 rfont_def = fontset_font (fontset, c, face, id); |
991e41e2d92a
(font_for_char): New function.
Kenichi Handa <handa@m17n.org>
parents:
97556
diff
changeset
|
1006 return (VECTORP (rfont_def) |
991e41e2d92a
(font_for_char): New function.
Kenichi Handa <handa@m17n.org>
parents:
97556
diff
changeset
|
1007 ? RFONT_DEF_OBJECT (rfont_def) |
991e41e2d92a
(font_for_char): New function.
Kenichi Handa <handa@m17n.org>
parents:
97556
diff
changeset
|
1008 : Qnil); |
991e41e2d92a
(font_for_char): New function.
Kenichi Handa <handa@m17n.org>
parents:
97556
diff
changeset
|
1009 } |
991e41e2d92a
(font_for_char): New function.
Kenichi Handa <handa@m17n.org>
parents:
97556
diff
changeset
|
1010 |
991e41e2d92a
(font_for_char): New function.
Kenichi Handa <handa@m17n.org>
parents:
97556
diff
changeset
|
1011 |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1012 /* 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
|
1013 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
|
1014 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
|
1015 Called from realize_x_face. */ |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1016 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1017 int |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1018 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
|
1019 FRAME_PTR f; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1020 int base_fontset_id; |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1021 struct face *face; |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1022 { |
34975
0d69e2d2724e
(fontset_ref): Remove unused variable `i'.
Eli Zaretskii <eliz@gnu.org>
parents:
32978
diff
changeset
|
1023 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
|
1024 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1025 XSETFRAME (frame, f); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1026 if (base_fontset_id >= 0) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1027 { |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1028 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
|
1029 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
|
1030 base_fontset = FONTSET_BASE (base_fontset); |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1031 if (! BASE_FONTSET_P (base_fontset)) |
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1032 abort (); |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1033 } |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1034 else |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1035 base_fontset = Vdefault_fontset; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1036 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1037 fontset = make_fontset (frame, Qnil, base_fontset); |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1038 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
|
1039 } |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1040 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1041 |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1042 |
17052 | 1043 /* Cache data used by fontset_pattern_regexp. The car part is a |
1044 pattern string containing at least one wild card, the cdr part is | |
1045 the corresponding regular expression. */ | |
1046 static Lisp_Object Vcached_fontset_data; | |
1047 | |
95230
fa14617b247e
Delete unused variables and add casting for char *
Kenichi Handa <handa@m17n.org>
parents:
95212
diff
changeset
|
1048 #define CACHED_FONTSET_NAME ((char *) 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
|
1049 #define CACHED_FONTSET_REGEX (XCDR (Vcached_fontset_data)) |
17052 | 1050 |
1051 /* If fontset name PATTERN contains any wild card, return regular | |
1052 expression corresponding to PATTERN. */ | |
1053 | |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1054 static Lisp_Object |
17052 | 1055 fontset_pattern_regexp (pattern) |
1056 Lisp_Object pattern; | |
1057 { | |
95230
fa14617b247e
Delete unused variables and add casting for char *
Kenichi Handa <handa@m17n.org>
parents:
95212
diff
changeset
|
1058 if (!index ((char *) SDATA (pattern), '*') |
fa14617b247e
Delete unused variables and add casting for char *
Kenichi Handa <handa@m17n.org>
parents:
95212
diff
changeset
|
1059 && !index ((char *) SDATA (pattern), '?')) |
17052 | 1060 /* PATTERN does not contain any wild cards. */ |
17730
4bbcc6804b5d
(Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
17331
diff
changeset
|
1061 return Qnil; |
17052 | 1062 |
1063 if (!CONSP (Vcached_fontset_data) | |
95230
fa14617b247e
Delete unused variables and add casting for char *
Kenichi Handa <handa@m17n.org>
parents:
95212
diff
changeset
|
1064 || strcmp ((char *) SDATA (pattern), CACHED_FONTSET_NAME)) |
17052 | 1065 { |
1066 /* 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
|
1067 unsigned char *regex, *p0, *p1; |
96020
b52fa52cd0fa
(fontset_pattern_regexp): Escape some regexp characters.
Kenichi Handa <handa@m17n.org>
parents:
95961
diff
changeset
|
1068 int ndashes = 0, nstars = 0, nescs = 0; |
57947
678d2c0d522e
(fontset_pattern_regexp): Use unsigned char.
Kim F. Storm <storm@cua.dk>
parents:
57921
diff
changeset
|
1069 |
57685
b935fc1cb542
(fontset_pattern_regexp): Optimize for the case that
Kenichi Handa <handa@m17n.org>
parents:
57573
diff
changeset
|
1070 for (p0 = SDATA (pattern); *p0; p0++) |
b935fc1cb542
(fontset_pattern_regexp): Optimize for the case that
Kenichi Handa <handa@m17n.org>
parents:
57573
diff
changeset
|
1071 { |
b935fc1cb542
(fontset_pattern_regexp): Optimize for the case that
Kenichi Handa <handa@m17n.org>
parents:
57573
diff
changeset
|
1072 if (*p0 == '-') |
b935fc1cb542
(fontset_pattern_regexp): Optimize for the case that
Kenichi Handa <handa@m17n.org>
parents:
57573
diff
changeset
|
1073 ndashes++; |
58025
bcd053632eb2
(fontset_pattern_regexp): Cancel my previous change;
Kenichi Handa <handa@m17n.org>
parents:
57947
diff
changeset
|
1074 else if (*p0 == '*') |
57685
b935fc1cb542
(fontset_pattern_regexp): Optimize for the case that
Kenichi Handa <handa@m17n.org>
parents:
57573
diff
changeset
|
1075 nstars++; |
96020
b52fa52cd0fa
(fontset_pattern_regexp): Escape some regexp characters.
Kenichi Handa <handa@m17n.org>
parents:
95961
diff
changeset
|
1076 else if (*p0 == '[' |
b52fa52cd0fa
(fontset_pattern_regexp): Escape some regexp characters.
Kenichi Handa <handa@m17n.org>
parents:
95961
diff
changeset
|
1077 || *p0 == '.' || *p0 == '\\' |
101943
97c9e9322753
Remove spurious semicolons.
Juanma Barranquero <lekktu@gmail.com>
parents:
101605
diff
changeset
|
1078 || *p0 == '+' || *p0 == '^' |
96020
b52fa52cd0fa
(fontset_pattern_regexp): Escape some regexp characters.
Kenichi Handa <handa@m17n.org>
parents:
95961
diff
changeset
|
1079 || *p0 == '$') |
b52fa52cd0fa
(fontset_pattern_regexp): Escape some regexp characters.
Kenichi Handa <handa@m17n.org>
parents:
95961
diff
changeset
|
1080 nescs++; |
57685
b935fc1cb542
(fontset_pattern_regexp): Optimize for the case that
Kenichi Handa <handa@m17n.org>
parents:
57573
diff
changeset
|
1081 } |
17052 | 1082 |
57685
b935fc1cb542
(fontset_pattern_regexp): Optimize for the case that
Kenichi Handa <handa@m17n.org>
parents:
57573
diff
changeset
|
1083 /* 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
|
1084 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
|
1085 expression matching. */ |
b935fc1cb542
(fontset_pattern_regexp): Optimize for the case that
Kenichi Handa <handa@m17n.org>
parents:
57573
diff
changeset
|
1086 if (ndashes < 14) |
96020
b52fa52cd0fa
(fontset_pattern_regexp): Escape some regexp characters.
Kenichi Handa <handa@m17n.org>
parents:
95961
diff
changeset
|
1087 p1 = regex = (unsigned char *) alloca (SBYTES (pattern) + 2 * nstars + 2 * nescs + 1); |
57685
b935fc1cb542
(fontset_pattern_regexp): Optimize for the case that
Kenichi Handa <handa@m17n.org>
parents:
57573
diff
changeset
|
1088 else |
96020
b52fa52cd0fa
(fontset_pattern_regexp): Escape some regexp characters.
Kenichi Handa <handa@m17n.org>
parents:
95961
diff
changeset
|
1089 p1 = regex = (unsigned char *) alloca (SBYTES (pattern) + 5 * nstars + 2 * nescs + 1); |
57685
b935fc1cb542
(fontset_pattern_regexp): Optimize for the case that
Kenichi Handa <handa@m17n.org>
parents:
57573
diff
changeset
|
1090 |
17730
4bbcc6804b5d
(Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
17331
diff
changeset
|
1091 *p1++ = '^'; |
57947
678d2c0d522e
(fontset_pattern_regexp): Use unsigned char.
Kim F. Storm <storm@cua.dk>
parents:
57921
diff
changeset
|
1092 for (p0 = SDATA (pattern); *p0; p0++) |
17052 | 1093 { |
58025
bcd053632eb2
(fontset_pattern_regexp): Cancel my previous change;
Kenichi Handa <handa@m17n.org>
parents:
57947
diff
changeset
|
1094 if (*p0 == '*') |
17052 | 1095 { |
57685
b935fc1cb542
(fontset_pattern_regexp): Optimize for the case that
Kenichi Handa <handa@m17n.org>
parents:
57573
diff
changeset
|
1096 if (ndashes < 14) |
b935fc1cb542
(fontset_pattern_regexp): Optimize for the case that
Kenichi Handa <handa@m17n.org>
parents:
57573
diff
changeset
|
1097 *p1++ = '.'; |
b935fc1cb542
(fontset_pattern_regexp): Optimize for the case that
Kenichi Handa <handa@m17n.org>
parents:
57573
diff
changeset
|
1098 else |
b935fc1cb542
(fontset_pattern_regexp): Optimize for the case that
Kenichi Handa <handa@m17n.org>
parents:
57573
diff
changeset
|
1099 *p1++ = '[', *p1++ = '^', *p1++ = '-', *p1++ = ']'; |
17730
4bbcc6804b5d
(Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
17331
diff
changeset
|
1100 *p1++ = '*'; |
17052 | 1101 } |
17730
4bbcc6804b5d
(Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
17331
diff
changeset
|
1102 else if (*p0 == '?') |
21127
577865651099
(fontset_pattern_regexp): `==' was used instead of `='.
Richard M. Stallman <rms@gnu.org>
parents:
20346
diff
changeset
|
1103 *p1++ = '.'; |
96020
b52fa52cd0fa
(fontset_pattern_regexp): Escape some regexp characters.
Kenichi Handa <handa@m17n.org>
parents:
95961
diff
changeset
|
1104 else if (*p0 == '[' |
b52fa52cd0fa
(fontset_pattern_regexp): Escape some regexp characters.
Kenichi Handa <handa@m17n.org>
parents:
95961
diff
changeset
|
1105 || *p0 == '.' || *p0 == '\\' |
101943
97c9e9322753
Remove spurious semicolons.
Juanma Barranquero <lekktu@gmail.com>
parents:
101605
diff
changeset
|
1106 || *p0 == '+' || *p0 == '^' |
96020
b52fa52cd0fa
(fontset_pattern_regexp): Escape some regexp characters.
Kenichi Handa <handa@m17n.org>
parents:
95961
diff
changeset
|
1107 || *p0 == '$') |
b52fa52cd0fa
(fontset_pattern_regexp): Escape some regexp characters.
Kenichi Handa <handa@m17n.org>
parents:
95961
diff
changeset
|
1108 *p1++ = '\\', *p1++ = *p0; |
17730
4bbcc6804b5d
(Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
17331
diff
changeset
|
1109 else |
4bbcc6804b5d
(Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
17331
diff
changeset
|
1110 *p1++ = *p0; |
17052 | 1111 } |
1112 *p1++ = '$'; | |
1113 *p1++ = 0; | |
1114 | |
95230
fa14617b247e
Delete unused variables and add casting for char *
Kenichi Handa <handa@m17n.org>
parents:
95212
diff
changeset
|
1115 Vcached_fontset_data = Fcons (build_string ((char *) SDATA (pattern)), |
fa14617b247e
Delete unused variables and add casting for char *
Kenichi Handa <handa@m17n.org>
parents:
95212
diff
changeset
|
1116 build_string ((char *) regex)); |
17052 | 1117 } |
1118 | |
1119 return CACHED_FONTSET_REGEX; | |
1120 } | |
1121 | |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1122 /* 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
|
1123 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
|
1124 0: pattern containing '*' and '?' as wildcards |
bcd053632eb2
(fontset_pattern_regexp): Cancel my previous change;
Kenichi Handa <handa@m17n.org>
parents:
57947
diff
changeset
|
1125 1: regular expression |
bcd053632eb2
(fontset_pattern_regexp): Cancel my previous change;
Kenichi Handa <handa@m17n.org>
parents:
57947
diff
changeset
|
1126 2: literal fontset name |
bcd053632eb2
(fontset_pattern_regexp): Cancel my previous change;
Kenichi Handa <handa@m17n.org>
parents:
57947
diff
changeset
|
1127 */ |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1128 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1129 int |
58025
bcd053632eb2
(fontset_pattern_regexp): Cancel my previous change;
Kenichi Handa <handa@m17n.org>
parents:
57947
diff
changeset
|
1130 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
|
1131 Lisp_Object name; |
58025
bcd053632eb2
(fontset_pattern_regexp): Cancel my previous change;
Kenichi Handa <handa@m17n.org>
parents:
57947
diff
changeset
|
1132 int name_pattern; |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1133 { |
34975
0d69e2d2724e
(fontset_ref): Remove unused variable `i'.
Eli Zaretskii <eliz@gnu.org>
parents:
32978
diff
changeset
|
1134 Lisp_Object tem; |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1135 int i; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1136 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1137 name = Fdowncase (name); |
58025
bcd053632eb2
(fontset_pattern_regexp): Cancel my previous change;
Kenichi Handa <handa@m17n.org>
parents:
57947
diff
changeset
|
1138 if (name_pattern != 1) |
28223
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 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
|
1141 if (NILP (tem)) |
cda6f41a592e
(reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
89687
diff
changeset
|
1142 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
|
1143 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
|
1144 name = XCAR (tem); |
58025
bcd053632eb2
(fontset_pattern_regexp): Cancel my previous change;
Kenichi Handa <handa@m17n.org>
parents:
57947
diff
changeset
|
1145 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
|
1146 { |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1147 tem = fontset_pattern_regexp (name); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1148 if (STRINGP (tem)) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1149 { |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1150 name = tem; |
58025
bcd053632eb2
(fontset_pattern_regexp): Cancel my previous change;
Kenichi Handa <handa@m17n.org>
parents:
57947
diff
changeset
|
1151 name_pattern = 1; |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1152 } |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1153 } |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1154 } |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1155 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1156 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
|
1157 { |
57573
43067aee2f3e
(fs_load_font): Use fast_string_match_ignore_case for
Kenichi Handa <handa@m17n.org>
parents:
56293
diff
changeset
|
1158 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
|
1159 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1160 fontset = FONTSET_FROM_ID (i); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1161 if (NILP (fontset) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1162 || !BASE_FONTSET_P (fontset)) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1163 continue; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1164 |
57573
43067aee2f3e
(fs_load_font): Use fast_string_match_ignore_case for
Kenichi Handa <handa@m17n.org>
parents:
56293
diff
changeset
|
1165 this_name = FONTSET_NAME (fontset); |
58025
bcd053632eb2
(fontset_pattern_regexp): Cancel my previous change;
Kenichi Handa <handa@m17n.org>
parents:
57947
diff
changeset
|
1166 if (name_pattern == 1 |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1167 ? fast_string_match_ignore_case (name, this_name) >= 0 |
95212
a6a4ada91449
* dispextern.h, xfaces.c (xstrcasecmp): Renamed from xstricmp.
Jason Rumney <jasonr@gnu.org>
parents:
95203
diff
changeset
|
1168 : !xstrcasecmp (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
|
1169 return i; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1170 } |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1171 return -1; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1172 } |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1173 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1174 |
21553
2d7afcd11b72
(find_ccl_program_func): New variable.
Kenichi Handa <handa@m17n.org>
parents:
21514
diff
changeset
|
1175 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
|
1176 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
|
1177 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
|
1178 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
|
1179 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
|
1180 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
|
1181 (pattern, regexpp) |
21553
2d7afcd11b72
(find_ccl_program_func): New variable.
Kenichi Handa <handa@m17n.org>
parents:
21514
diff
changeset
|
1182 Lisp_Object pattern, regexpp; |
17052 | 1183 { |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1184 Lisp_Object fontset; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1185 int id; |
17052 | 1186 |
1187 (*check_window_system_func) (); | |
1188 | |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40028
diff
changeset
|
1189 CHECK_STRING (pattern); |
17052 | 1190 |
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
45848
diff
changeset
|
1191 if (SCHARS (pattern) == 0) |
17052 | 1192 return Qnil; |
1193 | |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1194 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
|
1195 if (id < 0) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1196 return Qnil; |
17052 | 1197 |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1198 fontset = FONTSET_FROM_ID (id); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1199 return FONTSET_NAME (fontset); |
17052 | 1200 } |
1201 | |
88405 | 1202 /* Return a list of base fontset names matching PATTERN on frame F. */ |
17052 | 1203 |
1204 Lisp_Object | |
1205 list_fontsets (f, pattern, size) | |
1206 FRAME_PTR f; | |
1207 Lisp_Object pattern; | |
1208 int size; | |
1209 { | |
34975
0d69e2d2724e
(fontset_ref): Remove unused variable `i'.
Eli Zaretskii <eliz@gnu.org>
parents:
32978
diff
changeset
|
1210 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
|
1211 int id; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1212 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1213 XSETFRAME (frame, f); |
17052 | 1214 |
1215 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
|
1216 val = Qnil; |
17052 | 1217 |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1218 for (id = 0; id < ASIZE (Vfontset_table); id++) |
17052 | 1219 { |
57573
43067aee2f3e
(fs_load_font): Use fast_string_match_ignore_case for
Kenichi Handa <handa@m17n.org>
parents:
56293
diff
changeset
|
1220 Lisp_Object fontset, name; |
17052 | 1221 |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1222 fontset = FONTSET_FROM_ID (id); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1223 if (NILP (fontset) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1224 || !BASE_FONTSET_P (fontset) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1225 || !EQ (frame, FONTSET_FRAME (fontset))) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1226 continue; |
57573
43067aee2f3e
(fs_load_font): Use fast_string_match_ignore_case for
Kenichi Handa <handa@m17n.org>
parents:
56293
diff
changeset
|
1227 name = FONTSET_NAME (fontset); |
17052 | 1228 |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1229 if (STRINGP (regexp) |
57573
43067aee2f3e
(fs_load_font): Use fast_string_match_ignore_case for
Kenichi Handa <handa@m17n.org>
parents:
56293
diff
changeset
|
1230 ? (fast_string_match (regexp, name) < 0) |
95230
fa14617b247e
Delete unused variables and add casting for char *
Kenichi Handa <handa@m17n.org>
parents:
95212
diff
changeset
|
1231 : strcmp ((char *) SDATA (pattern), (char *) SDATA (name))) |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1232 continue; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1233 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1234 val = Fcons (Fcopy_sequence (FONTSET_NAME (fontset)), val); |
17052 | 1235 } |
1236 | |
1237 return val; | |
1238 } | |
1239 | |
88405 | 1240 |
89483 | 1241 /* Free all realized fontsets whose base fontset is BASE. */ |
17052 | 1242 |
88405 | 1243 static void |
1244 free_realized_fontsets (base) | |
1245 Lisp_Object base; | |
17052 | 1246 { |
58025
bcd053632eb2
(fontset_pattern_regexp): Cancel my previous change;
Kenichi Handa <handa@m17n.org>
parents:
57947
diff
changeset
|
1247 int id; |
17052 | 1248 |
90806
1ae136ad0ba0
(free_realized_fontsets): Avoid unnecessary call of
Kenichi Handa <handa@m17n.org>
parents:
90802
diff
changeset
|
1249 #if 0 |
88482
effba1417b74
(free_realized_fontsets): Call Fclear_face_cache instead
Kenichi Handa <handa@m17n.org>
parents:
88405
diff
changeset
|
1250 /* 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
|
1251 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
|
1252 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
|
1253 that is not efficient. */ |
88405 | 1254 BLOCK_INPUT; |
1255 for (id = 0; id < ASIZE (Vfontset_table); id++) | |
58025
bcd053632eb2
(fontset_pattern_regexp): Cancel my previous change;
Kenichi Handa <handa@m17n.org>
parents:
57947
diff
changeset
|
1256 { |
88405 | 1257 Lisp_Object this = AREF (Vfontset_table, id); |
17052 | 1258 |
88405 | 1259 if (EQ (FONTSET_BASE (this), base)) |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1260 { |
88405 | 1261 Lisp_Object tail; |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1262 |
88405 | 1263 for (tail = FONTSET_FACE_ALIST (this); CONSP (tail); |
1264 tail = XCDR (tail)) | |
1265 { | |
1266 FRAME_PTR f = XFRAME (FONTSET_FRAME (this)); | |
1267 int face_id = XINT (XCDR (XCAR (tail))); | |
1268 struct face *face = FACE_FROM_ID (f, face_id); | |
89483 | 1269 |
88405 | 1270 /* Face THIS itself is also freed by the following call. */ |
1271 free_realized_face (f, face); | |
1272 } | |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1273 } |
17052 | 1274 } |
88405 | 1275 UNBLOCK_INPUT; |
88482
effba1417b74
(free_realized_fontsets): Call Fclear_face_cache instead
Kenichi Handa <handa@m17n.org>
parents:
88405
diff
changeset
|
1276 #else /* not 0 */ |
90806
1ae136ad0ba0
(free_realized_fontsets): Avoid unnecessary call of
Kenichi Handa <handa@m17n.org>
parents:
90802
diff
changeset
|
1277 /* 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
|
1278 been realized from BASE. */ |
1ae136ad0ba0
(free_realized_fontsets): Avoid unnecessary call of
Kenichi Handa <handa@m17n.org>
parents:
90802
diff
changeset
|
1279 for (id = 0; id < ASIZE (Vfontset_table); id++) |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1280 { |
90806
1ae136ad0ba0
(free_realized_fontsets): Avoid unnecessary call of
Kenichi Handa <handa@m17n.org>
parents:
90802
diff
changeset
|
1281 Lisp_Object this = AREF (Vfontset_table, id); |
17052 | 1282 |
91046 | 1283 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
|
1284 { |
1ae136ad0ba0
(free_realized_fontsets): Avoid unnecessary call of
Kenichi Handa <handa@m17n.org>
parents:
90802
diff
changeset
|
1285 Fclear_face_cache (Qt); |
1ae136ad0ba0
(free_realized_fontsets): Avoid unnecessary call of
Kenichi Handa <handa@m17n.org>
parents:
90802
diff
changeset
|
1286 break; |
1ae136ad0ba0
(free_realized_fontsets): Avoid unnecessary call of
Kenichi Handa <handa@m17n.org>
parents:
90802
diff
changeset
|
1287 } |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1288 } |
88482
effba1417b74
(free_realized_fontsets): Call Fclear_face_cache instead
Kenichi Handa <handa@m17n.org>
parents:
88405
diff
changeset
|
1289 #endif /* not 0 */ |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1290 } |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1291 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1292 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1293 /* 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
|
1294 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
|
1295 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
|
1296 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1297 static Lisp_Object |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1298 check_fontset_name (name) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1299 Lisp_Object name; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1300 { |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1301 int id; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1302 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1303 if (EQ (name, Qt)) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1304 return Vdefault_fontset; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1305 |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40028
diff
changeset
|
1306 CHECK_STRING (name); |
58025
bcd053632eb2
(fontset_pattern_regexp): Cancel my previous change;
Kenichi Handa <handa@m17n.org>
parents:
57947
diff
changeset
|
1307 /* First try NAME as literal. */ |
bcd053632eb2
(fontset_pattern_regexp): Cancel my previous change;
Kenichi Handa <handa@m17n.org>
parents:
57947
diff
changeset
|
1308 id = fs_query_fontset (name, 2); |
bcd053632eb2
(fontset_pattern_regexp): Cancel my previous change;
Kenichi Handa <handa@m17n.org>
parents:
57947
diff
changeset
|
1309 if (id < 0) |
bcd053632eb2
(fontset_pattern_regexp): Cancel my previous change;
Kenichi Handa <handa@m17n.org>
parents:
57947
diff
changeset
|
1310 /* 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
|
1311 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
|
1312 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
|
1313 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
|
1314 return FONTSET_FROM_ID (id); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1315 } |
17052 | 1316 |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1317 static void |
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1318 accumulate_script_ranges (arg, range, val) |
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1319 Lisp_Object arg, range, val; |
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1320 { |
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1321 if (EQ (XCAR (arg), val)) |
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1322 { |
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1323 if (CONSP (range)) |
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1324 XSETCDR (arg, Fcons (Fcons (XCAR (range), XCDR (range)), XCDR (arg))); |
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1325 else |
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1326 XSETCDR (arg, Fcons (Fcons (range, range), XCDR (arg))); |
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1327 } |
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1328 } |
53353
b085f18ebcf0
(Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
53072
diff
changeset
|
1329 |
b085f18ebcf0
(Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
53072
diff
changeset
|
1330 |
89349
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1331 /* 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
|
1332 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
|
1333 |
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1334 static INLINE Lisp_Object |
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1335 generate_ascii_font_name (name, ascii_spec) |
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1336 Lisp_Object name, ascii_spec; |
53353
b085f18ebcf0
(Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
53072
diff
changeset
|
1337 { |
91169
8eb408860621
Include "font.h" unconditionally.
Kenichi Handa <handa@m17n.org>
parents:
91136
diff
changeset
|
1338 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
|
1339 int i; |
91169
8eb408860621
Include "font.h" unconditionally.
Kenichi Handa <handa@m17n.org>
parents:
91136
diff
changeset
|
1340 char xlfd[256]; |
89349
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1341 |
95230
fa14617b247e
Delete unused variables and add casting for char *
Kenichi Handa <handa@m17n.org>
parents:
95212
diff
changeset
|
1342 if (font_parse_xlfd ((char *) SDATA (name), font_spec) < 0) |
91169
8eb408860621
Include "font.h" unconditionally.
Kenichi Handa <handa@m17n.org>
parents:
91136
diff
changeset
|
1343 error ("Not an XLFD font name: %s", SDATA (name)); |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1344 for (i = FONT_FOUNDRY_INDEX; i < FONT_EXTRA_INDEX; i++) |
89349
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1345 if (! NILP (AREF (ascii_spec, i))) |
91169
8eb408860621
Include "font.h" unconditionally.
Kenichi Handa <handa@m17n.org>
parents:
91136
diff
changeset
|
1346 ASET (font_spec, i, AREF (ascii_spec, i)); |
8eb408860621
Include "font.h" unconditionally.
Kenichi Handa <handa@m17n.org>
parents:
91136
diff
changeset
|
1347 i = font_unparse_xlfd (font_spec, 0, xlfd, 256); |
8eb408860621
Include "font.h" unconditionally.
Kenichi Handa <handa@m17n.org>
parents:
91136
diff
changeset
|
1348 if (i < 0) |
8eb408860621
Include "font.h" unconditionally.
Kenichi Handa <handa@m17n.org>
parents:
91136
diff
changeset
|
1349 error ("Not an XLFD font name: %s", SDATA (name)); |
8eb408860621
Include "font.h" unconditionally.
Kenichi Handa <handa@m17n.org>
parents:
91136
diff
changeset
|
1350 return make_unibyte_string (xlfd, i); |
53353
b085f18ebcf0
(Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
53072
diff
changeset
|
1351 } |
b085f18ebcf0
(Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
53072
diff
changeset
|
1352 |
89901
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1353 /* 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
|
1354 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
|
1355 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
|
1356 static int from_arg, to_arg; |
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1357 |
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1358 /* 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
|
1359 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
|
1360 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
|
1361 to_arg. */ |
41001
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
1362 |
89614
355fc0282e50
(set_fontset_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
89610
diff
changeset
|
1363 static void |
89901
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1364 set_fontset_font (fontset, range) |
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1365 Lisp_Object fontset, range; |
89614
355fc0282e50
(set_fontset_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
89610
diff
changeset
|
1366 { |
89901
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1367 if (from_arg < to_arg) |
53353
b085f18ebcf0
(Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
53072
diff
changeset
|
1368 { |
89901
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1369 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
|
1370 |
89901
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1371 if (from < from_arg) |
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1372 { |
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1373 if (to > to_arg) |
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1374 { |
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1375 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
|
1376 |
89901
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1377 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
|
1378 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
|
1379 to = to_arg; |
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1380 } |
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1381 if (to > from_arg) |
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1382 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
|
1383 } |
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1384 else if (to <= to_arg) |
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1385 return; |
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1386 else |
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1387 { |
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1388 if (from < to_arg) |
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1389 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
|
1390 } |
53353
b085f18ebcf0
(Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
53072
diff
changeset
|
1391 } |
89901
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1392 FONTSET_ADD (fontset, range, font_def_arg, add_arg); |
53353
b085f18ebcf0
(Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
53072
diff
changeset
|
1393 } |
b085f18ebcf0
(Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
53072
diff
changeset
|
1394 |
91136
d54684fee154
(fontset_find_font) [USE_FONT_BACKEND]: Try multiple
Kenichi Handa <handa@m17n.org>
parents:
91053
diff
changeset
|
1395 extern Lisp_Object QCfamily, QCregistry; |
89349
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1396 |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1397 DEFUN ("set-fontset-font", Fset_fontset_font, Sset_fontset_font, 3, 5, 0, |
89483 | 1398 doc: /* |
89805
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
1399 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
|
1400 |
89805
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
1401 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
|
1402 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
|
1403 TO (inclusive). |
88405 | 1404 |
89805
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
1405 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
|
1406 all characters that belong to the script. |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1407 |
89805
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
1408 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
|
1409 characters in the charset. |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1410 |
89805
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
1411 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
|
1412 that no FONT-SPEC is specified. |
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
1413 |
89940
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
1414 FONT-SPEC may one of these: |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1415 * A font-spec object made by the function `font-spec' (which see). |
89337
6026c8e5664f
(Fset_fontset_font): Fix indentation of docstring.
Kenichi Handa <handa@m17n.org>
parents:
89069
diff
changeset
|
1416 * A cons (FAMILY . REGISTRY), where FAMILY is a font family name and |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1417 REGISTRY is a font registry name. FAMILY may contain foundry |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1418 name, and REGISTRY may contain encoding name. |
88931
74d18470865c
(fontset_add): Declare args. Call make_number
Dave Love <fx@gnu.org>
parents:
88903
diff
changeset
|
1419 * A font name string. |
91364
1e43b74bf9e5
(reorder_font_vector): Exclude nil elements from the
Kenichi Handa <handa@m17n.org>
parents:
91352
diff
changeset
|
1420 * nil, which explicitly specifies that there's no font for TARGET. |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1421 |
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1422 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
|
1423 kept for backward compatibility and has no meaning. |
88405 | 1424 |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1425 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
|
1426 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
|
1427 `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
|
1428 appended. By default, FONT-SPEC overrides the previous settings. */) |
89805
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
1429 (name, target, font_spec, frame, add) |
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
1430 Lisp_Object name, target, font_spec, frame, add; |
17052 | 1431 { |
88405 | 1432 Lisp_Object fontset; |
90056
b0c203a8776d
(Fset_fontset_font): Call find_font_encoding with
Kenichi Handa <handa@m17n.org>
parents:
90044
diff
changeset
|
1433 Lisp_Object font_def, registry, family; |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1434 Lisp_Object range_list; |
89901
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1435 struct charset *charset = NULL; |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1436 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1437 fontset = check_fontset_name (name); |
17052 | 1438 |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1439 /* 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
|
1440 the validity. */ |
17052 | 1441 if (!NILP (frame)) |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40028
diff
changeset
|
1442 CHECK_LIVE_FRAME (frame); |
17052 | 1443 |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1444 if (CONSP (font_spec)) |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1445 { |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1446 Lisp_Object spec = Ffont_spec (0, NULL); |
91169
8eb408860621
Include "font.h" unconditionally.
Kenichi Handa <handa@m17n.org>
parents:
91136
diff
changeset
|
1447 |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1448 font_parse_family_registry (XCAR (font_spec), XCDR (font_spec), spec); |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1449 font_spec = spec; |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1450 } |
91352
b6befec471b8
(reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents:
91336
diff
changeset
|
1451 else if (STRINGP (font_spec)) |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1452 { |
91231
29d8135e8f58
(fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents:
91224
diff
changeset
|
1453 Lisp_Object args[2]; |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1454 extern Lisp_Object QCname; |
91231
29d8135e8f58
(fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents:
91224
diff
changeset
|
1455 |
29d8135e8f58
(fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents:
91224
diff
changeset
|
1456 args[0] = QCname; |
29d8135e8f58
(fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents:
91224
diff
changeset
|
1457 args[1] = font_spec; |
29d8135e8f58
(fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents:
91224
diff
changeset
|
1458 font_spec = Ffont_spec (2, args); |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1459 } |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1460 else if (! NILP (font_spec) && ! FONT_SPEC_P (font_spec)) |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1461 Fsignal (Qfont, list2 (build_string ("Invalid font-spec"), font_spec)); |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1462 |
91352
b6befec471b8
(reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents:
91336
diff
changeset
|
1463 if (! NILP (font_spec)) |
b6befec471b8
(reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents:
91336
diff
changeset
|
1464 { |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1465 Lisp_Object encoding, repertory; |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1466 |
91352
b6befec471b8
(reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents:
91336
diff
changeset
|
1467 family = AREF (font_spec, FONT_FAMILY_INDEX); |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1468 if (! NILP (family) ) |
91352
b6befec471b8
(reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents:
91336
diff
changeset
|
1469 family = SYMBOL_NAME (family); |
b6befec471b8
(reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents:
91336
diff
changeset
|
1470 registry = AREF (font_spec, FONT_REGISTRY_INDEX); |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1471 if (! NILP (registry)) |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1472 registry = Fdowncase (SYMBOL_NAME (registry)); |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1473 encoding = find_font_encoding (concat3 (family, build_string ("-"), |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1474 registry)); |
91352
b6befec471b8
(reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents:
91336
diff
changeset
|
1475 if (NILP (encoding)) |
b6befec471b8
(reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents:
91336
diff
changeset
|
1476 encoding = Qascii; |
91231
29d8135e8f58
(fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents:
91224
diff
changeset
|
1477 |
91352
b6befec471b8
(reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents:
91336
diff
changeset
|
1478 if (SYMBOLP (encoding)) |
b6befec471b8
(reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents:
91336
diff
changeset
|
1479 { |
b6befec471b8
(reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents:
91336
diff
changeset
|
1480 CHECK_CHARSET (encoding); |
b6befec471b8
(reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents:
91336
diff
changeset
|
1481 encoding = repertory = CHARSET_SYMBOL_ID (encoding); |
b6befec471b8
(reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents:
91336
diff
changeset
|
1482 } |
b6befec471b8
(reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents:
91336
diff
changeset
|
1483 else |
b6befec471b8
(reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents:
91336
diff
changeset
|
1484 { |
b6befec471b8
(reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents:
91336
diff
changeset
|
1485 repertory = XCDR (encoding); |
b6befec471b8
(reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents:
91336
diff
changeset
|
1486 encoding = XCAR (encoding); |
b6befec471b8
(reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents:
91336
diff
changeset
|
1487 CHECK_CHARSET (encoding); |
b6befec471b8
(reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents:
91336
diff
changeset
|
1488 encoding = CHARSET_SYMBOL_ID (encoding); |
b6befec471b8
(reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents:
91336
diff
changeset
|
1489 if (! NILP (repertory) && SYMBOLP (repertory)) |
b6befec471b8
(reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents:
91336
diff
changeset
|
1490 { |
b6befec471b8
(reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents:
91336
diff
changeset
|
1491 CHECK_CHARSET (repertory); |
b6befec471b8
(reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents:
91336
diff
changeset
|
1492 repertory = CHARSET_SYMBOL_ID (repertory); |
b6befec471b8
(reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents:
91336
diff
changeset
|
1493 } |
b6befec471b8
(reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents:
91336
diff
changeset
|
1494 } |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1495 FONT_DEF_NEW (font_def, font_spec, encoding, repertory); |
89826
b17725d55ba2
(Fset_fontset_font): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
89811
diff
changeset
|
1496 } |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1497 else |
91352
b6befec471b8
(reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents:
91336
diff
changeset
|
1498 font_def = Qnil; |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1499 |
89805
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
1500 if (CHARACTERP (target)) |
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
1501 range_list = Fcons (Fcons (target, target), Qnil); |
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
1502 else if (CONSP (target)) |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1503 { |
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1504 Lisp_Object from, to; |
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1505 |
89805
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
1506 from = Fcar (target); |
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
1507 to = Fcdr (target); |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1508 CHECK_CHARACTER (from); |
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1509 CHECK_CHARACTER (to); |
89805
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
1510 range_list = Fcons (target, Qnil); |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1511 } |
89805
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
1512 else if (SYMBOLP (target) && !NILP (target)) |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1513 { |
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1514 Lisp_Object script_list; |
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1515 Lisp_Object val; |
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1516 |
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1517 range_list = Qnil; |
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1518 script_list = XCHAR_TABLE (Vchar_script_table)->extras[0]; |
89805
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
1519 if (! NILP (Fmemq (target, script_list))) |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1520 { |
89805
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
1521 val = Fcons (target, Qnil); |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1522 map_char_table (accumulate_script_ranges, Qnil, Vchar_script_table, |
89483 | 1523 val); |
1524 range_list = XCDR (val); | |
91336
04716f23ac87
(FONTSET_REF_AND_RANGE): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
91327
diff
changeset
|
1525 if (EQ (target, Qlatin) && NILP (FONTSET_ASCII (fontset))) |
90642 | 1526 { |
1527 if (VECTORP (font_spec)) | |
1528 val = generate_ascii_font_name (FONTSET_NAME (fontset), | |
1529 font_spec); | |
1530 else | |
1531 val = font_spec; | |
1532 FONTSET_ASCII (fontset) = val; | |
1533 } | |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1534 } |
89901
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1535 if (CHARSETP (target)) |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1536 { |
91336
04716f23ac87
(FONTSET_REF_AND_RANGE): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
91327
diff
changeset
|
1537 if (EQ (target, Qascii) && NILP (FONTSET_ASCII (fontset))) |
89006
faa38aebf129
(Fset_fontset_font): Treate `ascii' as charset, not script.
Kenichi Handa <handa@m17n.org>
parents:
88982
diff
changeset
|
1538 { |
89349
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1539 if (VECTORP (font_spec)) |
89006
faa38aebf129
(Fset_fontset_font): Treate `ascii' as charset, not script.
Kenichi Handa <handa@m17n.org>
parents:
88982
diff
changeset
|
1540 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
|
1541 font_spec); |
faa38aebf129
(Fset_fontset_font): Treate `ascii' as charset, not script.
Kenichi Handa <handa@m17n.org>
parents:
88982
diff
changeset
|
1542 FONTSET_ASCII (fontset) = font_spec; |
89614
355fc0282e50
(set_fontset_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
89610
diff
changeset
|
1543 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
|
1544 Qnil); |
355fc0282e50
(set_fontset_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
89610
diff
changeset
|
1545 } |
355fc0282e50
(set_fontset_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
89610
diff
changeset
|
1546 else |
355fc0282e50
(set_fontset_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
89610
diff
changeset
|
1547 { |
89901
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1548 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
|
1549 } |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1550 } |
89901
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1551 else if (NILP (range_list)) |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1552 error ("Invalid script or charset name: %s", |
89805
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
1553 SDATA (SYMBOL_NAME (target))); |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1554 } |
89805
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
1555 else if (NILP (target)) |
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
1556 range_list = Fcons (Qnil, Qnil); |
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
1557 else |
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
1558 error ("Invalid target for setting a font"); |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1559 |
89901
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1560 |
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1561 if (charset) |
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 font_def_arg = font_def; |
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1564 add_arg = add; |
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1565 if (NILP (range_list)) |
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1566 from_arg = to_arg = 0; |
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1567 else |
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1568 from_arg = XINT (XCAR (XCAR (range_list))), |
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1569 to_arg = XINT (XCDR (XCAR (range_list))); |
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 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
|
1572 CHARSET_MIN_CODE (charset), |
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1573 CHARSET_MAX_CODE (charset)); |
d1a1970e3dd1
(find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents:
89898
diff
changeset
|
1574 } |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1575 for (; CONSP (range_list); range_list = XCDR (range_list)) |
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1576 FONTSET_ADD (fontset, XCAR (range_list), font_def, add); |
17052 | 1577 |
88405 | 1578 /* Free all realized fontsets whose base is FONTSET. This way, the |
1579 specified character(s) are surely redisplayed by a correct | |
1580 font. */ | |
1581 free_realized_fontsets (fontset); | |
17052 | 1582 |
1583 return Qnil; | |
1584 } | |
1585 | |
88405 | 1586 |
1587 DEFUN ("new-fontset", Fnew_fontset, Snew_fontset, 2, 2, 0, | |
1588 doc: /* Create a new fontset NAME from font information in FONTLIST. | |
1589 | |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1590 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
|
1591 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
|
1592 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
|
1593 FONT-SPEC. |
88405 | 1594 |
89349
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1595 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
|
1596 char-table `char-script-table'. |
88405 | 1597 |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1598 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
|
1599 `set-fontset-font' for the meaning. */) |
88405 | 1600 (name, fontlist) |
1601 Lisp_Object name, fontlist; | |
1602 { | |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1603 Lisp_Object fontset; |
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1604 int id; |
88405 | 1605 |
1606 CHECK_STRING (name); | |
1607 CHECK_LIST (fontlist); | |
1608 | |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1609 name = Fdowncase (name); |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1610 id = fs_query_fontset (name, 0); |
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1611 if (id < 0) |
89349
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1612 { |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1613 Lisp_Object font_spec = Ffont_spec (0, NULL); |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1614 Lisp_Object short_name; |
94981
e01e37b8203e
(Fnew_fontset): Call font_unparse_xlfd with 256-byte
Kenichi Handa <handa@m17n.org>
parents:
94963
diff
changeset
|
1615 char xlfd[256]; |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1616 int len; |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1617 |
95230
fa14617b247e
Delete unused variables and add casting for char *
Kenichi Handa <handa@m17n.org>
parents:
95212
diff
changeset
|
1618 if (font_parse_xlfd ((char *) SDATA (name), font_spec) < 0) |
89349
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1619 error ("Fontset name must be in XLFD format"); |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1620 short_name = AREF (font_spec, FONT_REGISTRY_INDEX); |
95230
fa14617b247e
Delete unused variables and add casting for char *
Kenichi Handa <handa@m17n.org>
parents:
95212
diff
changeset
|
1621 if (strncmp ((char *) SDATA (SYMBOL_NAME (short_name)), "fontset-", 8) |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1622 || SBYTES (SYMBOL_NAME (short_name)) < 9) |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1623 error ("Registry field of fontset name must be \"fontset-*\""); |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1624 Vfontset_alias_alist = Fcons (Fcons (name, SYMBOL_NAME (short_name)), |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1625 Vfontset_alias_alist); |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1626 ASET (font_spec, FONT_REGISTRY_INDEX, Qiso8859_1); |
89349
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1627 fontset = make_fontset (Qnil, name, Qnil); |
94981
e01e37b8203e
(Fnew_fontset): Call font_unparse_xlfd with 256-byte
Kenichi Handa <handa@m17n.org>
parents:
94963
diff
changeset
|
1628 len = font_unparse_xlfd (font_spec, 0, xlfd, 256); |
e01e37b8203e
(Fnew_fontset): Call font_unparse_xlfd with 256-byte
Kenichi Handa <handa@m17n.org>
parents:
94963
diff
changeset
|
1629 if (len < 0) |
e01e37b8203e
(Fnew_fontset): Call font_unparse_xlfd with 256-byte
Kenichi Handa <handa@m17n.org>
parents:
94963
diff
changeset
|
1630 error ("Invalid fontset name (perhaps too long): %s", SDATA (name)); |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1631 FONTSET_ASCII (fontset) = make_unibyte_string (xlfd, len); |
89349
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1632 } |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1633 else |
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1634 { |
101943
97c9e9322753
Remove spurious semicolons.
Juanma Barranquero <lekktu@gmail.com>
parents:
101605
diff
changeset
|
1635 fontset = FONTSET_FROM_ID (id); |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1636 free_realized_fontsets (fontset); |
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1637 Fset_char_table_range (fontset, Qt, Qnil); |
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1638 } |
88405 | 1639 |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1640 for (; ! NILP (fontlist); fontlist = Fcdr (fontlist)) |
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1641 { |
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1642 Lisp_Object elt, script; |
88405 | 1643 |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1644 elt = Fcar (fontlist); |
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1645 script = Fcar (elt); |
89607
9090f7eba02c
(Fnew_fontset): Check NAME more rigidly.
Kenichi Handa <handa@m17n.org>
parents:
89603
diff
changeset
|
1646 elt = Fcdr (elt); |
9090f7eba02c
(Fnew_fontset): Check NAME more rigidly.
Kenichi Handa <handa@m17n.org>
parents:
89603
diff
changeset
|
1647 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
|
1648 for (; CONSP (elt); elt = XCDR (elt)) |
9090f7eba02c
(Fnew_fontset): Check NAME more rigidly.
Kenichi Handa <handa@m17n.org>
parents:
89603
diff
changeset
|
1649 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
|
1650 else |
9090f7eba02c
(Fnew_fontset): Check NAME more rigidly.
Kenichi Handa <handa@m17n.org>
parents:
89603
diff
changeset
|
1651 Fset_fontset_font (name, script, elt, Qnil, Qappend); |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1652 } |
88405 | 1653 return name; |
1654 } | |
1655 | |
1656 | |
89610
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
1657 /* Alist of automatically created fontsets. Each element is a cons |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1658 (FONT-SPEC . FONTSET-ID). */ |
89610
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
1659 static Lisp_Object auto_fontset_alist; |
89349
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1660 |
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1661 int |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1662 fontset_from_font (font_object) |
90410 | 1663 Lisp_Object font_object; |
1664 { | |
90466
4c9461c6aef4
(new_fontset_from_font) [USE_FONT_BACKEND]: Argument F
Kenichi Handa <handa@m17n.org>
parents:
90449
diff
changeset
|
1665 Lisp_Object font_name = font_get_name (font_object); |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1666 Lisp_Object font_spec = Fcopy_font_spec (font_object); |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1667 Lisp_Object fontset_spec, alias, name, fontset; |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1668 Lisp_Object val; |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1669 int i; |
90466
4c9461c6aef4
(new_fontset_from_font) [USE_FONT_BACKEND]: Argument F
Kenichi Handa <handa@m17n.org>
parents:
90449
diff
changeset
|
1670 |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1671 val = assoc_no_quit (font_spec, auto_fontset_alist); |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1672 if (CONSP (val)) |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1673 return XINT (FONTSET_ID (XCDR (val))); |
90466
4c9461c6aef4
(new_fontset_from_font) [USE_FONT_BACKEND]: Argument F
Kenichi Handa <handa@m17n.org>
parents:
90449
diff
changeset
|
1674 if (NILP (auto_fontset_alist)) |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1675 alias = intern ("fontset-startup"); |
90466
4c9461c6aef4
(new_fontset_from_font) [USE_FONT_BACKEND]: Argument F
Kenichi Handa <handa@m17n.org>
parents:
90449
diff
changeset
|
1676 else |
4c9461c6aef4
(new_fontset_from_font) [USE_FONT_BACKEND]: Argument F
Kenichi Handa <handa@m17n.org>
parents:
90449
diff
changeset
|
1677 { |
4c9461c6aef4
(new_fontset_from_font) [USE_FONT_BACKEND]: Argument F
Kenichi Handa <handa@m17n.org>
parents:
90449
diff
changeset
|
1678 char temp[32]; |
4c9461c6aef4
(new_fontset_from_font) [USE_FONT_BACKEND]: Argument F
Kenichi Handa <handa@m17n.org>
parents:
90449
diff
changeset
|
1679 int len = XINT (Flength (auto_fontset_alist)); |
90410 | 1680 |
90466
4c9461c6aef4
(new_fontset_from_font) [USE_FONT_BACKEND]: Argument F
Kenichi Handa <handa@m17n.org>
parents:
90449
diff
changeset
|
1681 sprintf (temp, "fontset-auto%d", len); |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1682 alias = intern (temp); |
90466
4c9461c6aef4
(new_fontset_from_font) [USE_FONT_BACKEND]: Argument F
Kenichi Handa <handa@m17n.org>
parents:
90449
diff
changeset
|
1683 } |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1684 fontset_spec = Fcopy_font_spec (font_spec); |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1685 ASET (fontset_spec, FONT_REGISTRY_INDEX, alias); |
95179
5c007b5b6cd8
(fontset_from_font, Ffontset_info): Add the 2nd arg in
Kenichi Handa <handa@m17n.org>
parents:
95143
diff
changeset
|
1686 name = Ffont_xlfd_name (fontset_spec, Qnil); |
90466
4c9461c6aef4
(new_fontset_from_font) [USE_FONT_BACKEND]: Argument F
Kenichi Handa <handa@m17n.org>
parents:
90449
diff
changeset
|
1687 if (NILP (name)) |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1688 abort (); |
90466
4c9461c6aef4
(new_fontset_from_font) [USE_FONT_BACKEND]: Argument F
Kenichi Handa <handa@m17n.org>
parents:
90449
diff
changeset
|
1689 fontset = make_fontset (Qnil, name, Qnil); |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1690 Vfontset_alias_alist = Fcons (Fcons (name, SYMBOL_NAME (alias)), |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1691 Vfontset_alias_alist); |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1692 alias = Fdowncase (AREF (font_object, FONT_NAME_INDEX)); |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1693 Vfontset_alias_alist = Fcons (Fcons (name, alias), Vfontset_alias_alist); |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1694 auto_fontset_alist = Fcons (Fcons (font_spec, fontset), auto_fontset_alist); |
90466
4c9461c6aef4
(new_fontset_from_font) [USE_FONT_BACKEND]: Argument F
Kenichi Handa <handa@m17n.org>
parents:
90449
diff
changeset
|
1695 FONTSET_ASCII (fontset) = font_name; |
96087
b6d5b82f877f
(fontset_from_font): Copy font_spec before changing
Kenichi Handa <handa@m17n.org>
parents:
96020
diff
changeset
|
1696 font_spec = Fcopy_font_spec (font_spec); |
96556
0af6d3c9fb7c
(fontset_compare_rfontdef): Fix plus/minus.
Kenichi Handa <handa@m17n.org>
parents:
96414
diff
changeset
|
1697 ASET (font_spec, FONT_REGISTRY_INDEX, Qiso10646_1); |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1698 for (i = FONT_WEIGHT_INDEX; i < FONT_EXTRA_INDEX; i++) |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1699 ASET (font_spec, i, Qnil); |
96606
c80528d6e629
(fontset_from_font): Cancel the previous change.
Kenichi Handa <handa@m17n.org>
parents:
96573
diff
changeset
|
1700 Fset_fontset_font (name, Qlatin, font_spec, Qnil, Qnil); |
90802
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
1701 Fset_fontset_font (name, Qnil, font_spec, Qnil, Qnil); |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96655
diff
changeset
|
1702 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96655
diff
changeset
|
1703 #ifdef HAVE_NS |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96655
diff
changeset
|
1704 nsfont_make_fontset_for_font(name, font_object); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96655
diff
changeset
|
1705 #endif |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96655
diff
changeset
|
1706 |
90466
4c9461c6aef4
(new_fontset_from_font) [USE_FONT_BACKEND]: Argument F
Kenichi Handa <handa@m17n.org>
parents:
90449
diff
changeset
|
1707 return XINT (FONTSET_ID (fontset)); |
90410 | 1708 } |
1709 | |
96414
37737408d4f2
(Finternal_char_font): Return font-object instead of font-name.
Kenichi Handa <handa@m17n.org>
parents:
96087
diff
changeset
|
1710 /* Return a cons (FONT-OBJECT . GLYPH-CODE). |
37737408d4f2
(Finternal_char_font): Return font-object instead of font-name.
Kenichi Handa <handa@m17n.org>
parents:
96087
diff
changeset
|
1711 FONT-OBJECT is the font for the character at POSITION in the current |
28963 | 1712 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
|
1713 that apply to POSITION. POSTION may be nil, in which case, |
96414
37737408d4f2
(Finternal_char_font): Return font-object instead of font-name.
Kenichi Handa <handa@m17n.org>
parents:
96087
diff
changeset
|
1714 FONT-SPEC is the font for displaying the character CH with the |
55094
450b41d3c078
(Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents:
54995
diff
changeset
|
1715 default face. |
450b41d3c078
(Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents:
54995
diff
changeset
|
1716 |
52654
2e5944e29aa0
(Finternal_char_font): Change return value to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
1717 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
|
1718 |
2e5944e29aa0
(Finternal_char_font): Change return value to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
1719 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
|
1720 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
|
1721 |
2e5944e29aa0
(Finternal_char_font): Change return value to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
1722 It returns nil in the following cases: |
28963 | 1723 |
1724 (1) The window system doesn't have a font for the character (thus | |
1725 it is displayed by an empty box). | |
1726 | |
1727 (2) The character code is invalid. | |
1728 | |
55094
450b41d3c078
(Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents:
54995
diff
changeset
|
1729 (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
|
1730 in any window. |
28963 | 1731 |
1732 In addition, the returned font name may not take into account of | |
1733 such redisplay engine hooks as what used in jit-lock-mode if | |
1734 POSITION is currently not visible. */ | |
1735 | |
1736 | |
52654
2e5944e29aa0
(Finternal_char_font): Change return value to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
1737 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
|
1738 doc: /* For internal use only. */) |
52654
2e5944e29aa0
(Finternal_char_font): Change return value to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
1739 (position, ch) |
2e5944e29aa0
(Finternal_char_font): Change return value to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
1740 Lisp_Object position, ch; |
28963 | 1741 { |
92237
ce06567a933d
* dispextern.h (face_at_buffer_position, face_for_overlay_string)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91908
diff
changeset
|
1742 EMACS_INT pos, pos_byte, dummy; |
28963 | 1743 int face_id; |
1744 int c; | |
1745 struct frame *f; | |
1746 struct face *face; | |
90725
6d8c81691fc8
(Finternal_char_font): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
90716
diff
changeset
|
1747 int cs_id; |
28963 | 1748 |
55094
450b41d3c078
(Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents:
54995
diff
changeset
|
1749 if (NILP (position)) |
52654
2e5944e29aa0
(Finternal_char_font): Change return value to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
1750 { |
89904 | 1751 CHECK_CHARACTER (ch); |
52654
2e5944e29aa0
(Finternal_char_font): Change return value to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
1752 c = XINT (ch); |
55094
450b41d3c078
(Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents:
54995
diff
changeset
|
1753 f = XFRAME (selected_frame); |
95457
415f68458e61
Implement face-remapping-alist feature
Miles Bader <miles@gnu.org>
parents:
95404
diff
changeset
|
1754 face_id = lookup_basic_face (f, DEFAULT_FACE_ID); |
89943
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1755 pos = -1; |
90725
6d8c81691fc8
(Finternal_char_font): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
90716
diff
changeset
|
1756 cs_id = -1; |
55094
450b41d3c078
(Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents:
54995
diff
changeset
|
1757 } |
450b41d3c078
(Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents:
54995
diff
changeset
|
1758 else |
450b41d3c078
(Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents:
54995
diff
changeset
|
1759 { |
90716
f5dc0b9a442c
(Finternal_char_font): Fix for the case of POSITION
Kenichi Handa <handa@m17n.org>
parents:
90642
diff
changeset
|
1760 Lisp_Object window, charset; |
55094
450b41d3c078
(Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents:
54995
diff
changeset
|
1761 struct window *w; |
450b41d3c078
(Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents:
54995
diff
changeset
|
1762 |
450b41d3c078
(Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents:
54995
diff
changeset
|
1763 CHECK_NUMBER_COERCE_MARKER (position); |
450b41d3c078
(Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents:
54995
diff
changeset
|
1764 pos = XINT (position); |
450b41d3c078
(Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents:
54995
diff
changeset
|
1765 if (pos < BEGV || pos >= ZV) |
450b41d3c078
(Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents:
54995
diff
changeset
|
1766 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
|
1767 pos_byte = CHAR_TO_BYTE (pos); |
450b41d3c078
(Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents:
54995
diff
changeset
|
1768 if (NILP (ch)) |
450b41d3c078
(Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents:
54995
diff
changeset
|
1769 c = FETCH_CHAR (pos_byte); |
450b41d3c078
(Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents:
54995
diff
changeset
|
1770 else |
450b41d3c078
(Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents:
54995
diff
changeset
|
1771 { |
450b41d3c078
(Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents:
54995
diff
changeset
|
1772 CHECK_NATNUM (ch); |
450b41d3c078
(Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents:
54995
diff
changeset
|
1773 c = XINT (ch); |
450b41d3c078
(Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents:
54995
diff
changeset
|
1774 } |
450b41d3c078
(Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents:
54995
diff
changeset
|
1775 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
|
1776 if (NILP (window)) |
450b41d3c078
(Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents:
54995
diff
changeset
|
1777 return Qnil; |
450b41d3c078
(Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents:
54995
diff
changeset
|
1778 w = XWINDOW (window); |
450b41d3c078
(Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents:
54995
diff
changeset
|
1779 f = XFRAME (w->frame); |
450b41d3c078
(Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents:
54995
diff
changeset
|
1780 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
|
1781 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
|
1782 if (CHARSETP (charset)) |
90725
6d8c81691fc8
(Finternal_char_font): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
90716
diff
changeset
|
1783 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
|
1784 else |
90725
6d8c81691fc8
(Finternal_char_font): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
90716
diff
changeset
|
1785 cs_id = -1; |
52654
2e5944e29aa0
(Finternal_char_font): Change return value to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
1786 } |
28963 | 1787 if (! CHAR_VALID_P (c, 0)) |
1788 return Qnil; | |
89943
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
1789 face_id = FACE_FOR_CHAR (f, FACE_FROM_ID (f, face_id), c, pos, Qnil); |
28963 | 1790 face = FACE_FROM_ID (f, face_id); |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1791 if (face->font) |
28963 | 1792 { |
96414
37737408d4f2
(Finternal_char_font): Return font-object instead of font-name.
Kenichi Handa <handa@m17n.org>
parents:
96087
diff
changeset
|
1793 unsigned code = face->font->driver->encode_char (face->font, c); |
37737408d4f2
(Finternal_char_font): Return font-object instead of font-name.
Kenichi Handa <handa@m17n.org>
parents:
96087
diff
changeset
|
1794 Lisp_Object font_object; |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1795 /* Assignment to EMACS_INT stops GCC whining about limited range |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1796 of data type. */ |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1797 EMACS_INT cod = code; |
49874
3bdee1887901
(check_fontset_name): If NAME is nil, return the
Kenichi Handa <handa@m17n.org>
parents:
49286
diff
changeset
|
1798 |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1799 if (code == FONT_INVALID_CODE) |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1800 return Qnil; |
96414
37737408d4f2
(Finternal_char_font): Return font-object instead of font-name.
Kenichi Handa <handa@m17n.org>
parents:
96087
diff
changeset
|
1801 XSETFONT (font_object, face->font); |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1802 if (cod <= MOST_POSITIVE_FIXNUM) |
96414
37737408d4f2
(Finternal_char_font): Return font-object instead of font-name.
Kenichi Handa <handa@m17n.org>
parents:
96087
diff
changeset
|
1803 return Fcons (font_object, make_number (code)); |
37737408d4f2
(Finternal_char_font): Return font-object instead of font-name.
Kenichi Handa <handa@m17n.org>
parents:
96087
diff
changeset
|
1804 return Fcons (font_object, Fcons (make_number (code >> 16), |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1805 make_number (code & 0xFFFF))); |
28963 | 1806 } |
89904 | 1807 return Qnil; |
28963 | 1808 } |
1809 | |
1810 | |
17052 | 1811 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
|
1812 doc: /* Return information about a fontset FONTSET on frame FRAME. |
95143
3e0cd839473e
(Ffontset_info): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
95127
diff
changeset
|
1813 The value is a char-table whose elements have this form: |
28963 | 1814 |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1815 ((FONT-PATTERN OPENED-FONT ...) ...) |
28963 | 1816 |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1817 FONT-PATTERN is a vector: |
28963 | 1818 |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1819 [ FAMILY WEIGHT SLANT SWIDTH ADSTYLE REGISTRY ] |
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1820 |
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1821 or a string of font name pattern. |
28963 | 1822 |
89349
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1823 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
|
1824 |
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1825 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
|
1826 containing the information about the derived fonts from the default |
95143
3e0cd839473e
(Ffontset_info): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
95127
diff
changeset
|
1827 fontset. The format is the same as above. */) |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1828 (fontset, frame) |
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1829 Lisp_Object fontset, frame; |
17052 | 1830 { |
1831 FRAME_PTR f; | |
89811
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
1832 Lisp_Object *realized[2], fontsets[2], tables[2]; |
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
1833 Lisp_Object val, elt; |
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
1834 int c, i, j, k; |
41987
34952771ae85
Fix typos, remove unnecessary space.
Pavel Janík <Pavel@Janik.cz>
parents:
41052
diff
changeset
|
1835 |
17052 | 1836 (*check_window_system_func) (); |
1837 | |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1838 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
|
1839 |
17052 | 1840 if (NILP (frame)) |
25668
99290b59352d
(Ffont_info): Change for Lisp_Object selected_frame.
Gerd Moellmann <gerd@gnu.org>
parents:
24611
diff
changeset
|
1841 frame = selected_frame; |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40028
diff
changeset
|
1842 CHECK_LIVE_FRAME (frame); |
25668
99290b59352d
(Ffont_info): Change for Lisp_Object selected_frame.
Gerd Moellmann <gerd@gnu.org>
parents:
24611
diff
changeset
|
1843 f = XFRAME (frame); |
17052 | 1844 |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1845 /* Recode fontsets realized on FRAME from the base fontset FONTSET |
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1846 in the table `realized'. */ |
89811
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
1847 realized[0] = (Lisp_Object *) alloca (sizeof (Lisp_Object) |
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
1848 * ASIZE (Vfontset_table)); |
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
1849 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
|
1850 { |
28963 | 1851 elt = FONTSET_FROM_ID (i); |
1852 if (!NILP (elt) | |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1853 && EQ (FONTSET_BASE (elt), fontset) |
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1854 && EQ (FONTSET_FRAME (elt), frame)) |
89811
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
1855 realized[0][j++] = elt; |
49874
3bdee1887901
(check_fontset_name): If NAME is nil, return the
Kenichi Handa <handa@m17n.org>
parents:
49286
diff
changeset
|
1856 } |
89811
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
1857 realized[0][j] = Qnil; |
49874
3bdee1887901
(check_fontset_name): If NAME is nil, return the
Kenichi Handa <handa@m17n.org>
parents:
49286
diff
changeset
|
1858 |
89811
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
1859 realized[1] = (Lisp_Object *) alloca (sizeof (Lisp_Object) |
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
1860 * ASIZE (Vfontset_table)); |
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
1861 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
|
1862 { |
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
1863 elt = FONTSET_DEFAULT (realized[0][i]); |
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
1864 if (! NILP (elt)) |
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
1865 realized[1][j++] = elt; |
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
1866 } |
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
1867 realized[1][j] = Qnil; |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1868 |
89811
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
1869 tables[0] = Fmake_char_table (Qfontset_info, Qnil); |
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
1870 tables[1] = Fmake_char_table (Qnil, Qnil); |
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
1871 XCHAR_TABLE (tables[0])->extras[0] = tables[1]; |
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
1872 fontsets[0] = fontset; |
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
1873 fontsets[1] = Vdefault_fontset; |
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
1874 |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1875 /* Accumulate information of the fontset in TABLE. The format of |
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1876 each element is ((FONT-SPEC OPENED-FONT ...) ...). */ |
89811
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
1877 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
|
1878 { |
89811
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
1879 for (c = 0; c <= MAX_CHAR; ) |
28963 | 1880 { |
99980
0a43374c0145
(fontset_add): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
98582
diff
changeset
|
1881 int from = c, to = MAX_5_BYTE_CHAR; |
17052 | 1882 |
89811
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
1883 if (c <= MAX_5_BYTE_CHAR) |
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
1884 { |
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
1885 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
|
1886 } |
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
1887 else |
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
1888 { |
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
1889 val = FONTSET_FALLBACK (fontsets[k]); |
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
1890 to = MAX_CHAR; |
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
1891 } |
89349
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1892 if (VECTORP (val)) |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1893 { |
89349
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1894 Lisp_Object alist; |
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1895 |
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1896 /* At first, set ALIST to ((FONT-SPEC) ...). */ |
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1897 for (alist = Qnil, i = 0; i < ASIZE (val); i++) |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1898 if (! NILP (AREF (val, i))) |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1899 alist = Fcons (Fcons (FONT_DEF_SPEC (AREF (val, i)), Qnil), |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1900 alist); |
89349
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1901 alist = Fnreverse (alist); |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
1902 |
95656
32785fc68f99
(Ffontset_info): Fix typo.
Andreas Schwab <schwab@suse.de>
parents:
95570
diff
changeset
|
1903 /* Then store opened font names to cdr of each elements. */ |
89811
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
1904 for (i = 0; ! NILP (realized[k][i]); i++) |
28963 | 1905 { |
89811
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
1906 if (c <= MAX_5_BYTE_CHAR) |
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
1907 val = FONTSET_REF (realized[k][i], c); |
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
1908 else |
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
1909 val = FONTSET_FALLBACK (realized[k][i]); |
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
1910 if (! VECTORP (val)) |
89349
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1911 continue; |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1912 /* VAL: [int ? [FACE-ID FONT-DEF FONT-OBJECT int] ... ] */ |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1913 for (j = 2; j < ASIZE (val); j++) |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1914 { |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1915 elt = AREF (val, j); |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1916 if (FONT_OBJECT_P (RFONT_DEF_OBJECT (elt))) |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1917 { |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1918 Lisp_Object font_object = RFONT_DEF_OBJECT (elt); |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1919 Lisp_Object slot, name; |
89349
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1920 |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1921 slot = Fassq (RFONT_DEF_SPEC (elt), alist); |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1922 name = AREF (font_object, FONT_NAME_INDEX); |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1923 if (NILP (Fmember (name, XCDR (slot)))) |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1924 nconc2 (slot, Fcons (name, Qnil)); |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1925 } |
91513
53399782ad84
(Ffontset_info): Handle the case of inhibitting the
Kenichi Handa <handa@m17n.org>
parents:
91364
diff
changeset
|
1926 } |
28963 | 1927 } |
89349
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1928 |
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1929 /* 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
|
1930 if (c <= MAX_5_BYTE_CHAR) |
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
1931 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
|
1932 else |
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
1933 XCHAR_TABLE (tables[k])->defalt = alist; |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1934 |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1935 /* At last, change each elements to font names. */ |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1936 for (; CONSP (alist); alist = XCDR (alist)) |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1937 { |
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1938 elt = XCAR (alist); |
95179
5c007b5b6cd8
(fontset_from_font, Ffontset_info): Add the 2nd arg in
Kenichi Handa <handa@m17n.org>
parents:
95143
diff
changeset
|
1939 XSETCAR (elt, Ffont_xlfd_name (XCAR (elt), Qnil)); |
94928
a9ee82808208
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
92705
diff
changeset
|
1940 } |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1941 } |
89349
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
1942 c = to + 1; |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1943 } |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1944 } |
30124
26076259e03f
(Ffontset_info): Make the return value more compatible
Kenichi Handa <handa@m17n.org>
parents:
29767
diff
changeset
|
1945 |
89811
d13626b05df3
(fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents:
89805
diff
changeset
|
1946 return tables[0]; |
17052 | 1947 } |
1948 | |
1949 | |
89940
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
1950 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
|
1951 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
|
1952 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
|
1953 |
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
1954 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
|
1955 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
|
1956 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
|
1957 fontset. |
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
1958 |
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
1959 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
|
1960 patterns. */) |
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
1961 (name, ch, all) |
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
1962 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
|
1963 { |
34975
0d69e2d2724e
(fontset_ref): Remove unused variable `i'.
Eli Zaretskii <eliz@gnu.org>
parents:
32978
diff
changeset
|
1964 int c; |
89940
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
1965 Lisp_Object fontset, elt, list, repertory, val; |
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
1966 int i, j; |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1967 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1968 fontset = check_fontset_name (name); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1969 |
88405 | 1970 CHECK_CHARACTER (ch); |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
1971 c = XINT (ch); |
89940
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
1972 list = Qnil; |
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
1973 while (1) |
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
1974 { |
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
1975 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
|
1976 i++, elt = FONTSET_FALLBACK (fontset)) |
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
1977 if (VECTORP (elt)) |
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
1978 for (j = 0; j < ASIZE (elt); j++) |
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
1979 { |
101553
a44c0bbce387
(font_for_char): Use assq_no_quit, not assoc_no_quit.
Kenichi Handa <handa@m17n.org>
parents:
101522
diff
changeset
|
1980 Lisp_Object family, registry; |
a44c0bbce387
(font_for_char): Use assq_no_quit, not assoc_no_quit.
Kenichi Handa <handa@m17n.org>
parents:
101522
diff
changeset
|
1981 |
89940
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
1982 val = AREF (elt, j); |
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
1983 repertory = AREF (val, 1); |
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
1984 if (INTEGERP (repertory)) |
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
1985 { |
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
1986 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
|
1987 |
89940
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
1988 if (! CHAR_CHARSET_P (c, charset)) |
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
1989 continue; |
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
1990 } |
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
1991 else if (CHAR_TABLE_P (repertory)) |
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
1992 { |
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
1993 if (NILP (CHAR_TABLE_REF (repertory, c))) |
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
1994 continue; |
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
1995 } |
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
1996 val = AREF (val, 0); |
101553
a44c0bbce387
(font_for_char): Use assq_no_quit, not assoc_no_quit.
Kenichi Handa <handa@m17n.org>
parents:
101522
diff
changeset
|
1997 /* VAL is a FONT-SPEC */ |
a44c0bbce387
(font_for_char): Use assq_no_quit, not assoc_no_quit.
Kenichi Handa <handa@m17n.org>
parents:
101522
diff
changeset
|
1998 family = AREF (val, FONT_FAMILY_INDEX); |
a44c0bbce387
(font_for_char): Use assq_no_quit, not assoc_no_quit.
Kenichi Handa <handa@m17n.org>
parents:
101522
diff
changeset
|
1999 if (! NILP (family)) |
a44c0bbce387
(font_for_char): Use assq_no_quit, not assoc_no_quit.
Kenichi Handa <handa@m17n.org>
parents:
101522
diff
changeset
|
2000 family = SYMBOL_NAME (family); |
a44c0bbce387
(font_for_char): Use assq_no_quit, not assoc_no_quit.
Kenichi Handa <handa@m17n.org>
parents:
101522
diff
changeset
|
2001 registry = AREF (val, FONT_REGISTRY_INDEX); |
a44c0bbce387
(font_for_char): Use assq_no_quit, not assoc_no_quit.
Kenichi Handa <handa@m17n.org>
parents:
101522
diff
changeset
|
2002 if (! NILP (registry)) |
a44c0bbce387
(font_for_char): Use assq_no_quit, not assoc_no_quit.
Kenichi Handa <handa@m17n.org>
parents:
101522
diff
changeset
|
2003 registry = SYMBOL_NAME (registry); |
a44c0bbce387
(font_for_char): Use assq_no_quit, not assoc_no_quit.
Kenichi Handa <handa@m17n.org>
parents:
101522
diff
changeset
|
2004 val = Fcons (family, registry); |
89940
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
2005 if (NILP (all)) |
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
2006 return val; |
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
2007 list = Fcons (val, list); |
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
2008 } |
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
2009 if (EQ (fontset, Vdefault_fontset)) |
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
2010 break; |
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
2011 fontset = Vdefault_fontset; |
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
2012 } |
713a4f4140ca
(Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents:
89904
diff
changeset
|
2013 return (Fnreverse (list)); |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
2014 } |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
2015 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
2016 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
|
2017 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
|
2018 () |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
2019 { |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
2020 Lisp_Object fontset, list; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
2021 int i; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
2022 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
2023 list = Qnil; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
2024 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
|
2025 { |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
2026 fontset = FONTSET_FROM_ID (i); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
2027 if (!NILP (fontset) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
2028 && BASE_FONTSET_P (fontset)) |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
2029 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
|
2030 } |
28963 | 2031 |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
2032 return list; |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
2033 } |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
2034 |
89610
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
2035 |
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
2036 #ifdef FONTSET_DEBUG |
53353
b085f18ebcf0
(Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
53072
diff
changeset
|
2037 |
89610
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
2038 Lisp_Object |
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
2039 dump_fontset (fontset) |
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
2040 Lisp_Object fontset; |
53353
b085f18ebcf0
(Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
53072
diff
changeset
|
2041 { |
89610
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
2042 Lisp_Object vec; |
53353
b085f18ebcf0
(Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
53072
diff
changeset
|
2043 |
89610
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
2044 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
|
2045 ASET (vec, 0, FONTSET_ID (fontset)); |
53353
b085f18ebcf0
(Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
53072
diff
changeset
|
2046 |
89610
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
2047 if (BASE_FONTSET_P (fontset)) |
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
2048 { |
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
2049 ASET (vec, 1, FONTSET_NAME (fontset)); |
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
2050 } |
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
2051 else |
53353
b085f18ebcf0
(Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
53072
diff
changeset
|
2052 { |
89610
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
2053 Lisp_Object frame; |
53353
b085f18ebcf0
(Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
53072
diff
changeset
|
2054 |
89610
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
2055 frame = FONTSET_FRAME (fontset); |
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
2056 if (FRAMEP (frame)) |
53353
b085f18ebcf0
(Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
53072
diff
changeset
|
2057 { |
89610
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
2058 FRAME_PTR f = XFRAME (frame); |
53353
b085f18ebcf0
(Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
53072
diff
changeset
|
2059 |
89610
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
2060 if (FRAME_LIVE_P (f)) |
90802
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
2061 ASET (vec, 1, |
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
2062 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
|
2063 else |
90802
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
2064 ASET (vec, 1, |
bfafc889caa9
(fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents:
90737
diff
changeset
|
2065 Fcons (FONTSET_NAME (FONTSET_BASE (fontset)), Qnil)); |
53353
b085f18ebcf0
(Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
53072
diff
changeset
|
2066 } |
89805
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
2067 if (!NILP (FONTSET_DEFAULT (fontset))) |
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
2068 ASET (vec, 2, FONTSET_ID (FONTSET_DEFAULT (fontset))); |
53353
b085f18ebcf0
(Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
53072
diff
changeset
|
2069 } |
89610
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
2070 return vec; |
53353
b085f18ebcf0
(Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
53072
diff
changeset
|
2071 } |
b085f18ebcf0
(Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
53072
diff
changeset
|
2072 |
89610
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
2073 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
|
2074 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
|
2075 () |
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
2076 { |
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
2077 Lisp_Object val; |
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
2078 int i; |
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
2079 |
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
2080 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
|
2081 if (! NILP (AREF (Vfontset_table, i))) |
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
2082 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
|
2083 return (Fnreverse (val)); |
53353
b085f18ebcf0
(Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
53072
diff
changeset
|
2084 } |
89610
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
2085 #endif /* FONTSET_DEBUG */ |
53353
b085f18ebcf0
(Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
53072
diff
changeset
|
2086 |
21514 | 2087 void |
17052 | 2088 syms_of_fontset () |
2089 { | |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
2090 DEFSYM (Qfontset, "fontset"); |
89805
35a0a24752d3
(FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents:
89711
diff
changeset
|
2091 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
|
2092 DEFSYM (Qfontset_info, "fontset-info"); |
9a305cf42688
Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents:
89337
diff
changeset
|
2093 Fput (Qfontset_info, Qchar_table_extra_slots, make_number (1)); |
17052 | 2094 |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
2095 DEFSYM (Qprepend, "prepend"); |
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
2096 DEFSYM (Qappend, "append"); |
90642 | 2097 DEFSYM (Qlatin, "latin"); |
17052 | 2098 |
2099 Vcached_fontset_data = Qnil; | |
2100 staticpro (&Vcached_fontset_data); | |
2101 | |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
2102 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
|
2103 staticpro (&Vfontset_table); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
2104 |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
2105 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
|
2106 staticpro (&Vdefault_fontset); |
28963 | 2107 FONTSET_ID (Vdefault_fontset) = make_number (0); |
2108 FONTSET_NAME (Vdefault_fontset) | |
2109 = build_string ("-*-*-*-*-*-*-*-*-*-*-*-*-fontset-default"); | |
91668
aeadaa72f7b1
(free_face_fontset): Use FONTSET_FROM_ID.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91513
diff
changeset
|
2110 ASET (Vfontset_table, 0, Vdefault_fontset); |
28963 | 2111 next_fontset_id = 1; |
17052 | 2112 |
89610
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
2113 auto_fontset_alist = Qnil; |
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
2114 staticpro (&auto_fontset_alist); |
53353
b085f18ebcf0
(Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
53072
diff
changeset
|
2115 |
91266
3cd59392b3ec
(Vfont_encoding_charset_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
91250
diff
changeset
|
2116 DEFVAR_LISP ("font-encoding-charset-alist", &Vfont_encoding_charset_alist, |
3cd59392b3ec
(Vfont_encoding_charset_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
91250
diff
changeset
|
2117 doc: /* |
3cd59392b3ec
(Vfont_encoding_charset_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
91250
diff
changeset
|
2118 Alist of charsets vs the charsets to determine the preferred font encoding. |
95143
3e0cd839473e
(Ffontset_info): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
95127
diff
changeset
|
2119 Each element looks like (CHARSET . ENCODING-CHARSET), |
91266
3cd59392b3ec
(Vfont_encoding_charset_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
91250
diff
changeset
|
2120 where ENCODING-CHARSET is a charset registered in the variable |
3cd59392b3ec
(Vfont_encoding_charset_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
91250
diff
changeset
|
2121 `font-encoding-alist' as ENCODING. |
3cd59392b3ec
(Vfont_encoding_charset_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
91250
diff
changeset
|
2122 |
3cd59392b3ec
(Vfont_encoding_charset_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
91250
diff
changeset
|
2123 When a text has a property `charset' and the value is CHARSET, a font |
3cd59392b3ec
(Vfont_encoding_charset_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
91250
diff
changeset
|
2124 whose encoding corresponds to ENCODING-CHARSET is preferred. */); |
3cd59392b3ec
(Vfont_encoding_charset_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
91250
diff
changeset
|
2125 Vfont_encoding_charset_alist = Qnil; |
17052 | 2126 |
17112
5c48ff325655
(syms_of_fontset): Intern Qfontset. Declare new lisp
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
2127 DEFVAR_LISP ("use-default-ascent", &Vuse_default_ascent, |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
2128 doc: /* |
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
2129 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
|
2130 If an entry for a character is non-nil, the ascent value of the glyph |
95143
3e0cd839473e
(Ffontset_info): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
95127
diff
changeset
|
2131 is assumed to be specified by _MULE_DEFAULT_ASCENT property of a font. |
41001
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
2132 |
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40771
diff
changeset
|
2133 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
|
2134 such a character is displayed on screen. */); |
19282
09a1536debb4
(Vignore_relative_composition): New variable.
Kenichi Handa <handa@m17n.org>
parents:
19172
diff
changeset
|
2135 Vuse_default_ascent = Qnil; |
09a1536debb4
(Vignore_relative_composition): New variable.
Kenichi Handa <handa@m17n.org>
parents:
19172
diff
changeset
|
2136 |
09a1536debb4
(Vignore_relative_composition): New variable.
Kenichi Handa <handa@m17n.org>
parents:
19172
diff
changeset
|
2137 DEFVAR_LISP ("ignore-relative-composition", &Vignore_relative_composition, |
88903
d32a3736c4fe
(Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents:
88857
diff
changeset
|
2138 doc: /* |
95143
3e0cd839473e
(Ffontset_info): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
95127
diff
changeset
|
2139 Char table of characters which are 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
|
2140 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
|
2141 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
|
2142 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
|
2143 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
|
2144 Vignore_relative_composition = Qnil; |
17112
5c48ff325655
(syms_of_fontset): Intern Qfontset. Declare new lisp
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
2145 |
19450
895dc2520755
(Valternate_fontname_alist): Name changed from
Kenichi Handa <handa@m17n.org>
parents:
19282
diff
changeset
|
2146 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
|
2147 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
|
2148 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
|
2149 alternate fontnames (if any) are tried instead. */); |
19450
895dc2520755
(Valternate_fontname_alist): Name changed from
Kenichi Handa <handa@m17n.org>
parents:
19282
diff
changeset
|
2150 Valternate_fontname_alist = Qnil; |
17193
dc4562b0152a
(Valternative_fontname_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
17190
diff
changeset
|
2151 |
17730
4bbcc6804b5d
(Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
17331
diff
changeset
|
2152 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
|
2153 doc: /* Alist of fontset names vs the aliases. */); |
28963 | 2154 Vfontset_alias_alist = Fcons (Fcons (FONTSET_NAME (Vdefault_fontset), |
2155 build_string ("fontset-default")), | |
2156 Qnil); | |
17730
4bbcc6804b5d
(Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
17331
diff
changeset
|
2157 |
26858
7cc081b4e084
(Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents:
26164
diff
changeset
|
2158 DEFVAR_LISP ("vertical-centering-font-regexp", |
7cc081b4e084
(Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents:
26164
diff
changeset
|
2159 &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
|
2160 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
|
2161 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
|
2162 at the vertical center of lines. */); |
26858
7cc081b4e084
(Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents:
26164
diff
changeset
|
2163 Vvertical_centering_font_regexp = Qnil; |
7cc081b4e084
(Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents:
26164
diff
changeset
|
2164 |
90509
c1ec6b950928
(Votf_script_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90475
diff
changeset
|
2165 DEFVAR_LISP ("otf-script-alist", &Votf_script_alist, |
c1ec6b950928
(Votf_script_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90475
diff
changeset
|
2166 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
|
2167 Votf_script_alist = Qnil; |
c1ec6b950928
(Votf_script_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90475
diff
changeset
|
2168 |
17052 | 2169 defsubr (&Squery_fontset); |
2170 defsubr (&Snew_fontset); | |
2171 defsubr (&Sset_fontset_font); | |
28963 | 2172 defsubr (&Sinternal_char_font); |
17052 | 2173 defsubr (&Sfontset_info); |
28223
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
2174 defsubr (&Sfontset_font); |
b888c69e8bf0
All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
26858
diff
changeset
|
2175 defsubr (&Sfontset_list); |
89610
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
2176 #ifdef FONTSET_DEBUG |
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
2177 defsubr (&Sfontset_list_all); |
3aa74296be55
(fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents:
89607
diff
changeset
|
2178 #endif |
17052 | 2179 } |
52401 | 2180 |
2181 /* arch-tag: ea861585-2f5f-4e5b-9849-d04a9c3a3537 | |
2182 (do not change this comment) */ |