annotate src/fontset.c @ 89603:7f9f2d025eee

(Fnew_fontset): Check NAME more rigidly.
author Kenichi Handa <handa@m17n.org>
date Thu, 23 Oct 2003 08:42:39 +0000
parents 971778c2578c
children 9090f7eba02c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1 /* Fontset handler.
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
2 Copyright (C) 1995, 1997, 2000 Electrotechnical Laboratory, JAPAN.
89483
2f877ed80fa6 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88123 89428
diff changeset
3 Licensed to the Free Software Foundation.
2f877ed80fa6 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88123 89428
diff changeset
4 Copyright (C) 2003
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
5 National Institute of Advanced Industrial Science and Technology (AIST)
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
6 Registration Number H13PRO009
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
7
17071
70194012fb3a Fix FSF address in comment.
Karl Heuer <kwzh@gnu.org>
parents: 17052
diff changeset
8 This file is part of GNU Emacs.
70194012fb3a Fix FSF address in comment.
Karl Heuer <kwzh@gnu.org>
parents: 17052
diff changeset
9
70194012fb3a Fix FSF address in comment.
Karl Heuer <kwzh@gnu.org>
parents: 17052
diff changeset
10 GNU Emacs is free software; you can redistribute it and/or modify
70194012fb3a Fix FSF address in comment.
Karl Heuer <kwzh@gnu.org>
parents: 17052
diff changeset
11 it under the terms of the GNU General Public License as published by
70194012fb3a Fix FSF address in comment.
Karl Heuer <kwzh@gnu.org>
parents: 17052
diff changeset
12 the Free Software Foundation; either version 2, or (at your option)
70194012fb3a Fix FSF address in comment.
Karl Heuer <kwzh@gnu.org>
parents: 17052
diff changeset
13 any later version.
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
14
17071
70194012fb3a Fix FSF address in comment.
Karl Heuer <kwzh@gnu.org>
parents: 17052
diff changeset
15 GNU Emacs is distributed in the hope that it will be useful,
70194012fb3a Fix FSF address in comment.
Karl Heuer <kwzh@gnu.org>
parents: 17052
diff changeset
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
70194012fb3a Fix FSF address in comment.
Karl Heuer <kwzh@gnu.org>
parents: 17052
diff changeset
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
70194012fb3a Fix FSF address in comment.
Karl Heuer <kwzh@gnu.org>
parents: 17052
diff changeset
18 GNU General Public License for more details.
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
19
17071
70194012fb3a Fix FSF address in comment.
Karl Heuer <kwzh@gnu.org>
parents: 17052
diff changeset
20 You should have received a copy of the GNU General Public License
70194012fb3a Fix FSF address in comment.
Karl Heuer <kwzh@gnu.org>
parents: 17052
diff changeset
21 along with GNU Emacs; see the file COPYING. If not, write to
70194012fb3a Fix FSF address in comment.
Karl Heuer <kwzh@gnu.org>
parents: 17052
diff changeset
22 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
70194012fb3a Fix FSF address in comment.
Karl Heuer <kwzh@gnu.org>
parents: 17052
diff changeset
23 Boston, MA 02111-1307, USA. */
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
24
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
25 /* #define FONTSET_DEBUG */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
26
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
27 #include <config.h>
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
28
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
29 #ifdef FONTSET_DEBUG
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
30 #include <stdio.h>
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
31 #endif
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
32
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
33 #include "lisp.h"
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
34 #include "blockinput.h"
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
35 #include "buffer.h"
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
36 #include "character.h"
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
37 #include "charset.h"
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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"
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
42 #include "fontset.h"
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
43 #include "window.h"
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
44
89483
2f877ed80fa6 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88123 89428
diff changeset
45 #undef xassert
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
46 #ifdef FONTSET_DEBUG
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
47 #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
48 #undef INLINE
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
49 #define INLINE
89483
2f877ed80fa6 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88123 89428
diff changeset
50 #else /* not FONTSET_DEBUG */
2f877ed80fa6 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88123 89428
diff changeset
51 #define xassert(X) (void) 0
2f877ed80fa6 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88123 89428
diff changeset
52 #endif /* not FONTSET_DEBUG */
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
53
88546
7471723e43b0 (Fclear_face_cache): Declare.
Dave Love <fx@gnu.org>
parents: 88500
diff changeset
54 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
55
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
56 /* FONTSET
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
57
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
58 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
59 similar appearance (style, etc) of characters. A fontset has two
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
60 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
61 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
62 `ascii' script for the frame's default font.
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
63
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
64 Another role, the more important one, is to provide information
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
65 about which font to use for each non-ASCII character.
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
66
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
67 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
68 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
69 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
70 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
71 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
72 face share the same realized fontset.
89483
2f877ed80fa6 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88123 89428
diff changeset
73
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
74 A fontset object is implemented by a char-table whose default value
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
75 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
76
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
77 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
78 is a vector [ FONT-SPEC ENCODING REPERTORY ].
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
79
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
80 FONT-SPEC is:
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
81 [ FAMILY WEIGHT SLANT SWIDTH ADSTYLE REGISTRY ]
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
82 or
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
83 FONT-NAME
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
84 where FAMILY, WEIGHT, SLANT, SWIDTH, ADSTYLE, REGISTRY, and
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
85 FONT-NAME are strings.
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
86
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
87 ENCODING is a charset ID or a char-table that can convert
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
88 characters to glyph codes of the corresponding font.
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 REPERTORY is a charset ID or nil. If REPERTORY is a charset ID,
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
91 the repertory of the charset exactly matches with that of the font.
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
92 If REPERTORY is nil, we consult with the font itself to get the
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
93 repertory.
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
94
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
95 ENCODING and REPERTORY are extracted from the variable
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
96 Vfont_encoding_alist by using a font name generated form FONT-SPEC
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
97 (if it is a vector) or FONT-NAME as a key.
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
98
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
99
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
100 An element of a realized fontset is nil or t, or has this form:
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
101
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
102 ( CHARSET-PRIORITY-LIST-TICK . FONT-VECTOR )
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
103
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
104 FONT-VECTOR is a vector whose elements have this form:
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
105
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
106 [ FACE-ID FONT-INDEX FONT-DEF ]
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
107
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
108 FONT-VECTOR is automatically reordered by the current charset
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
109 priority list.
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
110
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
111 The value nil means that we have not yet generated FONT-VECTOR from
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
112 the base of the fontset.
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
113
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
114 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
115 range of characters.
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
116
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
117
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
118 A fontset has 8 extra slots.
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
119
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
120 The 1st slot: the ID number of the fontset
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
121
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
122 The 2nd slot:
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
123 base: the name of the fontset
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
124 realized: nil
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
125
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
126 The 3rd slot:
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
127 base: nil
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
128 realized: the base fontset
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
129
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
130 The 4th slot:
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
131 base: nil
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
132 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
133
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
134 The 5th slot:
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
135 base: the font name for ASCII characters
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
136 realized: nil
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
137
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
138 The 6th slot:
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
139 base: nil
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
140 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
141 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
142
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
143 The 7th slot:
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
144 base: nil
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
145 realized: Alist of font index vs the corresponding repertory
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
146 char-table.
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
147
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
148 The 8th slot:
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
149 base: nil
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
150 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
151 realized from the default fontset, else nil.
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
152
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
153 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
154
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
155
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
156 DEFAULT FONTSET
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
157
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
158 There's a special base fontset named `default fontset' which
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
159 defines the default font specifications. When a base fontset
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
160 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
161 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
162
30398
dde5ab185aad (fontset_ref): Remove INLINE declaration.
Kenichi Handa <handa@m17n.org>
parents: 30172
diff changeset
163 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
164 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
165
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
166
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
167 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
168 The other codes handle fontsets only by their ID numbers. They
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
169 usually use the variable name `fontset' for IDs. But, in this
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
170 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
171 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
172
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
173 */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
174
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
175 /********** VARIABLES and FUNCTION PROTOTYPES **********/
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 extern Lisp_Object Qfont;
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
178 static Lisp_Object Qfontset;
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
179 static Lisp_Object Qfontset_info;
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
180 static Lisp_Object Qprepend, Qappend;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
181
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
182 /* Vector containing all fontsets. */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
183 static Lisp_Object Vfontset_table;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
184
41987
34952771ae85 Fix typos, remove unnecessary space.
Pavel Janík <Pavel@Janik.cz>
parents: 41052
diff changeset
185 /* 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
186 fontset ID not yet used. */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
187 static int next_fontset_id;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
188
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
189 /* The default fontset. This gives default FAMILY and REGISTRY of
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
190 font for each character. */
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
191 static Lisp_Object Vdefault_fontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
192
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
193 Lisp_Object Vfont_encoding_alist;
17112
5c48ff325655 (syms_of_fontset): Intern Qfontset. Declare new lisp
Kenichi Handa <handa@m17n.org>
parents: 17071
diff changeset
194 Lisp_Object Vuse_default_ascent;
19282
09a1536debb4 (Vignore_relative_composition): New variable.
Kenichi Handa <handa@m17n.org>
parents: 19172
diff changeset
195 Lisp_Object Vignore_relative_composition;
19450
895dc2520755 (Valternate_fontname_alist): Name changed from
Kenichi Handa <handa@m17n.org>
parents: 19282
diff changeset
196 Lisp_Object Valternate_fontname_alist;
17730
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
197 Lisp_Object Vfontset_alias_alist;
26858
7cc081b4e084 (Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents: 26164
diff changeset
198 Lisp_Object Vvertical_centering_font_regexp;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
199
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
200 /* The following six are declarations of callback functions depending
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
201 on window system. See the comments in src/fontset.h for more
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
202 detail. */
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
203
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
204 /* Return a pointer to struct font_info of font FONT_IDX of frame F. */
20315
931b4ddf7966 Protoize functions declarations.
Andreas Schwab <schwab@suse.de>
parents: 19450
diff changeset
205 struct font_info *(*get_font_info_func) P_ ((FRAME_PTR f, int font_idx));
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
206
41987
34952771ae85 Fix typos, remove unnecessary space.
Pavel Janík <Pavel@Janik.cz>
parents: 41052
diff changeset
207 /* Return a list of font names which matches PATTERN. See the documentation
34952771ae85 Fix typos, remove unnecessary space.
Pavel Janík <Pavel@Janik.cz>
parents: 41052
diff changeset
208 of `x-list-fonts' for more details. */
23517
73f09e7bc96e Include frame.h before fontset.h.
Kenichi Handa <handa@m17n.org>
parents: 22719
diff changeset
209 Lisp_Object (*list_fonts_func) P_ ((struct frame *f,
73f09e7bc96e Include frame.h before fontset.h.
Kenichi Handa <handa@m17n.org>
parents: 22719
diff changeset
210 Lisp_Object pattern,
73f09e7bc96e Include frame.h before fontset.h.
Kenichi Handa <handa@m17n.org>
parents: 22719
diff changeset
211 int size,
73f09e7bc96e Include frame.h before fontset.h.
Kenichi Handa <handa@m17n.org>
parents: 22719
diff changeset
212 int maxnames));
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
213
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
214 /* Load a font named NAME for frame F and return a pointer to the
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
215 information of the loaded font. If loading is failed, return 0. */
20315
931b4ddf7966 Protoize functions declarations.
Andreas Schwab <schwab@suse.de>
parents: 19450
diff changeset
216 struct font_info *(*load_font_func) P_ ((FRAME_PTR f, char *name, int));
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
217
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
218 /* Return a pointer to struct font_info of a font named NAME for frame F. */
20315
931b4ddf7966 Protoize functions declarations.
Andreas Schwab <schwab@suse.de>
parents: 19450
diff changeset
219 struct font_info *(*query_font_func) P_ ((FRAME_PTR f, char *name));
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
220
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
221 /* Additional function for setting fontset or changing fontset
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
222 contents of frame F. */
20315
931b4ddf7966 Protoize functions declarations.
Andreas Schwab <schwab@suse.de>
parents: 19450
diff changeset
223 void (*set_frame_fontset_func) P_ ((FRAME_PTR f, Lisp_Object arg,
931b4ddf7966 Protoize functions declarations.
Andreas Schwab <schwab@suse.de>
parents: 19450
diff changeset
224 Lisp_Object oldval));
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
225
21553
2d7afcd11b72 (find_ccl_program_func): New variable.
Kenichi Handa <handa@m17n.org>
parents: 21514
diff changeset
226 /* To find a CCL program, fs_load_font calls this function.
2d7afcd11b72 (find_ccl_program_func): New variable.
Kenichi Handa <handa@m17n.org>
parents: 21514
diff changeset
227 The argument is a pointer to the struct font_info.
41987
34952771ae85 Fix typos, remove unnecessary space.
Pavel Janík <Pavel@Janik.cz>
parents: 41052
diff changeset
228 This function set the member `encoder' of the structure. */
21553
2d7afcd11b72 (find_ccl_program_func): New variable.
Kenichi Handa <handa@m17n.org>
parents: 21514
diff changeset
229 void (*find_ccl_program_func) P_ ((struct font_info *));
2d7afcd11b72 (find_ccl_program_func): New variable.
Kenichi Handa <handa@m17n.org>
parents: 21514
diff changeset
230
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
231 Lisp_Object (*get_font_repertory_func) P_ ((struct frame *,
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
232 struct font_info *));
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
233
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
234 /* Check if any window system is used now. */
20315
931b4ddf7966 Protoize functions declarations.
Andreas Schwab <schwab@suse.de>
parents: 19450
diff changeset
235 void (*check_window_system_func) P_ ((void));
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
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 /* Prototype declarations for static functions. */
89069
c2201502f37e (fontset_add): Return Lisp_Object.
Dave Love <fx@gnu.org>
parents: 89006
diff changeset
239 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
240 Lisp_Object));
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
241 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
242 static Lisp_Object fontset_pattern_regexp P_ ((Lisp_Object));
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
243 static void accumulate_script_ranges P_ ((Lisp_Object, Lisp_Object,
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
244 Lisp_Object));
88968
a35b7b45baa3 (fs_load_font): If fontp->charset is not negative,
Kenichi Handa <handa@m17n.org>
parents: 88931
diff changeset
245 static Lisp_Object find_font_encoding P_ ((char *));
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
246
88982
d50b0a9ea97a (fontset_add): Make the type `int'.
Kenichi Handa <handa@m17n.org>
parents: 88968
diff changeset
247 #ifdef FONTSET_DEBUG
d50b0a9ea97a (fontset_add): Make the type `int'.
Kenichi Handa <handa@m17n.org>
parents: 88968
diff changeset
248
d50b0a9ea97a (fontset_add): Make the type `int'.
Kenichi Handa <handa@m17n.org>
parents: 88968
diff changeset
249 /* 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
250
d50b0a9ea97a (fontset_add): Make the type `int'.
Kenichi Handa <handa@m17n.org>
parents: 88968
diff changeset
251 static int
d50b0a9ea97a (fontset_add): Make the type `int'.
Kenichi Handa <handa@m17n.org>
parents: 88968
diff changeset
252 fontset_id_valid_p (id)
d50b0a9ea97a (fontset_add): Make the type `int'.
Kenichi Handa <handa@m17n.org>
parents: 88968
diff changeset
253 int id;
d50b0a9ea97a (fontset_add): Make the type `int'.
Kenichi Handa <handa@m17n.org>
parents: 88968
diff changeset
254 {
d50b0a9ea97a (fontset_add): Make the type `int'.
Kenichi Handa <handa@m17n.org>
parents: 88968
diff changeset
255 return (id >= 0 && id < ASIZE (Vfontset_table) - 1);
d50b0a9ea97a (fontset_add): Make the type `int'.
Kenichi Handa <handa@m17n.org>
parents: 88968
diff changeset
256 }
d50b0a9ea97a (fontset_add): Make the type `int'.
Kenichi Handa <handa@m17n.org>
parents: 88968
diff changeset
257
d50b0a9ea97a (fontset_add): Make the type `int'.
Kenichi Handa <handa@m17n.org>
parents: 88968
diff changeset
258 #endif
d50b0a9ea97a (fontset_add): Make the type `int'.
Kenichi Handa <handa@m17n.org>
parents: 88968
diff changeset
259
d50b0a9ea97a (fontset_add): Make the type `int'.
Kenichi Handa <handa@m17n.org>
parents: 88968
diff changeset
260
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
261
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
262 /********** 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
263
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
264 /* 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
265 #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
266
30398
dde5ab185aad (fontset_ref): Remove INLINE declaration.
Kenichi Handa <handa@m17n.org>
parents: 30172
diff changeset
267 /* 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
268 #define FONTSET_ID(fontset) XCHAR_TABLE (fontset)->extras[0]
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
269
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
270 /* 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
271 #define FONTSET_NAME(fontset) XCHAR_TABLE (fontset)->extras[1]
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
272 #define FONTSET_ASCII(fontset) XCHAR_TABLE (fontset)->extras[4]
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
273
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
274 /* Macros to access special values of (realized) FONTSET. */
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
275 #define FONTSET_BASE(fontset) XCHAR_TABLE (fontset)->extras[2]
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
276 #define FONTSET_FRAME(fontset) XCHAR_TABLE (fontset)->extras[3]
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
277 #define FONTSET_NOFONT_FACE(fontset) XCHAR_TABLE (fontset)->extras[5]
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
278 #define FONTSET_REPERTORY(fontset) XCHAR_TABLE (fontset)->extras[6]
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
279 #define FONTSET_FALLBACK(fontset) XCHAR_TABLE (fontset)->extras[7]
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
280
89428
eed327e0bad3 (BASE_FONTSET_P): Check FONTSET_BASE, not
Kenichi Handa <handa@m17n.org>
parents: 89349
diff changeset
281 #define BASE_FONTSET_P(fontset) (NILP (FONTSET_BASE (fontset)))
eed327e0bad3 (BASE_FONTSET_P): Check FONTSET_BASE, not
Kenichi Handa <handa@m17n.org>
parents: 89349
diff changeset
282
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
283
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
284 /* 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
285 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
286 contain information for C, return the information in the default
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
287 fontset. */
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
288
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
289 #define FONTSET_REF(fontset, c) \
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
290 (EQ (fontset, Vdefault_fontset) \
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
291 ? CHAR_TABLE_REF (fontset, c) \
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
292 : fontset_ref ((fontset), (c)))
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
293
30398
dde5ab185aad (fontset_ref): Remove INLINE declaration.
Kenichi Handa <handa@m17n.org>
parents: 30172
diff changeset
294 static Lisp_Object
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
295 fontset_ref (fontset, c)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
296 Lisp_Object fontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
297 int c;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
298 {
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
299 Lisp_Object elt;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
300
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
301 elt = CHAR_TABLE_REF (fontset, c);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
302 if (NILP (elt) && ! EQ (fontset, Vdefault_fontset)
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
303 /* Don't check Vdefault_fontset for a realized fontset. */
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
304 && NILP (FONTSET_BASE (fontset)))
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
305 elt = CHAR_TABLE_REF (Vdefault_fontset, c);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
306 return elt;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
307 }
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
308
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
309
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
310 /* Return the element of FONTSET for the character C, set FROM and TO
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
311 to the range of characters around C that have the same value as C.
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
312 If FONTSET is a base fontset other then the default fontset and
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
313 FONTSET doesn't contain information for C, return the information
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
314 in the default fontset. */
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
315
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
316 #define FONTSET_REF_AND_RANGE(fontset, c, form, to) \
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
317 (EQ (fontset, Vdefault_fontset) \
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
318 ? char_table_ref_and_range (fontset, c, &from, &to) \
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
319 : fontset_ref_and_range (fontset, c, &from, &to))
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
320
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
321 static Lisp_Object
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
322 fontset_ref_and_range (fontset, c, from, to)
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
323 Lisp_Object fontset;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
324 int c;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
325 int *from, *to;
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 Lisp_Object elt;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
328
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
329 elt = char_table_ref_and_range (fontset, c, from, to);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
330 if (NILP (elt) && ! EQ (fontset, Vdefault_fontset)
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
331 /* Don't check Vdefault_fontset for a realized fontset. */
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
332 && NILP (FONTSET_BASE (fontset)))
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
333 {
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
334 int from1, to1;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
335
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
336 elt = char_table_ref_and_range (Vdefault_fontset, c, &from1, &to1);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
337 if (*from < from1)
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
338 *from = from1;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
339 if (*to > to1)
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
340 *to = to1;
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
341 }
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
342 return elt;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
343 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
344
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
345
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
346 /* 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
347 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
348 specifying a range. */
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
349
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
350 #define FONTSET_SET(fontset, range, elt) \
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
351 Fset_char_table_range ((fontset), (range), (elt))
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
352
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
353
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
354 /* Modify the elements of FONTSET for characters in RANGE by replacing
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
355 with ELT or adding ETL. RANGE is a cons (FROM . TO), where FROM
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
356 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
357 replace with ELT, if ADD is `prepend', prepend ELT, otherwise,
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
358 append ELT. */
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
359
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
360 #define FONTSET_ADD(fontset, range, elt, add) \
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
361 (NILP (add) \
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
362 ? Fset_char_table_range ((fontset), (range), \
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
363 Fmake_vector (make_number (1), (elt))) \
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
364 : fontset_add ((fontset), (range), (elt), (add)))
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
365
89069
c2201502f37e (fontset_add): Return Lisp_Object.
Dave Love <fx@gnu.org>
parents: 89006
diff changeset
366 static Lisp_Object
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
367 fontset_add (fontset, range, elt, add)
88931
74d18470865c (fontset_add): Declare args. Call make_number
Dave Love <fx@gnu.org>
parents: 88903
diff changeset
368 Lisp_Object fontset, range, elt, add;
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
369 {
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
370 int from, to, from1, to1;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
371 Lisp_Object elt1;
89483
2f877ed80fa6 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88123 89428
diff changeset
372
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
373 from = XINT (XCAR (range));
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
374 to = XINT (XCDR (range));
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
375 do {
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
376 elt1 = char_table_ref_and_range (fontset, from, &from1, &to1);
89428
eed327e0bad3 (BASE_FONTSET_P): Check FONTSET_BASE, not
Kenichi Handa <handa@m17n.org>
parents: 89349
diff changeset
377 if (to < to1)
eed327e0bad3 (BASE_FONTSET_P): Check FONTSET_BASE, not
Kenichi Handa <handa@m17n.org>
parents: 89349
diff changeset
378 to1 = to;
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
379 if (NILP (elt1))
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
380 elt1 = Fmake_vector (make_number (1), elt);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
381 else
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
382 {
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
383 int i, i0 = 1, i1 = ASIZE (elt1) + 1;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
384 Lisp_Object new;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
385
88931
74d18470865c (fontset_add): Declare args. Call make_number
Dave Love <fx@gnu.org>
parents: 88903
diff changeset
386 new = Fmake_vector (make_number (i1), elt);
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
387 if (EQ (add, Qappend))
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
388 i0--, i1--;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
389 for (i = 0; i0 < i1; i++, i0++)
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
390 ASET (new, i0, AREF (elt1, i));
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
391 elt1 = new;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
392 }
89428
eed327e0bad3 (BASE_FONTSET_P): Check FONTSET_BASE, not
Kenichi Handa <handa@m17n.org>
parents: 89349
diff changeset
393 char_table_set_range (fontset, from, to1, elt1);
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
394 from = to1 + 1;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
395 } while (from < to);
89069
c2201502f37e (fontset_add): Return Lisp_Object.
Dave Love <fx@gnu.org>
parents: 89006
diff changeset
396 return Qnil;
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
397 }
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
398
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
399
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
400 /* Update FONTSET_ELEMENT which has this form:
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
401 ( CHARSET-PRIORITY-LIST-TICK . FONT-VECTOR).
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
402 Reorder FONT-VECTOR according to the current order of charset
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
403 (Vcharset_ordered_list), and update CHARSET-PRIORITY-LIST-TICK to
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
404 the latest value. */
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
405
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
406 static void
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
407 reorder_font_vector (fontset_element)
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
408 Lisp_Object fontset_element;
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
409 {
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
410 Lisp_Object vec, list, *new_vec;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
411 int size;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
412 int *charset_id_table;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
413 int i, idx;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
414
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
415 XSETCAR (fontset_element, make_number (charset_ordered_list_tick));
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
416 vec = XCDR (fontset_element);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
417 size = ASIZE (vec);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
418 if (size < 2)
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
419 /* No need of reordering VEC. */
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
420 return;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
421 charset_id_table = (int *) alloca (sizeof (int) * size);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
422 new_vec = (Lisp_Object *) alloca (sizeof (Lisp_Object) * size);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
423 /* At first, extract ENCODING (a chaset ID) from VEC. VEC has this
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
424 form:
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
425 [[FACE-ID FONT-INDEX [ FONT-SPEC ENCODING REPERTORY ]] ...] */
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
426 for (i = 0; i < size; i++)
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
427 charset_id_table[i] = XINT (AREF (AREF (AREF (vec, i), 2), 1));
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
428
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
429 /* Then, store the elements of VEC in NEW_VEC in the correct
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
430 order. */
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
431 idx = 0;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
432 for (list = Vcharset_ordered_list; CONSP (list); list = XCDR (list))
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
433 {
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
434 for (i = 0; i < size; i++)
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
435 if (charset_id_table[i] == XINT (XCAR (list)))
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
436 new_vec[idx++] = AREF (vec, i);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
437 if (idx == size)
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
438 break;
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
439 }
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
440
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
441 /* At last, update VEC. */
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
442 for (i = 0; i < size; i++)
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
443 ASET (vec, i, new_vec[i]);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
444 }
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
445
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
446
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
447 /* Load a font matching the font related attributes in FACE->lface and
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
448 font pattern in FONT_DEF of FONTSET, and return an index of the
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
449 font. FONT_DEF has this form:
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
450 [ FONT-SPEC ENCODING REPERTORY ]
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
451 If REPERTORY is nil, generate a char-table representing the font
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
452 repertory by looking into the font itself. */
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
453
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
454 static int
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
455 load_font_get_repertory (f, face, font_def, fontset)
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
456 FRAME_PTR f;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
457 struct face *face;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
458 Lisp_Object font_def;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
459 Lisp_Object fontset;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
460 {
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
461 char *font_name;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
462 struct font_info *font_info;
89572
971778c2578c (load_font_get_repertory): Pay attention to the case
Kenichi Handa <handa@m17n.org>
parents: 89483
diff changeset
463 int charset;
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
464
89483
2f877ed80fa6 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88123 89428
diff changeset
465 font_name = choose_face_font (f, face->lface, AREF (font_def, 0), NULL);
89572
971778c2578c (load_font_get_repertory): Pay attention to the case
Kenichi Handa <handa@m17n.org>
parents: 89483
diff changeset
466 if (NATNUMP (AREF (font_def, 1)))
971778c2578c (load_font_get_repertory): Pay attention to the case
Kenichi Handa <handa@m17n.org>
parents: 89483
diff changeset
467 charset = XINT (AREF (font_def, 1));
971778c2578c (load_font_get_repertory): Pay attention to the case
Kenichi Handa <handa@m17n.org>
parents: 89483
diff changeset
468 else
971778c2578c (load_font_get_repertory): Pay attention to the case
Kenichi Handa <handa@m17n.org>
parents: 89483
diff changeset
469 charset = -1;
971778c2578c (load_font_get_repertory): Pay attention to the case
Kenichi Handa <handa@m17n.org>
parents: 89483
diff changeset
470 if (! (font_info = fs_load_font (f, font_name, charset)))
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
471 return -1;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
472
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
473 if (NILP (AREF (font_def, 2))
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
474 && NILP (Fassq (make_number (font_info->font_idx),
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
475 FONTSET_REPERTORY (fontset))))
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
476 {
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
477 /* We must look into the font to get the correct repertory as a
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
478 char-table. */
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
479 Lisp_Object repertory;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
480
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
481 repertory = (*get_font_repertory_func) (f, font_info);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
482 FONTSET_REPERTORY (fontset)
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
483 = Fcons (Fcons (make_number (font_info->font_idx), repertory),
89483
2f877ed80fa6 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88123 89428
diff changeset
484 FONTSET_REPERTORY (fontset));
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
485 }
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
486
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
487 return font_info->font_idx;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
488 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
489
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
490
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
491 /* Return a face ID registerd in the realized fontset FONTSET for the
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
492 character C. If FACE is NULL, return -1 if a face is not yet
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
493 set. Otherwise, realize a proper face from FACE and return it. */
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
494
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
495 static int
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
496 fontset_face (fontset, c, face)
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
497 Lisp_Object fontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
498 int c;
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
499 struct face *face;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
500 {
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
501 Lisp_Object base_fontset, elt, vec;
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
502 int i, from, to;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
503 int font_idx;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
504 FRAME_PTR f = XFRAME (FONTSET_FRAME (fontset));
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
505
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
506 base_fontset = FONTSET_BASE (fontset);
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
507 elt = CHAR_TABLE_REF (fontset, c);
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
508
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
509 if (EQ (elt, Qt))
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
510 goto try_default;
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
511
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
512 if (NILP (elt))
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
513 {
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
514 /* We have not yet decided a face for C. */
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
515 Lisp_Object range;
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
516
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
517 if (! face)
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
518 return -1;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
519 elt = FONTSET_REF_AND_RANGE (base_fontset, c, from, to);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
520 range = Fcons (make_number (from), make_number (to));
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
521 if (NILP (elt))
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
522 {
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
523 /* Record that we have no font for characters of this
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
524 range. */
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
525 FONTSET_SET (fontset, range, Qt);
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
526 goto try_default;
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
527 }
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
528 elt = Fcopy_sequence (elt);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
529 /* Now ELT is a vector of FONT-DEFs. We at first change it to
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
530 FONT-VECTOR, a vector of [ nil nil FONT-DEF ]. */
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
531 for (i = 0; i < ASIZE (elt); i++)
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
532 {
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
533 Lisp_Object tmp;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
534
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
535 tmp = Fmake_vector (make_number (3), Qnil);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
536 ASET (tmp, 2, AREF (elt, i));
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
537 ASET (elt, i, tmp);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
538 }
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
539 /* Then store (-1 . FONT-VECTOR) in the fontset. -1 is to force
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
540 reordering of FONT-VECTOR. */
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
541 elt = Fcons (make_number (-1), elt);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
542 FONTSET_SET (fontset, range, elt);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
543 }
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
544
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
545 if (XINT (XCAR (elt)) != charset_ordered_list_tick)
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
546 /* The priority of charsets is changed after we selected a face
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
547 for C last time. */
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
548 reorder_font_vector (elt);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
549
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
550 vec = XCDR (elt);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
551 /* Find the first available font in the font vector VEC. */
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
552 for (i = 0; i < ASIZE (vec); i++)
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
553 {
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
554 Lisp_Object font_def;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
555
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
556 elt = AREF (vec, i);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
557 /* ELT == [ FACE-ID FONT-INDEX [ FONT-SPEC ENCODING REPERTORY ] ] */
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
558 font_def = AREF (elt, 2);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
559 if (INTEGERP (AREF (elt, 1)) && XINT (AREF (elt, 1)) < 0)
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
560 /* We couldn't open this font last time. */
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
561 continue;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
562
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
563 if (!face && (NILP (AREF (elt, 1)) || NILP (AREF (elt, 0))))
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
564 /* We have not yet opened the font, or we have not yet made a
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
565 realized face for the font. */
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
566 return -1;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
567
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
568 if (INTEGERP (AREF (font_def, 2)))
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
569 {
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
570 /* The repertory is specified by charset ID. */
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
571 struct charset *charset
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
572 = CHARSET_FROM_ID (XINT (AREF (font_def, 2)));
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
573
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
574 if (! CHAR_CHARSET_P (c, charset))
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
575 /* This font can't display C. */
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
576 continue;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
577 }
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
578 else
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
579 {
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
580 Lisp_Object slot;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
581
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
582 if (! INTEGERP (AREF (elt, 1)))
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
583 {
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
584 /* We have not yet opened a font matching this spec.
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
585 Open the best matching font now and register the
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
586 repertory. */
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
587 font_idx = load_font_get_repertory (f, face, font_def, fontset);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
588 ASET (elt, 1, make_number (font_idx));
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
589 if (font_idx < 0)
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
590 /* This means that we couldn't find a font matching
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
591 FONT_DEF. */
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
592 continue;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
593 }
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
594
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
595 slot = Fassq (AREF (elt, 1), FONTSET_REPERTORY (fontset));
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
596 if (! CONSP (slot))
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
597 abort ();
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
598 if (NILP (CHAR_TABLE_REF (XCDR (slot), c)))
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
599 /* This fond can't display C. */
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
600 continue;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
601 }
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
602
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
603 /* Now we have decided to use this font spec to display C. */
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
604 if (INTEGERP (AREF (elt, 1)))
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
605 font_idx = XINT (AREF (elt, 1));
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
606 else
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
607 {
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
608 /* But not yet opened the best matching font. */
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
609 font_idx = load_font_get_repertory (f, face, font_def, fontset);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
610 ASET (elt, 1, make_number (font_idx));
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
611 if (font_idx < 0)
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
612 continue;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
613 }
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
614
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
615 /* Now we have the opened font. */
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
616 if (NILP (AREF (elt, 0)))
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
617 {
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
618 /* But not yet made a realized face that uses this font. */
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
619 int face_id = lookup_non_ascii_face (f, font_idx, face);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
620
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
621 ASET (elt, 0, make_number (face_id));
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
622 }
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
623
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
624 /* Ok, this face can display C. */
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
625 return XINT (AREF (elt, 0));
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
626 }
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
627
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
628 try_default:
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
629 if (! EQ (base_fontset, Vdefault_fontset))
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
630 return fontset_face (FONTSET_FALLBACK (fontset), c, face);
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
631
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
632 /* We have tried all the fonts for C, but none of them can be opened
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
633 nor can display C. */
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
634 if (NILP (FONTSET_NOFONT_FACE (fontset)))
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
635 {
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
636 int face_id;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
637
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
638 if (! face)
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
639 return -1;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
640 face_id = lookup_non_ascii_face (f, -1, face);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
641 FONTSET_NOFONT_FACE (fontset) = make_number (face_id);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
642 }
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
643 return XINT (FONTSET_NOFONT_FACE (fontset));
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
644 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
645
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
646
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
647 /* Return a newly created fontset with NAME. If BASE is nil, make a
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
648 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
649 BASE. */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
650
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
651 static Lisp_Object
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
652 make_fontset (frame, name, base)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
653 Lisp_Object frame, name, base;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
654 {
34975
0d69e2d2724e (fontset_ref): Remove unused variable `i'.
Eli Zaretskii <eliz@gnu.org>
parents: 32978
diff changeset
655 Lisp_Object fontset;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
656 int size = ASIZE (Vfontset_table);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
657 int id = next_fontset_id;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
658
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
659 /* 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
660 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
661 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
662 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
663 id. */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
664 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
665
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
666 if (id + 1 == size)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
667 {
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
668 /* We must grow Vfontset_table. */
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
669 Lisp_Object tem;
41987
34952771ae85 Fix typos, remove unnecessary space.
Pavel Janík <Pavel@Janik.cz>
parents: 41052
diff changeset
670 int i;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
671
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
672 tem = Fmake_vector (make_number (size + 32), Qnil);
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
673 for (i = 0; i < size; i++)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
674 AREF (tem, i) = AREF (Vfontset_table, i);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
675 Vfontset_table = tem;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
676 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
677
29767
c8e5453dc85d (FONTSET_ASCII): Use the first element of char table
Kenichi Handa <handa@m17n.org>
parents: 29501
diff changeset
678 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
679
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
680 FONTSET_ID (fontset) = make_number (id);
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
681 if (NILP (base))
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
682 {
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
683 FONTSET_NAME (fontset) = name;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
684 }
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
685 else
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
686 {
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
687 FONTSET_NAME (fontset) = Qnil;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
688 FONTSET_FRAME (fontset) = frame;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
689 FONTSET_BASE (fontset) = base;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
690 }
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
691
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
692 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
693 next_fontset_id = id + 1;
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
694 if (! NILP (base) && ! EQ (base, Vdefault_fontset))
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
695 FONTSET_FALLBACK (fontset) = make_fontset (frame, Qnil, Vdefault_fontset);
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
696 return fontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
697 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
698
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
699
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
700
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
701 /********** 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
702
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
703 /* 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
704
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
705 Lisp_Object
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
706 fontset_name (id)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
707 int id;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
708 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
709 Lisp_Object fontset;
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
710
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
711 fontset = FONTSET_FROM_ID (id);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
712 return FONTSET_NAME (fontset);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
713 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
714
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
715
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
716 /* 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
717
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
718 Lisp_Object
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
719 fontset_ascii (id)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
720 int id;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
721 {
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
722 Lisp_Object fontset, elt;
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
723
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
724 fontset= FONTSET_FROM_ID (id);
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
725 elt = FONTSET_ASCII (fontset);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
726 /* It is assured that ELT is always a string (i.e. fontname
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
727 pattern). */
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
728 return elt;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
729 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
730
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
731
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
732 /* Free fontset of FACE defined on frame F. Called from
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
733 free_realized_face. */
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
734
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
735 void
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
736 free_face_fontset (f, face)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
737 FRAME_PTR f;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
738 struct face *face;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
739 {
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
740 ASET (Vfontset_table, face->fontset, Qnil);
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
741 if (face->fontset < next_fontset_id)
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
742 next_fontset_id = face->fontset;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
743 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
744
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
745
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
746 /* Return 1 iff FACE is suitable for displaying character C.
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
747 Otherwise return 0. Called from the macro FACE_SUITABLE_FOR_CHAR_P
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
748 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
749
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
750 int
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
751 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
752 struct face *face;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
753 int c;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
754 {
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
755 Lisp_Object fontset;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
756
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
757 fontset = FONTSET_FROM_ID (face->fontset);
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
758 return (face->id == fontset_face (fontset, c, NULL));
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
759 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
760
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
761
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
762 /* 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
763 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
764 the macro FACE_FOR_CHAR. */
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
765
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
766 int
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
767 face_for_char (f, face, c)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
768 FRAME_PTR f;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
769 struct face *face;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
770 int c;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
771 {
88546
7471723e43b0 (Fclear_face_cache): Declare.
Dave Love <fx@gnu.org>
parents: 88500
diff changeset
772 Lisp_Object fontset;
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
773
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
774 if (ASCII_CHAR_P (c))
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
775 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
776
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
777 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
778 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
779 xassert (!BASE_FONTSET_P (fontset));
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
780 return fontset_face (fontset, c, face);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
781 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
782
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
783
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
784 /* 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
785 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
786 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
787 Called from realize_x_face. */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
788
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
789 int
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
790 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
791 FRAME_PTR f;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
792 int base_fontset_id;
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
793 struct face *face;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
794 {
34975
0d69e2d2724e (fontset_ref): Remove unused variable `i'.
Eli Zaretskii <eliz@gnu.org>
parents: 32978
diff changeset
795 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
796
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
797 XSETFRAME (frame, f);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
798 if (base_fontset_id >= 0)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
799 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
800 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
801 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
802 base_fontset = FONTSET_BASE (base_fontset);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
803 xassert (BASE_FONTSET_P (base_fontset));
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
804 if (! BASE_FONTSET_P (base_fontset))
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
805 abort ();
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
806 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
807 else
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
808 base_fontset = Vdefault_fontset;
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 fontset = make_fontset (frame, Qnil, base_fontset);
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
811 {
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
812 Lisp_Object elt;
41987
34952771ae85 Fix typos, remove unnecessary space.
Pavel Janík <Pavel@Janik.cz>
parents: 41052
diff changeset
813
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
814 elt = FONTSET_REF (base_fontset, 0);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
815 elt = Fmake_vector (make_number (3), AREF (elt, 0));
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
816 ASET (elt, 0, make_number (face->id));
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
817 ASET (elt, 1, make_number (face->font_info_id));
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
818 elt = Fcons (make_number (charset_ordered_list_tick),
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
819 Fmake_vector (make_number (1), elt));
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
820 char_table_set_range (fontset, 0, 127, elt);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
821 }
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
822 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
823 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
824
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
825
40028
392c2fe9edd7 (fs_load_font) [WINDOWSNT && _MSC_VER]: Disable
Andrew Innes <andrewi@gnu.org>
parents: 39973
diff changeset
826 #if defined(WINDOWSNT) && defined (_MSC_VER)
392c2fe9edd7 (fs_load_font) [WINDOWSNT && _MSC_VER]: Disable
Andrew Innes <andrewi@gnu.org>
parents: 39973
diff changeset
827 #pragma optimize("", off)
392c2fe9edd7 (fs_load_font) [WINDOWSNT && _MSC_VER]: Disable
Andrew Innes <andrewi@gnu.org>
parents: 39973
diff changeset
828 #endif
392c2fe9edd7 (fs_load_font) [WINDOWSNT && _MSC_VER]: Disable
Andrew Innes <andrewi@gnu.org>
parents: 39973
diff changeset
829
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
830 /* Load a font named FONTNAME on frame F. Return a pointer to the
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
831 struct font_info of the loaded font. If loading fails, return
88968
a35b7b45baa3 (fs_load_font): If fontp->charset is not negative,
Kenichi Handa <handa@m17n.org>
parents: 88931
diff changeset
832 NULL. CHARSET is an ID of charset to encode characters for this
a35b7b45baa3 (fs_load_font): If fontp->charset is not negative,
Kenichi Handa <handa@m17n.org>
parents: 88931
diff changeset
833 font. If it is -1, find one from Vfont_encoding_alist. */
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
834
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
835 struct font_info *
88968
a35b7b45baa3 (fs_load_font): If fontp->charset is not negative,
Kenichi Handa <handa@m17n.org>
parents: 88931
diff changeset
836 fs_load_font (f, fontname, charset)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
837 FRAME_PTR f;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
838 char *fontname;
88968
a35b7b45baa3 (fs_load_font): If fontp->charset is not negative,
Kenichi Handa <handa@m17n.org>
parents: 88931
diff changeset
839 int charset;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
840 {
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
841 struct font_info *fontp;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
842
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
843 if (!fontname)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
844 /* No way to get fontname. */
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
845 return NULL;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
846
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
847 fontp = (*load_font_func) (f, fontname, 0);
88968
a35b7b45baa3 (fs_load_font): If fontp->charset is not negative,
Kenichi Handa <handa@m17n.org>
parents: 88931
diff changeset
848 if (! fontp || fontp->charset >= 0)
a35b7b45baa3 (fs_load_font): If fontp->charset is not negative,
Kenichi Handa <handa@m17n.org>
parents: 88931
diff changeset
849 return fontp;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
850
88500
3d67875ee2b1 (fs_load_font): Check fontp->full_name (not fontname)
Kenichi Handa <handa@m17n.org>
parents: 88482
diff changeset
851 fontname = fontp->full_name;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
852
88968
a35b7b45baa3 (fs_load_font): If fontp->charset is not negative,
Kenichi Handa <handa@m17n.org>
parents: 88931
diff changeset
853 if (charset < 0)
a35b7b45baa3 (fs_load_font): If fontp->charset is not negative,
Kenichi Handa <handa@m17n.org>
parents: 88931
diff changeset
854 {
a35b7b45baa3 (fs_load_font): If fontp->charset is not negative,
Kenichi Handa <handa@m17n.org>
parents: 88931
diff changeset
855 Lisp_Object charset_symbol;
a35b7b45baa3 (fs_load_font): If fontp->charset is not negative,
Kenichi Handa <handa@m17n.org>
parents: 88931
diff changeset
856
a35b7b45baa3 (fs_load_font): If fontp->charset is not negative,
Kenichi Handa <handa@m17n.org>
parents: 88931
diff changeset
857 charset_symbol = find_font_encoding (fontname);
a35b7b45baa3 (fs_load_font): If fontp->charset is not negative,
Kenichi Handa <handa@m17n.org>
parents: 88931
diff changeset
858 if (CONSP (charset_symbol))
a35b7b45baa3 (fs_load_font): If fontp->charset is not negative,
Kenichi Handa <handa@m17n.org>
parents: 88931
diff changeset
859 charset_symbol = XCAR (charset_symbol);
a35b7b45baa3 (fs_load_font): If fontp->charset is not negative,
Kenichi Handa <handa@m17n.org>
parents: 88931
diff changeset
860 charset = XINT (CHARSET_SYMBOL_ID (charset_symbol));
a35b7b45baa3 (fs_load_font): If fontp->charset is not negative,
Kenichi Handa <handa@m17n.org>
parents: 88931
diff changeset
861 }
a35b7b45baa3 (fs_load_font): If fontp->charset is not negative,
Kenichi Handa <handa@m17n.org>
parents: 88931
diff changeset
862 fontp->charset = charset;
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
863 fontp->vertical_centering = 0;
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
864 fontp->font_encoder = NULL;
21553
2d7afcd11b72 (find_ccl_program_func): New variable.
Kenichi Handa <handa@m17n.org>
parents: 21514
diff changeset
865
88968
a35b7b45baa3 (fs_load_font): If fontp->charset is not negative,
Kenichi Handa <handa@m17n.org>
parents: 88931
diff changeset
866 if (charset != charset_ascii)
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
867 {
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
868 fontp->vertical_centering
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
869 = (STRINGP (Vvertical_centering_font_regexp)
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
870 && (fast_c_string_match_ignore_case
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
871 (Vvertical_centering_font_regexp, fontname) >= 0));
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
872
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
873 if (find_ccl_program_func)
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
874 (*find_ccl_program_func) (fontp);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
875 }
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
876
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
877 return fontp;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
878 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
879
40028
392c2fe9edd7 (fs_load_font) [WINDOWSNT && _MSC_VER]: Disable
Andrew Innes <andrewi@gnu.org>
parents: 39973
diff changeset
880 #if defined(WINDOWSNT) && defined (_MSC_VER)
392c2fe9edd7 (fs_load_font) [WINDOWSNT && _MSC_VER]: Disable
Andrew Innes <andrewi@gnu.org>
parents: 39973
diff changeset
881 #pragma optimize("", on)
392c2fe9edd7 (fs_load_font) [WINDOWSNT && _MSC_VER]: Disable
Andrew Innes <andrewi@gnu.org>
parents: 39973
diff changeset
882 #endif
392c2fe9edd7 (fs_load_font) [WINDOWSNT && _MSC_VER]: Disable
Andrew Innes <andrewi@gnu.org>
parents: 39973
diff changeset
883
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
884
88968
a35b7b45baa3 (fs_load_font): If fontp->charset is not negative,
Kenichi Handa <handa@m17n.org>
parents: 88931
diff changeset
885 /* Return ENCODING or a cons of ENCODING and REPERTORY of the font
a35b7b45baa3 (fs_load_font): If fontp->charset is not negative,
Kenichi Handa <handa@m17n.org>
parents: 88931
diff changeset
886 FONTNAME. ENCODING is a charset symbol that specifies the encoding
a35b7b45baa3 (fs_load_font): If fontp->charset is not negative,
Kenichi Handa <handa@m17n.org>
parents: 88931
diff changeset
887 of the font. REPERTORY is a charset symbol or nil. */
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
888
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
889
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
890 static Lisp_Object
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
891 find_font_encoding (fontname)
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
892 char *fontname;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
893 {
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
894 Lisp_Object tail, elt;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
895
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
896 for (tail = Vfont_encoding_alist; CONSP (tail); tail = XCDR (tail))
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
897 {
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
898 elt = XCAR (tail);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
899 if (CONSP (elt)
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
900 && STRINGP (XCAR (elt))
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
901 && fast_c_string_match_ignore_case (XCAR (elt), fontname) >= 0
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
902 && (SYMBOLP (XCDR (elt))
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
903 ? CHARSETP (XCDR (elt))
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
904 : CONSP (XCDR (elt)) && CHARSETP (XCAR (XCDR (elt)))))
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
905 return (XCDR (elt));
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
906 }
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
907 /* We don't know the encoding of this font. Let's assume Unicode
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
908 encoding. */
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
909 return Qunicode;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
910 }
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
911
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
912
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
913 /* Cache data used by fontset_pattern_regexp. The car part is a
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
914 pattern string containing at least one wild card, the cdr part is
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
915 the corresponding regular expression. */
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
916 static Lisp_Object Vcached_fontset_data;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
917
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 45848
diff changeset
918 #define CACHED_FONTSET_NAME (SDATA (XCAR (Vcached_fontset_data)))
26164
d39ec0a27081 more XCAR/XCDR/XFLOAT_DATA uses, to help isolete lisp engine
Ken Raeburn <raeburn@raeburn.org>
parents: 25668
diff changeset
919 #define CACHED_FONTSET_REGEX (XCDR (Vcached_fontset_data))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
920
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
921 /* If fontset name PATTERN contains any wild card, return regular
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
922 expression corresponding to PATTERN. */
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
923
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
924 static Lisp_Object
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
925 fontset_pattern_regexp (pattern)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
926 Lisp_Object pattern;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
927 {
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 45848
diff changeset
928 if (!index (SDATA (pattern), '*')
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 45848
diff changeset
929 && !index (SDATA (pattern), '?'))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
930 /* PATTERN does not contain any wild cards. */
17730
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
931 return Qnil;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
932
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
933 if (!CONSP (Vcached_fontset_data)
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 45848
diff changeset
934 || strcmp (SDATA (pattern), CACHED_FONTSET_NAME))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
935 {
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
936 /* We must at first update the cached data. */
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 45848
diff changeset
937 char *regex = (char *) alloca (SCHARS (pattern) * 2 + 3);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
938 char *p0, *p1 = regex;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
939
17730
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
940 /* Convert "*" to ".*", "?" to ".". */
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
941 *p1++ = '^';
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 45848
diff changeset
942 for (p0 = (char *) SDATA (pattern); *p0; p0++)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
943 {
17730
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
944 if (*p0 == '*')
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
945 {
17730
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
946 *p1++ = '.';
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
947 *p1++ = '*';
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
948 }
17730
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
949 else if (*p0 == '?')
21127
577865651099 (fontset_pattern_regexp): `==' was used instead of `='.
Richard M. Stallman <rms@gnu.org>
parents: 20346
diff changeset
950 *p1++ = '.';
17730
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
951 else
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
952 *p1++ = *p0;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
953 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
954 *p1++ = '$';
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
955 *p1++ = 0;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
956
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 45848
diff changeset
957 Vcached_fontset_data = Fcons (build_string (SDATA (pattern)),
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
958 build_string (regex));
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
959 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
960
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
961 return CACHED_FONTSET_REGEX;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
962 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
963
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
964 /* Return ID of the base fontset named NAME. If there's no such
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
965 fontset, return -1. */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
966
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
967 int
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
968 fs_query_fontset (name, regexpp)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
969 Lisp_Object name;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
970 int regexpp;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
971 {
34975
0d69e2d2724e (fontset_ref): Remove unused variable `i'.
Eli Zaretskii <eliz@gnu.org>
parents: 32978
diff changeset
972 Lisp_Object tem;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
973 int i;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
974
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
975 name = Fdowncase (name);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
976 if (!regexpp)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
977 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
978 tem = Frassoc (name, Vfontset_alias_alist);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
979 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
980 name = XCAR (tem);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
981 else
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
982 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
983 tem = fontset_pattern_regexp (name);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
984 if (STRINGP (tem))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
985 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
986 name = tem;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
987 regexpp = 1;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
988 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
989 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
990 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
991
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
992 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
993 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
994 Lisp_Object fontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
995 unsigned char *this_name;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
996
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
997 fontset = FONTSET_FROM_ID (i);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
998 if (NILP (fontset)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
999 || !BASE_FONTSET_P (fontset))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1000 continue;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1001
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 45848
diff changeset
1002 this_name = SDATA (FONTSET_NAME (fontset));
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1003 if (regexpp
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1004 ? fast_c_string_match_ignore_case (name, this_name) >= 0
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 45848
diff changeset
1005 : !strcmp (SDATA (name), this_name))
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1006 return i;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1007 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1008 return -1;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1009 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1010
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1011
21553
2d7afcd11b72 (find_ccl_program_func): New variable.
Kenichi Handa <handa@m17n.org>
parents: 21514
diff changeset
1012 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
1013 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
1014 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
1015 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
1016 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
1017 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
1018 (pattern, regexpp)
21553
2d7afcd11b72 (find_ccl_program_func): New variable.
Kenichi Handa <handa@m17n.org>
parents: 21514
diff changeset
1019 Lisp_Object pattern, regexpp;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1020 {
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1021 Lisp_Object fontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1022 int id;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1023
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1024 (*check_window_system_func) ();
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1025
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40028
diff changeset
1026 CHECK_STRING (pattern);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1027
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 45848
diff changeset
1028 if (SCHARS (pattern) == 0)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1029 return Qnil;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1030
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1031 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
1032 if (id < 0)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1033 return Qnil;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1034
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1035 fontset = FONTSET_FROM_ID (id);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1036 return FONTSET_NAME (fontset);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1037 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1038
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1039 /* Return a list of base fontset names matching PATTERN on frame F. */
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1040
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1041 Lisp_Object
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1042 list_fontsets (f, pattern, size)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1043 FRAME_PTR f;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1044 Lisp_Object pattern;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1045 int size;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1046 {
34975
0d69e2d2724e (fontset_ref): Remove unused variable `i'.
Eli Zaretskii <eliz@gnu.org>
parents: 32978
diff changeset
1047 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
1048 int id;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1049
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1050 XSETFRAME (frame, f);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1051
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1052 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
1053 val = Qnil;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1054
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1055 for (id = 0; id < ASIZE (Vfontset_table); id++)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1056 {
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1057 Lisp_Object fontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1058 unsigned char *name;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1059
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1060 fontset = FONTSET_FROM_ID (id);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1061 if (NILP (fontset)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1062 || !BASE_FONTSET_P (fontset)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1063 || !EQ (frame, FONTSET_FRAME (fontset)))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1064 continue;
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 45848
diff changeset
1065 name = SDATA (FONTSET_NAME (fontset));
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1066
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1067 if (STRINGP (regexp)
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1068 ? (fast_c_string_match_ignore_case (regexp, name) < 0)
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 45848
diff changeset
1069 : strcmp (SDATA (pattern), name))
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1070 continue;
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 val = Fcons (Fcopy_sequence (FONTSET_NAME (fontset)), val);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1073 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1074
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1075 return val;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1076 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1077
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1078
89483
2f877ed80fa6 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88123 89428
diff changeset
1079 /* Free all realized fontsets whose base fontset is BASE. */
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1080
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1081 static void
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1082 free_realized_fontsets (base)
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1083 Lisp_Object base;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1084 {
88546
7471723e43b0 (Fclear_face_cache): Declare.
Dave Love <fx@gnu.org>
parents: 88500
diff changeset
1085 #if 0
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1086 int id;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1087
88482
effba1417b74 (free_realized_fontsets): Call Fclear_face_cache instead
Kenichi Handa <handa@m17n.org>
parents: 88405
diff changeset
1088 /* 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
1089 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
1090 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
1091 that is not efficient. */
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1092 BLOCK_INPUT;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1093 for (id = 0; id < ASIZE (Vfontset_table); id++)
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1094 {
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1095 Lisp_Object this = AREF (Vfontset_table, id);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1096
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1097 if (EQ (FONTSET_BASE (this), base))
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1098 {
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1099 Lisp_Object tail;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1100
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1101 for (tail = FONTSET_FACE_ALIST (this); CONSP (tail);
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1102 tail = XCDR (tail))
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1103 {
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1104 FRAME_PTR f = XFRAME (FONTSET_FRAME (this));
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1105 int face_id = XINT (XCDR (XCAR (tail)));
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1106 struct face *face = FACE_FROM_ID (f, face_id);
89483
2f877ed80fa6 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88123 89428
diff changeset
1107
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1108 /* Face THIS itself is also freed by the following call. */
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1109 free_realized_face (f, face);
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1110 }
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1111 }
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1112 }
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1113 UNBLOCK_INPUT;
88482
effba1417b74 (free_realized_fontsets): Call Fclear_face_cache instead
Kenichi Handa <handa@m17n.org>
parents: 88405
diff changeset
1114 #else /* not 0 */
effba1417b74 (free_realized_fontsets): Call Fclear_face_cache instead
Kenichi Handa <handa@m17n.org>
parents: 88405
diff changeset
1115 Fclear_face_cache (Qt);
effba1417b74 (free_realized_fontsets): Call Fclear_face_cache instead
Kenichi Handa <handa@m17n.org>
parents: 88405
diff changeset
1116 #endif /* not 0 */
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1117 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1118
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1119
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1120 /* 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
1121 corresponding fontset. If not valid, signal an error.
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1122 If NAME is t, return Vdefault_fontset. */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1123
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1124 static Lisp_Object
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1125 check_fontset_name (name)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1126 Lisp_Object name;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1127 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1128 int id;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1129
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1130 if (EQ (name, Qt))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1131 return Vdefault_fontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1132
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40028
diff changeset
1133 CHECK_STRING (name);
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1134 id = fs_query_fontset (name, 0);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1135 if (id < 0)
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 45848
diff changeset
1136 error ("Fontset `%s' does not exist", SDATA (name));
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1137 return FONTSET_FROM_ID (id);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1138 }
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1139
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1140 static void
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1141 accumulate_script_ranges (arg, range, val)
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1142 Lisp_Object arg, range, val;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1143 {
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1144 if (EQ (XCAR (arg), val))
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1145 {
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1146 if (CONSP (range))
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1147 XSETCDR (arg, Fcons (Fcons (XCAR (range), XCDR (range)), XCDR (arg)));
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1148 else
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1149 XSETCDR (arg, Fcons (Fcons (range, range), XCDR (arg)));
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1150 }
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1151 }
41001
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1152
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1153
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1154 /* Return an ASCII font name generated from fontset name NAME and
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1155 ASCII font specification ASCII_SPEC. NAME is a string conforming
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1156 to XLFD. ASCII_SPEC is a vector:
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1157 [FAMILY WEIGHT SLANT SWIDTH ADSTYLE REGISTRY]. */
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1158
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1159 static INLINE Lisp_Object
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1160 generate_ascii_font_name (name, ascii_spec)
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1161 Lisp_Object name, ascii_spec;
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1162 {
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1163 Lisp_Object vec;
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1164 int i;
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1165
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1166 vec = split_font_name_into_vector (name);
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1167 for (i = FONT_SPEC_FAMILY_INDEX; i <= FONT_SPEC_ADSTYLE_INDEX; i++)
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1168 if (! NILP (AREF (ascii_spec, i)))
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1169 ASET (vec, 1 + i, AREF (ascii_spec, i));
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1170 if (! NILP (AREF (ascii_spec, FONT_SPEC_REGISTRY_INDEX)))
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1171 ASET (vec, 12, AREF (ascii_spec, FONT_SPEC_REGISTRY_INDEX));
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1172 return build_font_name_from_vector (vec);
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1173 }
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1174
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1175
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1176 DEFUN ("set-fontset-font", Fset_fontset_font, Sset_fontset_font, 3, 5, 0,
89483
2f877ed80fa6 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88123 89428
diff changeset
1177 doc: /*
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1178 Modify fontset NAME to use FONT-SPEC for CHARACTER.
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1179
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1180 CHARACTER may be a cons; (FROM . TO), where FROM and TO are
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1181 characters. In that case, use FONT-SPEC for all characters in the
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1182 range FROM and TO (inclusive).
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1183
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1184 CHARACTER may be a script name symbol. In that case, use FONT-SPEC
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1185 for all characters that belong to the script.
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1186
88931
74d18470865c (fontset_add): Declare args. Call make_number
Dave Love <fx@gnu.org>
parents: 88903
diff changeset
1187 CHARACTER may be a charset which has a :code-offset attribute and the
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1188 attribute value is greater than the maximum Unicode character
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1189 \(#x10FFFF). In that case, use FONT-SPEC for all characters in the
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1190 charset.
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1191
88931
74d18470865c (fontset_add): Declare args. Call make_number
Dave Love <fx@gnu.org>
parents: 88903
diff changeset
1192 FONT-SPEC may be:
74d18470865c (fontset_add): Declare args. Call make_number
Dave Love <fx@gnu.org>
parents: 88903
diff changeset
1193 * A vector [ FAMILY WEIGHT SLANT WIDTH ADSTYLE REGISTRY ].
74d18470865c (fontset_add): Declare args. Call make_number
Dave Love <fx@gnu.org>
parents: 88903
diff changeset
1194 See the documentation of `set-face-attribute' for the detail of
74d18470865c (fontset_add): Declare args. Call make_number
Dave Love <fx@gnu.org>
parents: 88903
diff changeset
1195 these vector elements;
89337
6026c8e5664f (Fset_fontset_font): Fix indentation of docstring.
Kenichi Handa <handa@m17n.org>
parents: 89069
diff changeset
1196 * A cons (FAMILY . REGISTRY), where FAMILY is a font family name and
88931
74d18470865c (fontset_add): Declare args. Call make_number
Dave Love <fx@gnu.org>
parents: 88903
diff changeset
1197 REGISTRY is a font registry name;
74d18470865c (fontset_add): Declare args. Call make_number
Dave Love <fx@gnu.org>
parents: 88903
diff changeset
1198 * A font name string.
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1199
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1200 Optional 4th argument FRAME, if non-nil, is a frame. This argument is
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1201 kept for backward compatibility and has no meaning.
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1202
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1203 Optional 5th argument ADD, if non-nil, specifies how to add FONT-SPEC
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1204 to the font specifications for RANGE previously set. If it is
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1205 `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
1206 appended. By default, FONT-SPEC overrides the previous settings. */)
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1207 (name, character, font_spec, frame, add)
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1208 Lisp_Object name, character, font_spec, frame, add;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1209 {
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1210 Lisp_Object fontset;
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1211 Lisp_Object font_def, registry;
88931
74d18470865c (fontset_add): Declare args. Call make_number
Dave Love <fx@gnu.org>
parents: 88903
diff changeset
1212 Lisp_Object encoding, repertory;
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1213 Lisp_Object range_list;
28223
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 fontset = check_fontset_name (name);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1216
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1217 /* The arg FRAME is kept for backward compatibility. We only check
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1218 the validity. */
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1219 if (!NILP (frame))
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40028
diff changeset
1220 CHECK_LIVE_FRAME (frame);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1221
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1222 if (VECTORP (font_spec))
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1223 {
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1224 int j;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1225
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1226 if (ASIZE (font_spec) != FONT_SPEC_MAX_INDEX)
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1227 args_out_of_range (make_number (FONT_SPEC_MAX_INDEX),
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1228 make_number (ASIZE (font_spec)));
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1229
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1230 font_spec = Fcopy_sequence (font_spec);
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1231 for (j = 0; j < FONT_SPEC_MAX_INDEX - 1; j++)
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1232 if (! NILP (AREF (font_spec, j)))
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1233 {
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1234 CHECK_STRING (AREF (font_spec, j));
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1235 ASET (font_spec, j, Fdowncase (AREF (font_spec, j)));
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1236 }
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1237 /* REGISTRY should not be omitted. */
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1238 CHECK_STRING (AREF (font_spec, FONT_SPEC_REGISTRY_INDEX));
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1239 registry = Fdowncase (AREF (font_spec, FONT_SPEC_REGISTRY_INDEX));
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1240 ASET (font_spec, FONT_SPEC_REGISTRY_INDEX, registry);
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1241
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1242 }
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1243 else if (CONSP (font_spec))
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1244 {
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1245 Lisp_Object family;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1246
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1247 family = XCAR (font_spec);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1248 registry = XCDR (font_spec);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1249
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1250 if (! NILP (family))
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1251 {
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1252 CHECK_STRING (family);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1253 family = Fdowncase (family);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1254 }
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1255 CHECK_STRING (registry);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1256 registry = Fdowncase (registry);
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1257 font_spec = Fmake_vector (make_number (FONT_SPEC_MAX_INDEX), Qnil);
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1258 ASET (font_spec, FONT_SPEC_FAMILY_INDEX, family);
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1259 ASET (font_spec, FONT_SPEC_REGISTRY_INDEX, registry);
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1260 }
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1261 else
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1262 {
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1263 CHECK_STRING (font_spec);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1264 font_spec = Fdowncase (font_spec);
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1265 registry = split_font_name_into_vector (font_spec);
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1266 if (NILP (registry))
89483
2f877ed80fa6 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88123 89428
diff changeset
1267 error ("No XLFD: %s", SDATA (font_spec));
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1268 if (NILP (AREF (registry, 12))
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1269 || NILP (AREF (registry, 13)))
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1270 error ("Registry must be specified");
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1271 registry = concat2 (concat2 (AREF (registry, 12), build_string ("-")),
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1272 AREF (registry, 13));
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1273 }
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1274
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1275 if (STRINGP (font_spec))
89483
2f877ed80fa6 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88123 89428
diff changeset
1276 encoding = find_font_encoding ((char *) SDATA (font_spec));
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1277 else
89483
2f877ed80fa6 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88123 89428
diff changeset
1278 encoding = find_font_encoding ((char *) SDATA (registry));
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1279 if (SYMBOLP (encoding))
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1280 encoding = repertory = CHARSET_SYMBOL_ID (encoding);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1281 else
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1282 {
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1283 repertory = XCDR (encoding);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1284 encoding = CHARSET_SYMBOL_ID (XCAR (encoding));
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1285 }
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1286 font_def = Fmake_vector (make_number (3), font_spec);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1287 ASET (font_def, 1, encoding);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1288 ASET (font_def, 2, repertory);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1289
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1290 if (CHARACTERP (character))
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1291 range_list = Fcons (Fcons (character, character), Qnil);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1292 else if (CONSP (character))
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1293 {
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1294 Lisp_Object from, to;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1295
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1296 from = Fcar (character);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1297 to = Fcdr (character);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1298 CHECK_CHARACTER (from);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1299 CHECK_CHARACTER (to);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1300 range_list = Fcons (character, Qnil);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1301 }
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1302 else
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1303 {
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1304 Lisp_Object script_list;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1305 Lisp_Object val;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1306
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1307 CHECK_SYMBOL (character);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1308 range_list = Qnil;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1309 script_list = XCHAR_TABLE (Vchar_script_table)->extras[0];
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1310 if (! NILP (Fmemq (character, script_list)))
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1311 {
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1312 val = Fcons (character, Qnil);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1313 map_char_table (accumulate_script_ranges, Qnil, Vchar_script_table,
89483
2f877ed80fa6 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88123 89428
diff changeset
1314 val);
2f877ed80fa6 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88123 89428
diff changeset
1315 range_list = XCDR (val);
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1316 }
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1317 else if (CHARSETP (character))
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1318 {
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1319 struct charset *charset;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1320
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1321 CHECK_CHARSET_GET_CHARSET (character, charset);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1322 if (CHARSET_METHOD (charset) == CHARSET_METHOD_OFFSET)
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1323 range_list
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1324 = Fcons (Fcons (make_number (CHARSET_MIN_CHAR (charset)),
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1325 make_number (CHARSET_MAX_CHAR (charset))),
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1326 range_list);
89006
faa38aebf129 (Fset_fontset_font): Treate `ascii' as charset, not script.
Kenichi Handa <handa@m17n.org>
parents: 88982
diff changeset
1327 if (EQ (character, Qascii))
faa38aebf129 (Fset_fontset_font): Treate `ascii' as charset, not script.
Kenichi Handa <handa@m17n.org>
parents: 88982
diff changeset
1328 {
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1329 if (VECTORP (font_spec))
89006
faa38aebf129 (Fset_fontset_font): Treate `ascii' as charset, not script.
Kenichi Handa <handa@m17n.org>
parents: 88982
diff changeset
1330 font_spec = generate_ascii_font_name (FONTSET_NAME (fontset),
faa38aebf129 (Fset_fontset_font): Treate `ascii' as charset, not script.
Kenichi Handa <handa@m17n.org>
parents: 88982
diff changeset
1331 font_spec);
faa38aebf129 (Fset_fontset_font): Treate `ascii' as charset, not script.
Kenichi Handa <handa@m17n.org>
parents: 88982
diff changeset
1332 FONTSET_ASCII (fontset) = font_spec;
faa38aebf129 (Fset_fontset_font): Treate `ascii' as charset, not script.
Kenichi Handa <handa@m17n.org>
parents: 88982
diff changeset
1333 }
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1334 }
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1335
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1336 if (NILP (range_list))
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1337 error ("Invalid script or charset name: %s",
89483
2f877ed80fa6 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88123 89428
diff changeset
1338 SDATA (SYMBOL_NAME (character)));
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1339 }
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1340
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1341 for (; CONSP (range_list); range_list = XCDR (range_list))
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1342 FONTSET_ADD (fontset, XCAR (range_list), font_def, add);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1343
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1344 /* Free all realized fontsets whose base is FONTSET. This way, the
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1345 specified character(s) are surely redisplayed by a correct
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1346 font. */
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1347 free_realized_fontsets (fontset);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1348
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1349 return Qnil;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1350 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1351
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1352
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1353 DEFUN ("new-fontset", Fnew_fontset, Snew_fontset, 2, 2, 0,
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1354 doc: /* Create a new fontset NAME from font information in FONTLIST.
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1355
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1356 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
1357 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
1358 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
1359 FONT-SPEC.
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1360
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1361 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
1362 char-table `char-script-table'.
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1363
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1364 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
1365 `set-fontset-font' for the meaning. */)
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1366 (name, fontlist)
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1367 Lisp_Object name, fontlist;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1368 {
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1369 Lisp_Object fontset;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1370 Lisp_Object val;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1371 int id;
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1372
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1373 CHECK_STRING (name);
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1374 CHECK_LIST (fontlist);
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1375
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1376 id = fs_query_fontset (name, 0);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1377 if (id < 0)
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1378 {
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1379 name = Fdowncase (name);
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1380 val = split_font_name_into_vector (name);
89603
7f9f2d025eee (Fnew_fontset): Check NAME more rigidly.
Kenichi Handa <handa@m17n.org>
parents: 89572
diff changeset
1381 if (NILP (val) || NILP (AREF (val, 12)) || NILP (AREF (val, 13)))
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1382 error ("Fontset name must be in XLFD format");
89483
2f877ed80fa6 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88123 89428
diff changeset
1383 if (strcmp (SDATA (AREF (val, 12)), "fontset"))
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1384 error ("Registry field of fontset name must be \"fontset\"");
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1385 Vfontset_alias_alist
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1386 = Fcons (Fcons (name,
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1387 concat2 (concat2 (AREF (val, 12), build_string ("-")),
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1388 AREF (val, 13))),
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1389 Vfontset_alias_alist);
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1390 ASET (val, 12, build_string ("iso8859-1"));
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1391 fontset = make_fontset (Qnil, name, Qnil);
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1392 FONTSET_ASCII (fontset) = build_font_name_from_vector (val);
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1393 }
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1394 else
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1395 {
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1396 fontset = FONTSET_FROM_ID (id);;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1397 free_realized_fontsets (fontset);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1398 Fset_char_table_range (fontset, Qt, Qnil);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1399 }
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1400
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1401 for (; ! NILP (fontlist); fontlist = Fcdr (fontlist))
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1402 {
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1403 Lisp_Object elt, script;
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1404
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1405 elt = Fcar (fontlist);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1406 script = Fcar (elt);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1407 for (elt = Fcdr (elt); ! NILP (elt); elt = Fcdr (elt))
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1408 Fset_fontset_font (name, script, Fcar (elt), Qnil, Qappend);
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1409 }
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1410 return name;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1411 }
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1412
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1413
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1414 /* Number of fontsets created from a fontname automatically. */
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1415 static int n_auto_fontsets;
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1416
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1417 int
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1418 new_fontset_from_font_name (Lisp_Object fontname)
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1419 {
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1420 Lisp_Object name;
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1421 Lisp_Object vec;
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1422
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1423 fontname = Fdowncase (fontname);
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1424 vec = split_font_name_into_vector (fontname);
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1425 if ( NILP (vec))
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1426 vec = Fmake_vector (make_number (14), build_string (""));
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1427 ASET (vec, 12, build_string ("fontset"));
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1428 if (n_auto_fontsets == 0)
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1429 {
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1430 ASET (vec, 13, build_string ("startup"));
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1431 name = build_font_name_from_vector (vec);
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1432 n_auto_fontsets++;
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1433 }
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1434 else
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1435 {
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1436 char temp[20];
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1437
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1438 do {
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1439 sprintf (temp, "auto%d", n_auto_fontsets);
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1440 ASET (vec, 13, build_string (temp));
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1441 name = build_font_name_from_vector (vec);
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1442 n_auto_fontsets++;
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1443 } while (fs_query_fontset (name, 0) >= 0);
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1444 }
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1445 name = Fnew_fontset (name,
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1446 Fcons (Fcons (Qascii, Fcons (fontname, Qnil)), Qnil));
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1447 Vfontset_alias_alist = Fcons (Fcons (name, fontname), Vfontset_alias_alist);
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1448 return fs_query_fontset (name, 0);
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1449 }
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1450
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1451
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1452 DEFUN ("font-info", Ffont_info, Sfont_info, 1, 2, 0,
41001
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1453 doc: /* Return information about a font named NAME on frame FRAME.
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1454 If FRAME is omitted or nil, use the selected frame.
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1455 The returned value is a vector of OPENED-NAME, FULL-NAME, CHARSET, SIZE,
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1456 HEIGHT, BASELINE-OFFSET, RELATIVE-COMPOSE, and DEFAULT-ASCENT,
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1457 where
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1458 OPENED-NAME is the name used for opening the font,
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1459 FULL-NAME is the full name of the font,
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1460 SIZE is the maximum bound width of the font,
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1461 HEIGHT is the height of the font,
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1462 BASELINE-OFFSET is the upward offset pixels from ASCII baseline,
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1463 RELATIVE-COMPOSE and DEFAULT-ASCENT are the numbers controlling
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1464 how to compose characters.
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1465 If the named font is not yet loaded, return nil. */)
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1466 (name, frame)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1467 Lisp_Object name, frame;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1468 {
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1469 FRAME_PTR f;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1470 struct font_info *fontp;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1471 Lisp_Object info;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1472
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1473 (*check_window_system_func) ();
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1474
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40028
diff changeset
1475 CHECK_STRING (name);
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1476 name = Fdowncase (name);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1477 if (NILP (frame))
25668
99290b59352d (Ffont_info): Change for Lisp_Object selected_frame.
Gerd Moellmann <gerd@gnu.org>
parents: 24611
diff changeset
1478 frame = selected_frame;
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40028
diff changeset
1479 CHECK_LIVE_FRAME (frame);
25668
99290b59352d (Ffont_info): Change for Lisp_Object selected_frame.
Gerd Moellmann <gerd@gnu.org>
parents: 24611
diff changeset
1480 f = XFRAME (frame);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1481
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1482 if (!query_font_func)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1483 error ("Font query function is not supported");
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1484
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 45848
diff changeset
1485 fontp = (*query_font_func) (f, SDATA (name));
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1486 if (!fontp)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1487 return Qnil;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1488
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1489 info = Fmake_vector (make_number (7), Qnil);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1490
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1491 XVECTOR (info)->contents[0] = build_string (fontp->name);
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1492 XVECTOR (info)->contents[1] = build_string (fontp->full_name);
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1493 XVECTOR (info)->contents[2] = make_number (fontp->size);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1494 XVECTOR (info)->contents[3] = make_number (fontp->height);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1495 XVECTOR (info)->contents[4] = make_number (fontp->baseline_offset);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1496 XVECTOR (info)->contents[5] = make_number (fontp->relative_compose);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1497 XVECTOR (info)->contents[6] = make_number (fontp->default_ascent);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1498
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1499 return info;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1500 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1501
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1502
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1503 /* Return the font name for the character at POSITION in the current
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1504 buffer. This is computed from all the text properties and overlays
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1505 that apply to POSITION. It returns nil in the following cases:
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1506
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1507 (1) The window system doesn't have a font for the character (thus
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1508 it is displayed by an empty box).
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1509
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1510 (2) The character code is invalid.
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1511
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1512 (3) The current buffer is not displayed in any window.
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1513
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1514 In addition, the returned font name may not take into account of
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1515 such redisplay engine hooks as what used in jit-lock-mode if
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1516 POSITION is currently not visible. */
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1517
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1518
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1519 DEFUN ("internal-char-font", Finternal_char_font, Sinternal_char_font, 1, 1, 0,
41001
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1520 doc: /* For internal use only. */)
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1521 (position)
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1522 Lisp_Object position;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1523 {
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1524 int pos, pos_byte, dummy;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1525 int face_id;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1526 int c;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1527 Lisp_Object window;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1528 struct window *w;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1529 struct frame *f;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1530 struct face *face;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1531
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40028
diff changeset
1532 CHECK_NUMBER_COERCE_MARKER (position);
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1533 pos = XINT (position);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1534 if (pos < BEGV || pos >= ZV)
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1535 args_out_of_range_3 (position, make_number (BEGV), make_number (ZV));
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1536 pos_byte = CHAR_TO_BYTE (pos);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1537 c = FETCH_CHAR (pos_byte);
30941
ac162a21c419 (Finternal_char_font): Search only the selected frame for a window of
Kenichi Handa <handa@m17n.org>
parents: 30398
diff changeset
1538 window = Fget_buffer_window (Fcurrent_buffer (), Qnil);
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1539 if (NILP (window))
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1540 return Qnil;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1541 w = XWINDOW (window);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1542 f = XFRAME (w->frame);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1543 face_id = face_at_buffer_position (w, pos, -1, -1, &dummy, pos + 100, 0);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1544 face_id = FACE_FOR_CHAR (f, FACE_FROM_ID (f, face_id), c);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1545 face = FACE_FROM_ID (f, face_id);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1546 return (face->font && face->font_name
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1547 ? build_string (face->font_name)
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1548 : Qnil);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1549 }
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1550
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1551
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1552 DEFUN ("fontset-info", Ffontset_info, Sfontset_info, 1, 2, 0,
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1553 doc: /* Return information about a fontset FONTSET on frame FRAME.
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1554 The value is a char-table of which elements has this form.
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1555
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1556 ((FONT-PATTERN OPENED-FONT ...) ...)
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1557
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1558 FONT-PATTERN is a vector:
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1559
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1560 [ FAMILY WEIGHT SLANT SWIDTH ADSTYLE REGISTRY ]
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 or a string of font name pattern.
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1563
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1564 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
1565
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1566 The char-table has one extra slot. The value is a char-table
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1567 containing the information about the derived fonts from the default
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1568 fontset. The format is the same as abobe. */)
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1569 (fontset, frame)
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1570 Lisp_Object fontset, frame;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1571 {
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1572 FRAME_PTR f;
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1573 Lisp_Object table, val, elt;
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1574 Lisp_Object *realized;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1575 int n_realized = 0;
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1576 int fallback;
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1577 int c, i, j;
41987
34952771ae85 Fix typos, remove unnecessary space.
Pavel Janík <Pavel@Janik.cz>
parents: 41052
diff changeset
1578
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1579 (*check_window_system_func) ();
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1580
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1581 fontset = check_fontset_name (fontset);
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1582
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1583 if (NILP (frame))
25668
99290b59352d (Ffont_info): Change for Lisp_Object selected_frame.
Gerd Moellmann <gerd@gnu.org>
parents: 24611
diff changeset
1584 frame = selected_frame;
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40028
diff changeset
1585 CHECK_LIVE_FRAME (frame);
25668
99290b59352d (Ffont_info): Change for Lisp_Object selected_frame.
Gerd Moellmann <gerd@gnu.org>
parents: 24611
diff changeset
1586 f = XFRAME (frame);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1587
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1588 /* Recode fontsets realized on FRAME from the base fontset FONTSET
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1589 in the table `realized'. */
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1590 realized = (Lisp_Object *) alloca (sizeof (Lisp_Object)
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1591 * ASIZE (Vfontset_table));
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1592 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
1593 {
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1594 elt = FONTSET_FROM_ID (i);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1595 if (!NILP (elt)
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1596 && EQ (FONTSET_BASE (elt), fontset)
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1597 && EQ (FONTSET_FRAME (elt), frame))
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1598 realized[n_realized++] = elt;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1599 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1600
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1601
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1602 table = Fmake_char_table (Qfontset_info, Qnil);
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1603 XCHAR_TABLE (table)->extras[0] = Fmake_char_table (Qnil, Qnil);
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1604 /* Accumulate information of the fontset in TABLE. The format of
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1605 each element is ((FONT-SPEC OPENED-FONT ...) ...). */
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1606 for (fallback = 0; fallback <= 1; fallback++)
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1607 {
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1608 Lisp_Object this_fontset, this_table;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1609
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1610 if (! fallback)
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1611 {
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1612 this_fontset = fontset;
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1613 this_table = table;
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1614 }
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1615 else
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1616 {
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1617 this_fontset = Vdefault_fontset;
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1618 this_table = XCHAR_TABLE (table)->extras[0];
89428
eed327e0bad3 (BASE_FONTSET_P): Check FONTSET_BASE, not
Kenichi Handa <handa@m17n.org>
parents: 89349
diff changeset
1619 #if 0
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1620 for (i = 0; i < n_realized; i++)
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1621 realized[i] = FONTSET_FALLBACK (realized[i]);
89428
eed327e0bad3 (BASE_FONTSET_P): Check FONTSET_BASE, not
Kenichi Handa <handa@m17n.org>
parents: 89349
diff changeset
1622 #endif
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1623 }
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1624 for (c = 0; c <= MAX_5_BYTE_CHAR; )
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1625 {
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1626 int from, to;
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1627
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1628 val = char_table_ref_and_range (this_fontset, c, &from, &to);
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1629 if (VECTORP (val))
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1630 {
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1631 Lisp_Object alist;
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1632
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1633 /* At first, set ALIST to ((FONT-SPEC) ...). */
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1634 for (alist = Qnil, i = 0; i < ASIZE (val); i++)
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1635 alist = Fcons (Fcons (AREF (AREF (val, i), 0), Qnil), alist);
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1636 alist = Fnreverse (alist);
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1637
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1638 /* Then store opend font names to cdr of each elements. */
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1639 for (i = 0; i < n_realized; i++)
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1640 {
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1641 if (NILP (realized[i]))
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1642 continue;
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1643 val = FONTSET_REF (realized[i], c);
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1644 if (NILP (val))
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1645 continue;
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1646 val = XCDR (val);
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1647 /* Now VAL is [[FACE-ID FONT-INDEX FONT-DEF] ...].
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1648 If a font of an element is already opened,
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1649 FONT-INDEX of the element is integer. */
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1650 for (j = 0; j < ASIZE (val); j++)
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1651 if (INTEGERP (AREF (AREF (val, j), 0)))
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1652 {
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1653 Lisp_Object font_idx;
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1654
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1655 font_idx = AREF (AREF (val, j), 1);
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1656 elt = Fassq (AREF (AREF (AREF (val, j), 2), 0), alist);
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1657 if (CONSP (elt)
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1658 && NILP (Fmemq (font_idx, XCDR(elt))))
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1659 nconc2 (elt, Fcons (font_idx, Qnil));
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1660 }
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1661 }
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1662 for (val = alist; CONSP (val); val = XCDR (val))
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1663 for (elt = XCDR (XCAR (val)); CONSP (elt); elt = XCDR (elt))
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1664 {
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1665 struct font_info *font_info
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1666 = (*get_font_info_func) (f, XINT (XCAR (elt)));
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1667 XSETCAR (elt, build_string (font_info->full_name));
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1668 }
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1669
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1670 /* Store ALIST in TBL for characters C..TO. */
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1671 char_table_set_range (this_table, c, to, alist);
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1672 }
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1673 c = to + 1;
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1674 }
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1675 }
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1676
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1677 return table;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1678 }
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1679
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1680
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1681 DEFUN ("fontset-font", Ffontset_font, Sfontset_font, 2, 2, 0,
41001
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1682 doc: /* Return a font name pattern for character CH in fontset NAME.
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1683 If NAME is t, find a font name pattern in the default fontset. */)
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1684 (name, ch)
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1685 Lisp_Object name, ch;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1686 {
34975
0d69e2d2724e (fontset_ref): Remove unused variable `i'.
Eli Zaretskii <eliz@gnu.org>
parents: 32978
diff changeset
1687 int c;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1688 Lisp_Object fontset, elt;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1689
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1690 fontset = check_fontset_name (name);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1691
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1692 CHECK_CHARACTER (ch);
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1693 c = XINT (ch);
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1694 elt = FONTSET_REF (fontset, c);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1695 return Fcopy_sequence (elt);
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1696 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1697
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1698 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
1699 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
1700 ()
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1701 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1702 Lisp_Object fontset, list;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1703 int i;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1704
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1705 list = Qnil;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1706 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
1707 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1708 fontset = FONTSET_FROM_ID (i);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1709 if (!NILP (fontset)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1710 && BASE_FONTSET_P (fontset))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1711 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
1712 }
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1713
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1714 return list;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1715 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1716
21514
fa9ff387d260 Fix -Wimplicit warnings.
Andreas Schwab <schwab@suse.de>
parents: 21127
diff changeset
1717 void
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1718 syms_of_fontset ()
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1719 {
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1720 if (!load_font_func)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1721 /* Window system initializer should have set proper functions. */
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1722 abort ();
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1723
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1724 DEFSYM (Qfontset, "fontset");
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1725 Fput (Qfontset, Qchar_table_extra_slots, make_number (8));
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1726 DEFSYM (Qfontset_info, "fontset-info");
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1727 Fput (Qfontset_info, Qchar_table_extra_slots, make_number (1));
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1728
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1729 DEFSYM (Qprepend, "prepend");
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1730 DEFSYM (Qappend, "append");
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1731
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1732 Vcached_fontset_data = Qnil;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1733 staticpro (&Vcached_fontset_data);
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1734
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1735 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
1736 staticpro (&Vfontset_table);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1737
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1738 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
1739 staticpro (&Vdefault_fontset);
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1740 FONTSET_ID (Vdefault_fontset) = make_number (0);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1741 FONTSET_NAME (Vdefault_fontset)
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1742 = build_string ("-*-*-*-*-*-*-*-*-*-*-*-*-fontset-default");
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1743 {
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1744 Lisp_Object default_ascii_font;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1745
32790
131348208699 (syms_of_fontset) [WINDOWSNT]: Special case for ASCII font of default
Jason Rumney <jasonr@gnu.org>
parents: 32752
diff changeset
1746 #if defined (macintosh)
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1747 default_ascii_font
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1748 = build_string ("-apple-monaco-medium-r-*--*-120-*-*-*-*-mac-roman");
32790
131348208699 (syms_of_fontset) [WINDOWSNT]: Special case for ASCII font of default
Jason Rumney <jasonr@gnu.org>
parents: 32752
diff changeset
1749 #elif defined (WINDOWSNT)
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1750 default_ascii_font
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1751 = build_string ("-*-courier new-normal-r-*-*-*-100-*-*-*-*-iso8859-1");
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents: 31102
diff changeset
1752 #else
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1753 default_ascii_font
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1754 = build_string ("-adobe-courier-medium-r-*-*-*-120-*-*-*-*-iso8859-1");
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents: 31102
diff changeset
1755 #endif
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1756 FONTSET_ASCII (Vdefault_fontset) = default_ascii_font;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1757 }
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1758 AREF (Vfontset_table, 0) = Vdefault_fontset;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1759 next_fontset_id = 1;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1760
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1761 DEFVAR_LISP ("font-encoding-alist", &Vfont_encoding_alist,
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1762 doc: /*
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1763 Alist of fontname patterns vs the corresponding encoding and repertory info.
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1764 Each element looks like (REGEXP . (ENCODING . REPERTORY)),
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1765 where ENCODING is a charset or a char-table,
89483
2f877ed80fa6 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88123 89428
diff changeset
1766 and REPERTORY is a charset, a char-table, or nil.
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1767
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1768 ENCODING is for converting a character to a glyph code of the font.
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1769 If ENCODING is a charset, encoding a character by the charset gives
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1770 the corresponding glyph code. If ENCODING is a char-table, looking up
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1771 the table by a character gives the corresponding glyph code.
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1772
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1773 REPERTORY specifies a repertory of characters supported by the font.
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1774 If REPERTORY is a charset, all characters beloging to the charset are
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1775 supported. If REPERTORY is a char-table, all characters who have a
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1776 non-nil value in the table are supported. It REPERTORY is nil, Emacs
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1777 gets the repertory information by an opened font and ENCODING. */);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1778 Vfont_encoding_alist = Qnil;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1779
17112
5c48ff325655 (syms_of_fontset): Intern Qfontset. Declare new lisp
Kenichi Handa <handa@m17n.org>
parents: 17071
diff changeset
1780 DEFVAR_LISP ("use-default-ascent", &Vuse_default_ascent,
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1781 doc: /*
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1782 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
1783 If an entry for a character is non-nil, the ascent value of the glyph
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1784 is assumed to be what specified by _MULE_DEFAULT_ASCENT property of a font.
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1785
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1786 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
1787 such a character is displayed on screen. */);
19282
09a1536debb4 (Vignore_relative_composition): New variable.
Kenichi Handa <handa@m17n.org>
parents: 19172
diff changeset
1788 Vuse_default_ascent = Qnil;
09a1536debb4 (Vignore_relative_composition): New variable.
Kenichi Handa <handa@m17n.org>
parents: 19172
diff changeset
1789
09a1536debb4 (Vignore_relative_composition): New variable.
Kenichi Handa <handa@m17n.org>
parents: 19172
diff changeset
1790 DEFVAR_LISP ("ignore-relative-composition", &Vignore_relative_composition,
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1791 doc: /*
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1792 Char table of characters which is not composed relatively.
41001
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1793 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
1794 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
1795 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
1796 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
1797 Vignore_relative_composition = Qnil;
17112
5c48ff325655 (syms_of_fontset): Intern Qfontset. Declare new lisp
Kenichi Handa <handa@m17n.org>
parents: 17071
diff changeset
1798
19450
895dc2520755 (Valternate_fontname_alist): Name changed from
Kenichi Handa <handa@m17n.org>
parents: 19282
diff changeset
1799 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
1800 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
1801 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
1802 alternate fontnames (if any) are tried instead. */);
19450
895dc2520755 (Valternate_fontname_alist): Name changed from
Kenichi Handa <handa@m17n.org>
parents: 19282
diff changeset
1803 Valternate_fontname_alist = Qnil;
17193
dc4562b0152a (Valternative_fontname_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17190
diff changeset
1804
17730
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
1805 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
1806 doc: /* Alist of fontset names vs the aliases. */);
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1807 Vfontset_alias_alist = Fcons (Fcons (FONTSET_NAME (Vdefault_fontset),
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1808 build_string ("fontset-default")),
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1809 Qnil);
17730
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
1810
26858
7cc081b4e084 (Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents: 26164
diff changeset
1811 DEFVAR_LISP ("vertical-centering-font-regexp",
7cc081b4e084 (Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents: 26164
diff changeset
1812 &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
1813 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
1814 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
1815 at the vertical center of lines. */);
26858
7cc081b4e084 (Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents: 26164
diff changeset
1816 Vvertical_centering_font_regexp = Qnil;
7cc081b4e084 (Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents: 26164
diff changeset
1817
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1818 defsubr (&Squery_fontset);
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1819 defsubr (&Snew_fontset);
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1820 defsubr (&Sset_fontset_font);
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1821 defsubr (&Sfont_info);
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1822 defsubr (&Sinternal_char_font);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1823 defsubr (&Sfontset_info);
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1824 defsubr (&Sfontset_font);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1825 defsubr (&Sfontset_list);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1826 }
89428
eed327e0bad3 (BASE_FONTSET_P): Check FONTSET_BASE, not
Kenichi Handa <handa@m17n.org>
parents: 89349
diff changeset
1827
eed327e0bad3 (BASE_FONTSET_P): Check FONTSET_BASE, not
Kenichi Handa <handa@m17n.org>
parents: 89349
diff changeset
1828 Lisp_Object
eed327e0bad3 (BASE_FONTSET_P): Check FONTSET_BASE, not
Kenichi Handa <handa@m17n.org>
parents: 89349
diff changeset
1829 dump_fontset (fontset)
eed327e0bad3 (BASE_FONTSET_P): Check FONTSET_BASE, not
Kenichi Handa <handa@m17n.org>
parents: 89349
diff changeset
1830 Lisp_Object fontset;
eed327e0bad3 (BASE_FONTSET_P): Check FONTSET_BASE, not
Kenichi Handa <handa@m17n.org>
parents: 89349
diff changeset
1831 {
eed327e0bad3 (BASE_FONTSET_P): Check FONTSET_BASE, not
Kenichi Handa <handa@m17n.org>
parents: 89349
diff changeset
1832 Lisp_Object val;
89483
2f877ed80fa6 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88123 89428
diff changeset
1833
89428
eed327e0bad3 (BASE_FONTSET_P): Check FONTSET_BASE, not
Kenichi Handa <handa@m17n.org>
parents: 89349
diff changeset
1834 if (NILP (FONTSET_FALLBACK (fontset)))
eed327e0bad3 (BASE_FONTSET_P): Check FONTSET_BASE, not
Kenichi Handa <handa@m17n.org>
parents: 89349
diff changeset
1835 val = Fcons (Fcons (intern ("fallback-id"), Qnil), Qnil);
eed327e0bad3 (BASE_FONTSET_P): Check FONTSET_BASE, not
Kenichi Handa <handa@m17n.org>
parents: 89349
diff changeset
1836 else
eed327e0bad3 (BASE_FONTSET_P): Check FONTSET_BASE, not
Kenichi Handa <handa@m17n.org>
parents: 89349
diff changeset
1837 val = Fcons (Fcons (intern ("fallback-id"),
eed327e0bad3 (BASE_FONTSET_P): Check FONTSET_BASE, not
Kenichi Handa <handa@m17n.org>
parents: 89349
diff changeset
1838 FONTSET_ID (FONTSET_FALLBACK (fontset))),
eed327e0bad3 (BASE_FONTSET_P): Check FONTSET_BASE, not
Kenichi Handa <handa@m17n.org>
parents: 89349
diff changeset
1839 Qnil);
eed327e0bad3 (BASE_FONTSET_P): Check FONTSET_BASE, not
Kenichi Handa <handa@m17n.org>
parents: 89349
diff changeset
1840 if (NILP (FONTSET_BASE (fontset)))
eed327e0bad3 (BASE_FONTSET_P): Check FONTSET_BASE, not
Kenichi Handa <handa@m17n.org>
parents: 89349
diff changeset
1841 val = Fcons (Fcons (intern ("base"), Qnil), val);
eed327e0bad3 (BASE_FONTSET_P): Check FONTSET_BASE, not
Kenichi Handa <handa@m17n.org>
parents: 89349
diff changeset
1842 else
eed327e0bad3 (BASE_FONTSET_P): Check FONTSET_BASE, not
Kenichi Handa <handa@m17n.org>
parents: 89349
diff changeset
1843 val = Fcons (Fcons (intern ("base"),
eed327e0bad3 (BASE_FONTSET_P): Check FONTSET_BASE, not
Kenichi Handa <handa@m17n.org>
parents: 89349
diff changeset
1844 FONTSET_NAME (FONTSET_BASE (fontset))),
eed327e0bad3 (BASE_FONTSET_P): Check FONTSET_BASE, not
Kenichi Handa <handa@m17n.org>
parents: 89349
diff changeset
1845 val);
eed327e0bad3 (BASE_FONTSET_P): Check FONTSET_BASE, not
Kenichi Handa <handa@m17n.org>
parents: 89349
diff changeset
1846 val = Fcons (Fcons (intern ("name"), FONTSET_NAME (fontset)), val);
eed327e0bad3 (BASE_FONTSET_P): Check FONTSET_BASE, not
Kenichi Handa <handa@m17n.org>
parents: 89349
diff changeset
1847 val = Fcons (Fcons (intern ("id"), FONTSET_ID (fontset)), val);
eed327e0bad3 (BASE_FONTSET_P): Check FONTSET_BASE, not
Kenichi Handa <handa@m17n.org>
parents: 89349
diff changeset
1848 return val;
eed327e0bad3 (BASE_FONTSET_P): Check FONTSET_BASE, not
Kenichi Handa <handa@m17n.org>
parents: 89349
diff changeset
1849 }