annotate src/fontset.c @ 89610:3aa74296be55

(fontset_face): Create a fallback fontset on demand (make_fontset): Don't create a fallback fontset here. (free_face_fontset): Free a fallback fontset (if any) too. (n_auto_fontsets): Delete this variable. (auto_fontset_alist): New variable. (new_fontset_from_font_name): Check auto_fontset_alist. (dump_fontset) [FONTSET_DEBUG]: Fully re-written. (Ffontset_list_all) [FONTSET_DEBUG]: New function. (syms_of_fontset): Initialize and staticpro auto_fontset_alist. Defsubr Sfontset_list_all.
author Kenichi Handa <handa@m17n.org>
date Wed, 29 Oct 2003 11:51:42 +0000
parents 9090f7eba02c
children 355fc0282e50
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))
89610
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
630 {
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
631 if (NILP (FONTSET_FALLBACK (fontset)))
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
632 FONTSET_FALLBACK (fontset)
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
633 = make_fontset (FONTSET_FRAME (fontset), Qnil, Vdefault_fontset);
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
634 return fontset_face (FONTSET_FALLBACK (fontset), c, face);
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
635 }
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
636
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
637 /* 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
638 nor can display C. */
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
639 if (NILP (FONTSET_NOFONT_FACE (fontset)))
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
640 {
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
641 int 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 if (! face)
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
644 return -1;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
645 face_id = lookup_non_ascii_face (f, -1, face);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
646 FONTSET_NOFONT_FACE (fontset) = make_number (face_id);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
647 }
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
648 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
649 }
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
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
652 /* 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
653 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
654 BASE. */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
655
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
656 static Lisp_Object
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
657 make_fontset (frame, name, base)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
658 Lisp_Object frame, name, base;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
659 {
34975
0d69e2d2724e (fontset_ref): Remove unused variable `i'.
Eli Zaretskii <eliz@gnu.org>
parents: 32978
diff changeset
660 Lisp_Object fontset;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
661 int size = ASIZE (Vfontset_table);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
662 int id = next_fontset_id;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
663
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
664 /* 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
665 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
666 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
667 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
668 id. */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
669 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
670
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
671 if (id + 1 == size)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
672 {
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
673 /* 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
674 Lisp_Object tem;
41987
34952771ae85 Fix typos, remove unnecessary space.
Pavel Janík <Pavel@Janik.cz>
parents: 41052
diff changeset
675 int i;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
676
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
677 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
678 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
679 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
680 Vfontset_table = tem;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
681 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
682
29767
c8e5453dc85d (FONTSET_ASCII): Use the first element of char table
Kenichi Handa <handa@m17n.org>
parents: 29501
diff changeset
683 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
684
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
685 FONTSET_ID (fontset) = make_number (id);
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
686 if (NILP (base))
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
687 {
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
688 FONTSET_NAME (fontset) = name;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
689 }
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
690 else
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
691 {
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
692 FONTSET_NAME (fontset) = Qnil;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
693 FONTSET_FRAME (fontset) = frame;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
694 FONTSET_BASE (fontset) = base;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
695 }
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
696
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
697 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
698 next_fontset_id = id + 1;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
699 return fontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
700 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
701
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
702
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
703
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
704 /********** 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
705
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
706 /* 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
707
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
708 Lisp_Object
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
709 fontset_name (id)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
710 int id;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
711 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
712 Lisp_Object fontset;
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
713
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
714 fontset = FONTSET_FROM_ID (id);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
715 return FONTSET_NAME (fontset);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
716 }
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
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
719 /* 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
720
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
721 Lisp_Object
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
722 fontset_ascii (id)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
723 int id;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
724 {
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
725 Lisp_Object fontset, elt;
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
726
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
727 fontset= FONTSET_FROM_ID (id);
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
728 elt = FONTSET_ASCII (fontset);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
729 /* 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
730 pattern). */
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
731 return elt;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
732 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
733
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
734
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
735 /* Free fontset of FACE defined on frame F. Called from
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
736 free_realized_face. */
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
737
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
738 void
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
739 free_face_fontset (f, face)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
740 FRAME_PTR f;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
741 struct face *face;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
742 {
89610
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
743 Lisp_Object fontset;
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
744
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
745 fontset = AREF (Vfontset_table, face->fontset);
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
746 xassert (!NILP (fontset) && ! BASE_FONTSET_P (fontset));
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
747 xassert (f == XFRAME (FONTSET_FRAME (fontset)));
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
748 ASET (Vfontset_table, face->fontset, Qnil);
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
749 if (face->fontset < next_fontset_id)
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
750 next_fontset_id = face->fontset;
89610
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
751 if (! NILP (FONTSET_FALLBACK (fontset)))
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
752 {
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
753 int id = FONTSET_ID (FONTSET_FALLBACK (fontset));
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
754
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
755 fontset = AREF (Vfontset_table, id);
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
756 xassert (!NILP (fontset) && ! BASE_FONTSET_P (fontset));
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
757 xassert (f == XFRAME (FONTSET_FRAME (fontset)));
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
758 ASET (Vfontset_table, id, Qnil);
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
759 if (id < next_fontset_id)
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
760 next_fontset_id = face->fontset;
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
761 }
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
762 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
763
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
764
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
765 /* 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
766 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
767 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
768
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
769 int
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
770 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
771 struct face *face;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
772 int c;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
773 {
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
774 Lisp_Object fontset;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
775
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
776 fontset = FONTSET_FROM_ID (face->fontset);
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
777 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
778 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
779
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
780
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
781 /* 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
782 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
783 the macro FACE_FOR_CHAR. */
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
784
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
785 int
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
786 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
787 FRAME_PTR f;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
788 struct face *face;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
789 int c;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
790 {
88546
7471723e43b0 (Fclear_face_cache): Declare.
Dave Love <fx@gnu.org>
parents: 88500
diff changeset
791 Lisp_Object fontset;
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
792
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
793 if (ASCII_CHAR_P (c))
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
794 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
795
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
796 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
797 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
798 xassert (!BASE_FONTSET_P (fontset));
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
799 return fontset_face (fontset, c, face);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
800 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
801
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
802
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
803 /* 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
804 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
805 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
806 Called from realize_x_face. */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
807
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
808 int
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
809 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
810 FRAME_PTR f;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
811 int base_fontset_id;
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
812 struct face *face;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
813 {
34975
0d69e2d2724e (fontset_ref): Remove unused variable `i'.
Eli Zaretskii <eliz@gnu.org>
parents: 32978
diff changeset
814 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
815
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
816 XSETFRAME (frame, f);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
817 if (base_fontset_id >= 0)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
818 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
819 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
820 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
821 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
822 xassert (BASE_FONTSET_P (base_fontset));
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
823 if (! BASE_FONTSET_P (base_fontset))
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
824 abort ();
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
825 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
826 else
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
827 base_fontset = Vdefault_fontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
828
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
829 fontset = make_fontset (frame, Qnil, base_fontset);
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
830 {
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
831 Lisp_Object elt;
41987
34952771ae85 Fix typos, remove unnecessary space.
Pavel Janík <Pavel@Janik.cz>
parents: 41052
diff changeset
832
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
833 elt = FONTSET_REF (base_fontset, 0);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
834 elt = Fmake_vector (make_number (3), AREF (elt, 0));
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
835 ASET (elt, 0, make_number (face->id));
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
836 ASET (elt, 1, make_number (face->font_info_id));
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
837 elt = Fcons (make_number (charset_ordered_list_tick),
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
838 Fmake_vector (make_number (1), elt));
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
839 char_table_set_range (fontset, 0, 127, elt);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
840 }
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
841 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
842 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
843
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
844
40028
392c2fe9edd7 (fs_load_font) [WINDOWSNT && _MSC_VER]: Disable
Andrew Innes <andrewi@gnu.org>
parents: 39973
diff changeset
845 #if defined(WINDOWSNT) && defined (_MSC_VER)
392c2fe9edd7 (fs_load_font) [WINDOWSNT && _MSC_VER]: Disable
Andrew Innes <andrewi@gnu.org>
parents: 39973
diff changeset
846 #pragma optimize("", off)
392c2fe9edd7 (fs_load_font) [WINDOWSNT && _MSC_VER]: Disable
Andrew Innes <andrewi@gnu.org>
parents: 39973
diff changeset
847 #endif
392c2fe9edd7 (fs_load_font) [WINDOWSNT && _MSC_VER]: Disable
Andrew Innes <andrewi@gnu.org>
parents: 39973
diff changeset
848
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
849 /* 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
850 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
851 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
852 font. If it is -1, find one from Vfont_encoding_alist. */
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
853
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
854 struct font_info *
88968
a35b7b45baa3 (fs_load_font): If fontp->charset is not negative,
Kenichi Handa <handa@m17n.org>
parents: 88931
diff changeset
855 fs_load_font (f, fontname, charset)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
856 FRAME_PTR f;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
857 char *fontname;
88968
a35b7b45baa3 (fs_load_font): If fontp->charset is not negative,
Kenichi Handa <handa@m17n.org>
parents: 88931
diff changeset
858 int charset;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
859 {
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
860 struct font_info *fontp;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
861
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
862 if (!fontname)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
863 /* No way to get fontname. */
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
864 return NULL;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
865
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
866 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
867 if (! fontp || fontp->charset >= 0)
a35b7b45baa3 (fs_load_font): If fontp->charset is not negative,
Kenichi Handa <handa@m17n.org>
parents: 88931
diff changeset
868 return fontp;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
869
88500
3d67875ee2b1 (fs_load_font): Check fontp->full_name (not fontname)
Kenichi Handa <handa@m17n.org>
parents: 88482
diff changeset
870 fontname = fontp->full_name;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
871
88968
a35b7b45baa3 (fs_load_font): If fontp->charset is not negative,
Kenichi Handa <handa@m17n.org>
parents: 88931
diff changeset
872 if (charset < 0)
a35b7b45baa3 (fs_load_font): If fontp->charset is not negative,
Kenichi Handa <handa@m17n.org>
parents: 88931
diff changeset
873 {
a35b7b45baa3 (fs_load_font): If fontp->charset is not negative,
Kenichi Handa <handa@m17n.org>
parents: 88931
diff changeset
874 Lisp_Object charset_symbol;
a35b7b45baa3 (fs_load_font): If fontp->charset is not negative,
Kenichi Handa <handa@m17n.org>
parents: 88931
diff changeset
875
a35b7b45baa3 (fs_load_font): If fontp->charset is not negative,
Kenichi Handa <handa@m17n.org>
parents: 88931
diff changeset
876 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
877 if (CONSP (charset_symbol))
a35b7b45baa3 (fs_load_font): If fontp->charset is not negative,
Kenichi Handa <handa@m17n.org>
parents: 88931
diff changeset
878 charset_symbol = XCAR (charset_symbol);
a35b7b45baa3 (fs_load_font): If fontp->charset is not negative,
Kenichi Handa <handa@m17n.org>
parents: 88931
diff changeset
879 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
880 }
a35b7b45baa3 (fs_load_font): If fontp->charset is not negative,
Kenichi Handa <handa@m17n.org>
parents: 88931
diff changeset
881 fontp->charset = charset;
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
882 fontp->vertical_centering = 0;
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
883 fontp->font_encoder = NULL;
21553
2d7afcd11b72 (find_ccl_program_func): New variable.
Kenichi Handa <handa@m17n.org>
parents: 21514
diff changeset
884
88968
a35b7b45baa3 (fs_load_font): If fontp->charset is not negative,
Kenichi Handa <handa@m17n.org>
parents: 88931
diff changeset
885 if (charset != charset_ascii)
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
886 {
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
887 fontp->vertical_centering
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
888 = (STRINGP (Vvertical_centering_font_regexp)
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
889 && (fast_c_string_match_ignore_case
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
890 (Vvertical_centering_font_regexp, fontname) >= 0));
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
891
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
892 if (find_ccl_program_func)
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
893 (*find_ccl_program_func) (fontp);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
894 }
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
895
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
896 return fontp;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
897 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
898
40028
392c2fe9edd7 (fs_load_font) [WINDOWSNT && _MSC_VER]: Disable
Andrew Innes <andrewi@gnu.org>
parents: 39973
diff changeset
899 #if defined(WINDOWSNT) && defined (_MSC_VER)
392c2fe9edd7 (fs_load_font) [WINDOWSNT && _MSC_VER]: Disable
Andrew Innes <andrewi@gnu.org>
parents: 39973
diff changeset
900 #pragma optimize("", on)
392c2fe9edd7 (fs_load_font) [WINDOWSNT && _MSC_VER]: Disable
Andrew Innes <andrewi@gnu.org>
parents: 39973
diff changeset
901 #endif
392c2fe9edd7 (fs_load_font) [WINDOWSNT && _MSC_VER]: Disable
Andrew Innes <andrewi@gnu.org>
parents: 39973
diff changeset
902
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
903
88968
a35b7b45baa3 (fs_load_font): If fontp->charset is not negative,
Kenichi Handa <handa@m17n.org>
parents: 88931
diff changeset
904 /* 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
905 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
906 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
907
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
908
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
909 static Lisp_Object
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
910 find_font_encoding (fontname)
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
911 char *fontname;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
912 {
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
913 Lisp_Object tail, elt;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
914
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
915 for (tail = Vfont_encoding_alist; CONSP (tail); tail = XCDR (tail))
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
916 {
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
917 elt = XCAR (tail);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
918 if (CONSP (elt)
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
919 && STRINGP (XCAR (elt))
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
920 && fast_c_string_match_ignore_case (XCAR (elt), fontname) >= 0
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
921 && (SYMBOLP (XCDR (elt))
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
922 ? CHARSETP (XCDR (elt))
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
923 : CONSP (XCDR (elt)) && CHARSETP (XCAR (XCDR (elt)))))
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
924 return (XCDR (elt));
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
925 }
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
926 /* 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
927 encoding. */
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
928 return Qunicode;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
929 }
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
930
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
931
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
932 /* Cache data used by fontset_pattern_regexp. The car part is a
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
933 pattern string containing at least one wild card, the cdr part is
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
934 the corresponding regular expression. */
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
935 static Lisp_Object Vcached_fontset_data;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
936
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 45848
diff changeset
937 #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
938 #define CACHED_FONTSET_REGEX (XCDR (Vcached_fontset_data))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
939
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
940 /* If fontset name PATTERN contains any wild card, return regular
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
941 expression corresponding to PATTERN. */
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
942
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
943 static Lisp_Object
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
944 fontset_pattern_regexp (pattern)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
945 Lisp_Object pattern;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
946 {
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 45848
diff changeset
947 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
948 && !index (SDATA (pattern), '?'))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
949 /* PATTERN does not contain any wild cards. */
17730
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
950 return Qnil;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
951
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
952 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
953 || strcmp (SDATA (pattern), CACHED_FONTSET_NAME))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
954 {
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
955 /* 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
956 char *regex = (char *) alloca (SCHARS (pattern) * 2 + 3);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
957 char *p0, *p1 = regex;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
958
17730
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
959 /* Convert "*" to ".*", "?" to ".". */
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
960 *p1++ = '^';
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 45848
diff changeset
961 for (p0 = (char *) SDATA (pattern); *p0; p0++)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
962 {
17730
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
963 if (*p0 == '*')
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
964 {
17730
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
965 *p1++ = '.';
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
966 *p1++ = '*';
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
967 }
17730
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
968 else if (*p0 == '?')
21127
577865651099 (fontset_pattern_regexp): `==' was used instead of `='.
Richard M. Stallman <rms@gnu.org>
parents: 20346
diff changeset
969 *p1++ = '.';
17730
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
970 else
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
971 *p1++ = *p0;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
972 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
973 *p1++ = '$';
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
974 *p1++ = 0;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
975
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 45848
diff changeset
976 Vcached_fontset_data = Fcons (build_string (SDATA (pattern)),
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
977 build_string (regex));
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
978 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
979
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
980 return CACHED_FONTSET_REGEX;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
981 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
982
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
983 /* 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
984 fontset, return -1. */
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 int
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
987 fs_query_fontset (name, regexpp)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
988 Lisp_Object name;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
989 int regexpp;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
990 {
34975
0d69e2d2724e (fontset_ref): Remove unused variable `i'.
Eli Zaretskii <eliz@gnu.org>
parents: 32978
diff changeset
991 Lisp_Object tem;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
992 int 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 name = Fdowncase (name);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
995 if (!regexpp)
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 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
998 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
999 name = XCAR (tem);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1000 else
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1001 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1002 tem = fontset_pattern_regexp (name);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1003 if (STRINGP (tem))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1004 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1005 name = tem;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1006 regexpp = 1;
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 }
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 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
1012 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1013 Lisp_Object fontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1014 unsigned char *this_name;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1015
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1016 fontset = FONTSET_FROM_ID (i);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1017 if (NILP (fontset)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1018 || !BASE_FONTSET_P (fontset))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1019 continue;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1020
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 45848
diff changeset
1021 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
1022 if (regexpp
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1023 ? 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
1024 : !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
1025 return i;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1026 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1027 return -1;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1028 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1029
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1030
21553
2d7afcd11b72 (find_ccl_program_func): New variable.
Kenichi Handa <handa@m17n.org>
parents: 21514
diff changeset
1031 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
1032 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
1033 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
1034 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
1035 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
1036 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
1037 (pattern, regexpp)
21553
2d7afcd11b72 (find_ccl_program_func): New variable.
Kenichi Handa <handa@m17n.org>
parents: 21514
diff changeset
1038 Lisp_Object pattern, regexpp;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1039 {
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1040 Lisp_Object fontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1041 int id;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1042
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1043 (*check_window_system_func) ();
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1044
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40028
diff changeset
1045 CHECK_STRING (pattern);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1046
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 45848
diff changeset
1047 if (SCHARS (pattern) == 0)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1048 return Qnil;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1049
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1050 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
1051 if (id < 0)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1052 return Qnil;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1053
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1054 fontset = FONTSET_FROM_ID (id);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1055 return FONTSET_NAME (fontset);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1056 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1057
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1058 /* Return a list of base fontset names matching PATTERN on frame F. */
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1059
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1060 Lisp_Object
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1061 list_fontsets (f, pattern, size)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1062 FRAME_PTR f;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1063 Lisp_Object pattern;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1064 int size;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1065 {
34975
0d69e2d2724e (fontset_ref): Remove unused variable `i'.
Eli Zaretskii <eliz@gnu.org>
parents: 32978
diff changeset
1066 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
1067 int id;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1068
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1069 XSETFRAME (frame, f);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1070
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1071 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
1072 val = Qnil;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1073
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1074 for (id = 0; id < ASIZE (Vfontset_table); id++)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1075 {
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1076 Lisp_Object fontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1077 unsigned char *name;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1078
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1079 fontset = FONTSET_FROM_ID (id);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1080 if (NILP (fontset)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1081 || !BASE_FONTSET_P (fontset)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1082 || !EQ (frame, FONTSET_FRAME (fontset)))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1083 continue;
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 45848
diff changeset
1084 name = SDATA (FONTSET_NAME (fontset));
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1085
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1086 if (STRINGP (regexp)
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1087 ? (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
1088 : strcmp (SDATA (pattern), name))
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1089 continue;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1090
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1091 val = Fcons (Fcopy_sequence (FONTSET_NAME (fontset)), val);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1092 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1093
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1094 return val;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1095 }
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
89483
2f877ed80fa6 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88123 89428
diff changeset
1098 /* Free all realized fontsets whose base fontset is BASE. */
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1099
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1100 static void
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1101 free_realized_fontsets (base)
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1102 Lisp_Object base;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1103 {
88546
7471723e43b0 (Fclear_face_cache): Declare.
Dave Love <fx@gnu.org>
parents: 88500
diff changeset
1104 #if 0
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1105 int id;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1106
88482
effba1417b74 (free_realized_fontsets): Call Fclear_face_cache instead
Kenichi Handa <handa@m17n.org>
parents: 88405
diff changeset
1107 /* 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
1108 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
1109 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
1110 that is not efficient. */
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1111 BLOCK_INPUT;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1112 for (id = 0; id < ASIZE (Vfontset_table); id++)
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1113 {
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1114 Lisp_Object this = AREF (Vfontset_table, id);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1115
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1116 if (EQ (FONTSET_BASE (this), base))
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1117 {
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1118 Lisp_Object tail;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1119
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1120 for (tail = FONTSET_FACE_ALIST (this); CONSP (tail);
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1121 tail = XCDR (tail))
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1122 {
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1123 FRAME_PTR f = XFRAME (FONTSET_FRAME (this));
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1124 int face_id = XINT (XCDR (XCAR (tail)));
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1125 struct face *face = FACE_FROM_ID (f, face_id);
89483
2f877ed80fa6 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88123 89428
diff changeset
1126
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1127 /* Face THIS itself is also freed by the following call. */
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1128 free_realized_face (f, face);
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1129 }
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1130 }
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1131 }
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1132 UNBLOCK_INPUT;
88482
effba1417b74 (free_realized_fontsets): Call Fclear_face_cache instead
Kenichi Handa <handa@m17n.org>
parents: 88405
diff changeset
1133 #else /* not 0 */
effba1417b74 (free_realized_fontsets): Call Fclear_face_cache instead
Kenichi Handa <handa@m17n.org>
parents: 88405
diff changeset
1134 Fclear_face_cache (Qt);
effba1417b74 (free_realized_fontsets): Call Fclear_face_cache instead
Kenichi Handa <handa@m17n.org>
parents: 88405
diff changeset
1135 #endif /* not 0 */
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1136 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1137
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1138
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1139 /* 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
1140 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
1141 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
1142
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1143 static Lisp_Object
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1144 check_fontset_name (name)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1145 Lisp_Object name;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1146 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1147 int id;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1148
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1149 if (EQ (name, Qt))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1150 return Vdefault_fontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1151
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40028
diff changeset
1152 CHECK_STRING (name);
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1153 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
1154 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
1155 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
1156 return FONTSET_FROM_ID (id);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1157 }
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1158
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1159 static void
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1160 accumulate_script_ranges (arg, range, val)
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1161 Lisp_Object arg, range, val;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1162 {
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1163 if (EQ (XCAR (arg), val))
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1164 {
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1165 if (CONSP (range))
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1166 XSETCDR (arg, Fcons (Fcons (XCAR (range), XCDR (range)), XCDR (arg)));
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1167 else
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1168 XSETCDR (arg, Fcons (Fcons (range, range), XCDR (arg)));
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1169 }
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1170 }
41001
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1171
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1172
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1173 /* 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
1174 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
1175 to XLFD. ASCII_SPEC is a vector:
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1176 [FAMILY WEIGHT SLANT SWIDTH ADSTYLE REGISTRY]. */
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1177
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1178 static INLINE Lisp_Object
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1179 generate_ascii_font_name (name, ascii_spec)
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1180 Lisp_Object name, ascii_spec;
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1181 {
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1182 Lisp_Object vec;
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1183 int i;
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1184
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1185 vec = split_font_name_into_vector (name);
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1186 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
1187 if (! NILP (AREF (ascii_spec, i)))
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1188 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
1189 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
1190 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
1191 return build_font_name_from_vector (vec);
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1192 }
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1193
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1194
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1195 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
1196 doc: /*
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1197 Modify fontset NAME to use FONT-SPEC for CHARACTER.
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1198
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1199 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
1200 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
1201 range FROM and TO (inclusive).
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 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
1204 for all characters that belong to the script.
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1205
88931
74d18470865c (fontset_add): Declare args. Call make_number
Dave Love <fx@gnu.org>
parents: 88903
diff changeset
1206 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
1207 attribute value is greater than the maximum Unicode character
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1208 \(#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
1209 charset.
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1210
88931
74d18470865c (fontset_add): Declare args. Call make_number
Dave Love <fx@gnu.org>
parents: 88903
diff changeset
1211 FONT-SPEC may be:
74d18470865c (fontset_add): Declare args. Call make_number
Dave Love <fx@gnu.org>
parents: 88903
diff changeset
1212 * 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
1213 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
1214 these vector elements;
89337
6026c8e5664f (Fset_fontset_font): Fix indentation of docstring.
Kenichi Handa <handa@m17n.org>
parents: 89069
diff changeset
1215 * 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
1216 REGISTRY is a font registry name;
74d18470865c (fontset_add): Declare args. Call make_number
Dave Love <fx@gnu.org>
parents: 88903
diff changeset
1217 * A font name string.
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1218
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1219 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
1220 kept for backward compatibility and has no meaning.
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1221
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1222 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
1223 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
1224 `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
1225 appended. By default, FONT-SPEC overrides the previous settings. */)
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1226 (name, character, font_spec, frame, add)
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1227 Lisp_Object name, character, font_spec, frame, add;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1228 {
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1229 Lisp_Object fontset;
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1230 Lisp_Object font_def, registry;
88931
74d18470865c (fontset_add): Declare args. Call make_number
Dave Love <fx@gnu.org>
parents: 88903
diff changeset
1231 Lisp_Object encoding, repertory;
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1232 Lisp_Object range_list;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1233
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1234 fontset = check_fontset_name (name);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1235
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1236 /* 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
1237 the validity. */
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1238 if (!NILP (frame))
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40028
diff changeset
1239 CHECK_LIVE_FRAME (frame);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1240
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1241 if (VECTORP (font_spec))
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 int j;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1244
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1245 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
1246 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
1247 make_number (ASIZE (font_spec)));
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1248
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1249 font_spec = Fcopy_sequence (font_spec);
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1250 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
1251 if (! NILP (AREF (font_spec, j)))
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1252 {
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1253 CHECK_STRING (AREF (font_spec, j));
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1254 ASET (font_spec, j, Fdowncase (AREF (font_spec, j)));
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1255 }
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1256 /* REGISTRY should not be omitted. */
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1257 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
1258 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
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 }
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1262 else if (CONSP (font_spec))
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1263 {
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1264 Lisp_Object family;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1265
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1266 family = XCAR (font_spec);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1267 registry = XCDR (font_spec);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1268
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1269 if (! NILP (family))
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1270 {
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1271 CHECK_STRING (family);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1272 family = Fdowncase (family);
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 CHECK_STRING (registry);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1275 registry = Fdowncase (registry);
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1276 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
1277 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
1278 ASET (font_spec, FONT_SPEC_REGISTRY_INDEX, registry);
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1279 }
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1280 else
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1281 {
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1282 CHECK_STRING (font_spec);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1283 font_spec = Fdowncase (font_spec);
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1284 registry = split_font_name_into_vector (font_spec);
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1285 if (NILP (registry))
89483
2f877ed80fa6 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88123 89428
diff changeset
1286 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
1287 if (NILP (AREF (registry, 12))
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1288 || NILP (AREF (registry, 13)))
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1289 error ("Registry must be specified");
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1290 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
1291 AREF (registry, 13));
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1292 }
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 if (STRINGP (font_spec))
89483
2f877ed80fa6 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88123 89428
diff changeset
1295 encoding = find_font_encoding ((char *) SDATA (font_spec));
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1296 else
89483
2f877ed80fa6 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88123 89428
diff changeset
1297 encoding = find_font_encoding ((char *) SDATA (registry));
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1298 if (SYMBOLP (encoding))
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1299 encoding = repertory = CHARSET_SYMBOL_ID (encoding);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1300 else
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 repertory = XCDR (encoding);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1303 encoding = CHARSET_SYMBOL_ID (XCAR (encoding));
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1304 }
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1305 font_def = Fmake_vector (make_number (3), font_spec);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1306 ASET (font_def, 1, encoding);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1307 ASET (font_def, 2, repertory);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1308
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1309 if (CHARACTERP (character))
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1310 range_list = Fcons (Fcons (character, character), Qnil);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1311 else if (CONSP (character))
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1312 {
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1313 Lisp_Object from, to;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1314
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1315 from = Fcar (character);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1316 to = Fcdr (character);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1317 CHECK_CHARACTER (from);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1318 CHECK_CHARACTER (to);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1319 range_list = Fcons (character, Qnil);
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 else
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1322 {
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1323 Lisp_Object script_list;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1324 Lisp_Object val;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1325
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1326 CHECK_SYMBOL (character);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1327 range_list = Qnil;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1328 script_list = XCHAR_TABLE (Vchar_script_table)->extras[0];
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1329 if (! NILP (Fmemq (character, script_list)))
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1330 {
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1331 val = Fcons (character, Qnil);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1332 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
1333 val);
2f877ed80fa6 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88123 89428
diff changeset
1334 range_list = XCDR (val);
88903
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 else if (CHARSETP (character))
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1337 {
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1338 struct charset *charset;
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 CHECK_CHARSET_GET_CHARSET (character, charset);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1341 if (CHARSET_METHOD (charset) == CHARSET_METHOD_OFFSET)
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1342 range_list
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1343 = Fcons (Fcons (make_number (CHARSET_MIN_CHAR (charset)),
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1344 make_number (CHARSET_MAX_CHAR (charset))),
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1345 range_list);
89006
faa38aebf129 (Fset_fontset_font): Treate `ascii' as charset, not script.
Kenichi Handa <handa@m17n.org>
parents: 88982
diff changeset
1346 if (EQ (character, Qascii))
faa38aebf129 (Fset_fontset_font): Treate `ascii' as charset, not script.
Kenichi Handa <handa@m17n.org>
parents: 88982
diff changeset
1347 {
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1348 if (VECTORP (font_spec))
89006
faa38aebf129 (Fset_fontset_font): Treate `ascii' as charset, not script.
Kenichi Handa <handa@m17n.org>
parents: 88982
diff changeset
1349 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
1350 font_spec);
faa38aebf129 (Fset_fontset_font): Treate `ascii' as charset, not script.
Kenichi Handa <handa@m17n.org>
parents: 88982
diff changeset
1351 FONTSET_ASCII (fontset) = font_spec;
faa38aebf129 (Fset_fontset_font): Treate `ascii' as charset, not script.
Kenichi Handa <handa@m17n.org>
parents: 88982
diff changeset
1352 }
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1353 }
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1354
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1355 if (NILP (range_list))
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1356 error ("Invalid script or charset name: %s",
89483
2f877ed80fa6 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88123 89428
diff changeset
1357 SDATA (SYMBOL_NAME (character)));
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1358 }
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1359
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1360 for (; CONSP (range_list); range_list = XCDR (range_list))
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1361 FONTSET_ADD (fontset, XCAR (range_list), font_def, add);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1362
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1363 /* Free all realized fontsets whose base is FONTSET. This way, the
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1364 specified character(s) are surely redisplayed by a correct
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1365 font. */
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1366 free_realized_fontsets (fontset);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1367
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1368 return Qnil;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1369 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1370
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1371
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1372 DEFUN ("new-fontset", Fnew_fontset, Snew_fontset, 2, 2, 0,
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1373 doc: /* Create a new fontset NAME from font information in FONTLIST.
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1374
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1375 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
1376 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
1377 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
1378 FONT-SPEC.
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1379
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1380 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
1381 char-table `char-script-table'.
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1382
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1383 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
1384 `set-fontset-font' for the meaning. */)
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1385 (name, fontlist)
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1386 Lisp_Object name, fontlist;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1387 {
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1388 Lisp_Object fontset;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1389 Lisp_Object val;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1390 int id;
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1391
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1392 CHECK_STRING (name);
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1393 CHECK_LIST (fontlist);
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1394
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1395 id = fs_query_fontset (name, 0);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1396 if (id < 0)
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1397 {
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1398 name = Fdowncase (name);
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1399 val = split_font_name_into_vector (name);
89603
7f9f2d025eee (Fnew_fontset): Check NAME more rigidly.
Kenichi Handa <handa@m17n.org>
parents: 89572
diff changeset
1400 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
1401 error ("Fontset name must be in XLFD format");
89483
2f877ed80fa6 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88123 89428
diff changeset
1402 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
1403 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
1404 Vfontset_alias_alist
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1405 = Fcons (Fcons (name,
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1406 concat2 (concat2 (AREF (val, 12), build_string ("-")),
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1407 AREF (val, 13))),
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1408 Vfontset_alias_alist);
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1409 ASET (val, 12, build_string ("iso8859-1"));
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1410 fontset = make_fontset (Qnil, name, Qnil);
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1411 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
1412 }
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1413 else
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1414 {
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1415 fontset = FONTSET_FROM_ID (id);;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1416 free_realized_fontsets (fontset);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1417 Fset_char_table_range (fontset, Qt, Qnil);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1418 }
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1419
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1420 for (; ! NILP (fontlist); fontlist = Fcdr (fontlist))
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1421 {
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1422 Lisp_Object elt, script;
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1423
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1424 elt = Fcar (fontlist);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1425 script = Fcar (elt);
89607
9090f7eba02c (Fnew_fontset): Check NAME more rigidly.
Kenichi Handa <handa@m17n.org>
parents: 89603
diff changeset
1426 elt = Fcdr (elt);
9090f7eba02c (Fnew_fontset): Check NAME more rigidly.
Kenichi Handa <handa@m17n.org>
parents: 89603
diff changeset
1427 if (CONSP (elt) && (NILP (XCDR (elt)) || CONSP (XCDR (elt))))
9090f7eba02c (Fnew_fontset): Check NAME more rigidly.
Kenichi Handa <handa@m17n.org>
parents: 89603
diff changeset
1428 for (; CONSP (elt); elt = XCDR (elt))
9090f7eba02c (Fnew_fontset): Check NAME more rigidly.
Kenichi Handa <handa@m17n.org>
parents: 89603
diff changeset
1429 Fset_fontset_font (name, script, XCAR (elt), Qnil, Qappend);
9090f7eba02c (Fnew_fontset): Check NAME more rigidly.
Kenichi Handa <handa@m17n.org>
parents: 89603
diff changeset
1430 else
9090f7eba02c (Fnew_fontset): Check NAME more rigidly.
Kenichi Handa <handa@m17n.org>
parents: 89603
diff changeset
1431 Fset_fontset_font (name, script, elt, Qnil, Qappend);
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1432 }
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1433 return name;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1434 }
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1435
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1436
89610
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1437 /* Alist of automatically created fontsets. Each element is a cons
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1438 (FONTNAME . FONTSET-ID). */
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1439 static Lisp_Object auto_fontset_alist;
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1440
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1441 int
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1442 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
1443 {
89610
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1444 Lisp_Object val;
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1445 Lisp_Object name;
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1446 Lisp_Object vec;
89610
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1447 int id;
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1448
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1449 fontname = Fdowncase (fontname);
89610
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1450 val = Fassoc (fontname, auto_fontset_alist);
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1451 if (CONSP (val))
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1452 return XINT (XCDR (val));
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1453
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1454 vec = split_font_name_into_vector (fontname);
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1455 if ( NILP (vec))
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1456 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
1457 ASET (vec, 12, build_string ("fontset"));
89610
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1458 if (NILP (auto_fontset_alist))
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1459 {
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1460 ASET (vec, 13, build_string ("startup"));
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1461 name = build_font_name_from_vector (vec);
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1462 }
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1463 else
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1464 {
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1465 char temp[20];
89610
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1466 int len = Flength (auto_fontset_alist);
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1467
89610
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1468 sprintf (temp, "auto%d", len);
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1469 ASET (vec, 13, build_string (temp));
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1470 name = build_font_name_from_vector (vec);
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1471 }
89610
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1472 name = Fnew_fontset (name, Fcons (Fcons (Qascii, Fcons (fontname, Qnil)),
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1473 Qnil));
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1474 id = fs_query_fontset (name, 0);
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1475 auto_fontset_alist
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1476 = Fcons (Fcons (fontname, make_number (id)), auto_fontset_alist);
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1477 return id;
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1478 }
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1479
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1480
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1481 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
1482 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
1483 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
1484 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
1485 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
1486 where
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1487 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
1488 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
1489 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
1490 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
1491 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
1492 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
1493 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
1494 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
1495 (name, frame)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1496 Lisp_Object name, frame;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1497 {
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1498 FRAME_PTR f;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1499 struct font_info *fontp;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1500 Lisp_Object info;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1501
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1502 (*check_window_system_func) ();
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1503
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40028
diff changeset
1504 CHECK_STRING (name);
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1505 name = Fdowncase (name);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1506 if (NILP (frame))
25668
99290b59352d (Ffont_info): Change for Lisp_Object selected_frame.
Gerd Moellmann <gerd@gnu.org>
parents: 24611
diff changeset
1507 frame = selected_frame;
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40028
diff changeset
1508 CHECK_LIVE_FRAME (frame);
25668
99290b59352d (Ffont_info): Change for Lisp_Object selected_frame.
Gerd Moellmann <gerd@gnu.org>
parents: 24611
diff changeset
1509 f = XFRAME (frame);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1510
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1511 if (!query_font_func)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1512 error ("Font query function is not supported");
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1513
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 45848
diff changeset
1514 fontp = (*query_font_func) (f, SDATA (name));
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1515 if (!fontp)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1516 return Qnil;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1517
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1518 info = Fmake_vector (make_number (7), Qnil);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1519
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1520 XVECTOR (info)->contents[0] = build_string (fontp->name);
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1521 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
1522 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
1523 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
1524 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
1525 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
1526 XVECTOR (info)->contents[6] = make_number (fontp->default_ascent);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1527
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1528 return info;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1529 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1530
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1531
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1532 /* 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
1533 buffer. This is computed from all the text properties and overlays
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1534 that apply to POSITION. It returns nil in the following cases:
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1535
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1536 (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
1537 it is displayed by an empty box).
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1538
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1539 (2) The character code is invalid.
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1540
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1541 (3) The current buffer is not displayed in any window.
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1542
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1543 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
1544 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
1545 POSITION is currently not visible. */
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1546
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1547
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1548 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
1549 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
1550 (position)
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1551 Lisp_Object position;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1552 {
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1553 int pos, pos_byte, dummy;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1554 int face_id;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1555 int c;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1556 Lisp_Object window;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1557 struct window *w;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1558 struct frame *f;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1559 struct face *face;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1560
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40028
diff changeset
1561 CHECK_NUMBER_COERCE_MARKER (position);
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1562 pos = XINT (position);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1563 if (pos < BEGV || pos >= ZV)
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1564 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
1565 pos_byte = CHAR_TO_BYTE (pos);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1566 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
1567 window = Fget_buffer_window (Fcurrent_buffer (), Qnil);
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1568 if (NILP (window))
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1569 return Qnil;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1570 w = XWINDOW (window);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1571 f = XFRAME (w->frame);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1572 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
1573 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
1574 face = FACE_FROM_ID (f, face_id);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1575 return (face->font && face->font_name
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1576 ? build_string (face->font_name)
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1577 : Qnil);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1578 }
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1579
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1580
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1581 DEFUN ("fontset-info", Ffontset_info, Sfontset_info, 1, 2, 0,
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1582 doc: /* Return information about a fontset FONTSET on frame FRAME.
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1583 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
1584
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1585 ((FONT-PATTERN OPENED-FONT ...) ...)
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1586
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1587 FONT-PATTERN is a vector:
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1588
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1589 [ FAMILY WEIGHT SLANT SWIDTH ADSTYLE REGISTRY ]
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1590
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1591 or a string of font name pattern.
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1592
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1593 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
1594
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1595 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
1596 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
1597 fontset. The format is the same as abobe. */)
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1598 (fontset, frame)
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1599 Lisp_Object fontset, frame;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1600 {
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1601 FRAME_PTR f;
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1602 Lisp_Object table, val, elt;
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1603 Lisp_Object *realized;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1604 int n_realized = 0;
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1605 int fallback;
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1606 int c, i, j;
41987
34952771ae85 Fix typos, remove unnecessary space.
Pavel Janík <Pavel@Janik.cz>
parents: 41052
diff changeset
1607
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1608 (*check_window_system_func) ();
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1609
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1610 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
1611
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1612 if (NILP (frame))
25668
99290b59352d (Ffont_info): Change for Lisp_Object selected_frame.
Gerd Moellmann <gerd@gnu.org>
parents: 24611
diff changeset
1613 frame = selected_frame;
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40028
diff changeset
1614 CHECK_LIVE_FRAME (frame);
25668
99290b59352d (Ffont_info): Change for Lisp_Object selected_frame.
Gerd Moellmann <gerd@gnu.org>
parents: 24611
diff changeset
1615 f = XFRAME (frame);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1616
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1617 /* Recode fontsets realized on FRAME from the base fontset FONTSET
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1618 in the table `realized'. */
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1619 realized = (Lisp_Object *) alloca (sizeof (Lisp_Object)
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1620 * ASIZE (Vfontset_table));
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1621 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
1622 {
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1623 elt = FONTSET_FROM_ID (i);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1624 if (!NILP (elt)
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1625 && EQ (FONTSET_BASE (elt), fontset)
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1626 && EQ (FONTSET_FRAME (elt), frame))
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1627 realized[n_realized++] = elt;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1628 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1629
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 table = Fmake_char_table (Qfontset_info, Qnil);
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1632 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
1633 /* Accumulate information of the fontset in TABLE. The format of
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1634 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
1635 for (fallback = 0; fallback <= 1; fallback++)
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1636 {
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1637 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
1638
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1639 if (! fallback)
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 this_fontset = fontset;
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1642 this_table = table;
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1643 }
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1644 else
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1645 {
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1646 this_fontset = Vdefault_fontset;
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1647 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
1648 #if 0
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1649 for (i = 0; i < n_realized; i++)
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1650 realized[i] = FONTSET_FALLBACK (realized[i]);
89428
eed327e0bad3 (BASE_FONTSET_P): Check FONTSET_BASE, not
Kenichi Handa <handa@m17n.org>
parents: 89349
diff changeset
1651 #endif
89349
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 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
1654 {
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1655 int from, to;
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1656
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1657 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
1658 if (VECTORP (val))
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1659 {
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1660 Lisp_Object alist;
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 /* At first, set ALIST to ((FONT-SPEC) ...). */
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1663 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
1664 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
1665 alist = Fnreverse (alist);
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1666
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1667 /* 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
1668 for (i = 0; i < n_realized; i++)
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 if (NILP (realized[i]))
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1671 continue;
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1672 val = FONTSET_REF (realized[i], c);
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1673 if (NILP (val))
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1674 continue;
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1675 val = XCDR (val);
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1676 /* 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
1677 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
1678 FONT-INDEX of the element is integer. */
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1679 for (j = 0; j < ASIZE (val); j++)
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1680 if (INTEGERP (AREF (AREF (val, j), 0)))
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1681 {
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1682 Lisp_Object font_idx;
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1683
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1684 font_idx = AREF (AREF (val, j), 1);
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1685 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
1686 if (CONSP (elt)
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1687 && NILP (Fmemq (font_idx, XCDR(elt))))
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1688 nconc2 (elt, Fcons (font_idx, Qnil));
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1689 }
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1690 }
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1691 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
1692 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
1693 {
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1694 struct font_info *font_info
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1695 = (*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
1696 XSETCAR (elt, build_string (font_info->full_name));
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1697 }
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1698
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1699 /* 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
1700 char_table_set_range (this_table, c, to, alist);
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1701 }
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1702 c = to + 1;
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1703 }
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1704 }
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1705
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1706 return table;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1707 }
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1708
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1709
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1710 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
1711 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
1712 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
1713 (name, ch)
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1714 Lisp_Object name, ch;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1715 {
34975
0d69e2d2724e (fontset_ref): Remove unused variable `i'.
Eli Zaretskii <eliz@gnu.org>
parents: 32978
diff changeset
1716 int c;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1717 Lisp_Object fontset, elt;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1718
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1719 fontset = check_fontset_name (name);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1720
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1721 CHECK_CHARACTER (ch);
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1722 c = XINT (ch);
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1723 elt = FONTSET_REF (fontset, c);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1724 return Fcopy_sequence (elt);
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1725 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1726
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1727 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
1728 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
1729 ()
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1730 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1731 Lisp_Object fontset, list;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1732 int i;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1733
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1734 list = Qnil;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1735 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
1736 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1737 fontset = FONTSET_FROM_ID (i);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1738 if (!NILP (fontset)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1739 && BASE_FONTSET_P (fontset))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1740 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
1741 }
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1742
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1743 return list;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1744 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1745
89610
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1746
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1747 #ifdef FONTSET_DEBUG
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1748
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1749 Lisp_Object
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1750 dump_fontset (fontset)
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1751 Lisp_Object fontset;
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1752 {
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1753 Lisp_Object vec;
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1754
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1755 vec = Fmake_vector (make_number (3), Qnil);
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1756 ASET (vec, 0, FONTSET_ID (fontset));
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1757
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1758 if (BASE_FONTSET_P (fontset))
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1759 {
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1760 ASET (vec, 1, FONTSET_NAME (fontset));
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1761 }
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1762 else
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1763 {
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1764 Lisp_Object frame;
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1765
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1766 frame = FONTSET_FRAME (fontset);
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1767 if (FRAMEP (frame))
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1768 {
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1769 FRAME_PTR f = XFRAME (frame);
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1770
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1771 if (FRAME_LIVE_P (f))
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1772 ASET (vec, 1, f->name);
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1773 else
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1774 ASET (vec, 1, Qt);
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1775 }
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1776 if (!NILP (FONTSET_FALLBACK (fontset)))
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1777 ASET (vec, 2, FONTSET_ID (FONTSET_FALLBACK (fontset)));
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1778 }
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1779 return vec;
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1780 }
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1781
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1782 DEFUN ("fontset-list-all", Ffontset_list_all, Sfontset_list_all, 0, 0, 0,
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1783 doc: /* Return a brief summary of all fontsets for debug use. */)
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1784 ()
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1785 {
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1786 Lisp_Object val;
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1787 int i;
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1788
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1789 for (i = 0, val = Qnil; i < ASIZE (Vfontset_table); i++)
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1790 if (! NILP (AREF (Vfontset_table, i)))
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1791 val = Fcons (dump_fontset (AREF (Vfontset_table, i)), val);
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1792 return (Fnreverse (val));
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1793 }
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1794 #endif /* FONTSET_DEBUG */
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1795
21514
fa9ff387d260 Fix -Wimplicit warnings.
Andreas Schwab <schwab@suse.de>
parents: 21127
diff changeset
1796 void
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1797 syms_of_fontset ()
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1798 {
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1799 if (!load_font_func)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1800 /* Window system initializer should have set proper functions. */
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1801 abort ();
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1802
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1803 DEFSYM (Qfontset, "fontset");
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1804 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
1805 DEFSYM (Qfontset_info, "fontset-info");
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1806 Fput (Qfontset_info, Qchar_table_extra_slots, make_number (1));
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1807
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1808 DEFSYM (Qprepend, "prepend");
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1809 DEFSYM (Qappend, "append");
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1810
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1811 Vcached_fontset_data = Qnil;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1812 staticpro (&Vcached_fontset_data);
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1813
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1814 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
1815 staticpro (&Vfontset_table);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1816
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1817 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
1818 staticpro (&Vdefault_fontset);
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1819 FONTSET_ID (Vdefault_fontset) = make_number (0);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1820 FONTSET_NAME (Vdefault_fontset)
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1821 = build_string ("-*-*-*-*-*-*-*-*-*-*-*-*-fontset-default");
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1822 {
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1823 Lisp_Object default_ascii_font;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1824
32790
131348208699 (syms_of_fontset) [WINDOWSNT]: Special case for ASCII font of default
Jason Rumney <jasonr@gnu.org>
parents: 32752
diff changeset
1825 #if defined (macintosh)
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1826 default_ascii_font
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1827 = 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
1828 #elif defined (WINDOWSNT)
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1829 default_ascii_font
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1830 = 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
1831 #else
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1832 default_ascii_font
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1833 = 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
1834 #endif
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1835 FONTSET_ASCII (Vdefault_fontset) = default_ascii_font;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1836 }
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1837 AREF (Vfontset_table, 0) = Vdefault_fontset;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1838 next_fontset_id = 1;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1839
89610
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1840 auto_fontset_alist = Qnil;
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1841 staticpro (&auto_fontset_alist);
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1842
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1843 DEFVAR_LISP ("font-encoding-alist", &Vfont_encoding_alist,
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1844 doc: /*
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1845 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
1846 Each element looks like (REGEXP . (ENCODING . REPERTORY)),
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1847 where ENCODING is a charset or a char-table,
89483
2f877ed80fa6 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88123 89428
diff changeset
1848 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
1849
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1850 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
1851 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
1852 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
1853 the table by a character gives the corresponding glyph code.
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1854
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1855 REPERTORY specifies a repertory of characters supported by the font.
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1856 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
1857 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
1858 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
1859 gets the repertory information by an opened font and ENCODING. */);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1860 Vfont_encoding_alist = Qnil;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1861
17112
5c48ff325655 (syms_of_fontset): Intern Qfontset. Declare new lisp
Kenichi Handa <handa@m17n.org>
parents: 17071
diff changeset
1862 DEFVAR_LISP ("use-default-ascent", &Vuse_default_ascent,
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1863 doc: /*
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1864 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
1865 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
1866 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
1867
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1868 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
1869 such a character is displayed on screen. */);
19282
09a1536debb4 (Vignore_relative_composition): New variable.
Kenichi Handa <handa@m17n.org>
parents: 19172
diff changeset
1870 Vuse_default_ascent = Qnil;
09a1536debb4 (Vignore_relative_composition): New variable.
Kenichi Handa <handa@m17n.org>
parents: 19172
diff changeset
1871
09a1536debb4 (Vignore_relative_composition): New variable.
Kenichi Handa <handa@m17n.org>
parents: 19172
diff changeset
1872 DEFVAR_LISP ("ignore-relative-composition", &Vignore_relative_composition,
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1873 doc: /*
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1874 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
1875 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
1876 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
1877 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
1878 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
1879 Vignore_relative_composition = Qnil;
17112
5c48ff325655 (syms_of_fontset): Intern Qfontset. Declare new lisp
Kenichi Handa <handa@m17n.org>
parents: 17071
diff changeset
1880
19450
895dc2520755 (Valternate_fontname_alist): Name changed from
Kenichi Handa <handa@m17n.org>
parents: 19282
diff changeset
1881 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
1882 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
1883 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
1884 alternate fontnames (if any) are tried instead. */);
19450
895dc2520755 (Valternate_fontname_alist): Name changed from
Kenichi Handa <handa@m17n.org>
parents: 19282
diff changeset
1885 Valternate_fontname_alist = Qnil;
17193
dc4562b0152a (Valternative_fontname_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17190
diff changeset
1886
17730
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
1887 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
1888 doc: /* Alist of fontset names vs the aliases. */);
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1889 Vfontset_alias_alist = Fcons (Fcons (FONTSET_NAME (Vdefault_fontset),
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1890 build_string ("fontset-default")),
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1891 Qnil);
17730
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
1892
26858
7cc081b4e084 (Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents: 26164
diff changeset
1893 DEFVAR_LISP ("vertical-centering-font-regexp",
7cc081b4e084 (Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents: 26164
diff changeset
1894 &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
1895 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
1896 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
1897 at the vertical center of lines. */);
26858
7cc081b4e084 (Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents: 26164
diff changeset
1898 Vvertical_centering_font_regexp = Qnil;
7cc081b4e084 (Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents: 26164
diff changeset
1899
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1900 defsubr (&Squery_fontset);
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1901 defsubr (&Snew_fontset);
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1902 defsubr (&Sset_fontset_font);
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1903 defsubr (&Sfont_info);
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1904 defsubr (&Sinternal_char_font);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1905 defsubr (&Sfontset_info);
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1906 defsubr (&Sfontset_font);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1907 defsubr (&Sfontset_list);
89610
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1908 #ifdef FONTSET_DEBUG
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1909 defsubr (&Sfontset_list_all);
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1910 #endif
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1911 }