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