annotate src/fontset.c @ 88536:d3c120a01077

*** empty log message ***
author Dave Love <fx@gnu.org>
date Thu, 16 May 2002 19:31:47 +0000
parents 3d67875ee2b1
children 7471723e43b0
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.
18341
33e78cc7f058 Change copyright notices.
Richard M. Stallman <rms@gnu.org>
parents: 18192
diff changeset
3 Licensed to the Free Software Foundation.
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
4 Copyright (C) 2001, 2002
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
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
45 #ifdef FONTSET_DEBUG
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
46 #undef xassert
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
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
50 #endif
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
51
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
52
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
53 /* FONTSET
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
54
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
55 A fontset is a collection of font related information to give
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
56 similar appearance (style, etc) of characters. There are two kinds
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
57 of fontsets; base and realized. A base fontset is created by
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
58 `new-fontset' from Emacs Lisp explicitly. A realized fontset is
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
59 created implicitly when a face is realized for ASCII characters. A
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
60 face is also realized for non-ASCII characters based on an ASCII
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
61 face. All of non-ASCII faces based on the same ASCII face share
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
62 the same realized fontset.
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
63
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
64 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
65 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
66
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
67 An element of a base fontset is a font specification of the form:
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
68 [ FAMILY WEIGHT SLANT SWIDTH REGISTRY ] (vector of size 5)
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
69 or
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
70 FONT-NAME (strig)
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
71
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
72 FAMILY and REGISTRY are strings.
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
73
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
74 WEIGHT, SLANT, and SWIDTH must be symbols that set-face-attribute
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
75 accepts as attribute values for :weight, :slant, :swidth
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
76 respectively.
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
77
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
78
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
79 A fontset has 7 extra slots.
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
80
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
81 The 1st slot is an ID number of the fontset.
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
82
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
83 The 2nd slot is a name of the fontset in a base fontset, and nil in
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
84 a realized fontset.
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
85
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
86 The 3rd slot is nil in a base fontset, and a base fontset in a
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
87 realized fontset.
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
88
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
89 The 4th slot is a frame that the fontset belongs to. This is nil
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
90 in a base fontset.
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
91
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
92 The 5th slot is a cons of 0 and fontname for ASCII characters in a
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
93 base fontset, and nil in a realized face.
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
94
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
95 The 6th slot is an alist of a charset vs. the corresponding font
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
96 specification.
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
97
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
98 The 7th slot is an alist of a font specification vs. the
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
99 corresponding face ID. In a base fontset, the face IDs are all
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
100 nil.
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
101
30398
dde5ab185aad (fontset_ref): Remove INLINE declaration.
Kenichi Handa <handa@m17n.org>
parents: 30172
diff changeset
102 All fontsets are recorded in Vfontset_table.
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
103
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
104
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
105 DEFAULT FONTSET
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
106
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
107 There's a special fontset named `default fontset' which defines the
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
108 default font specifications. When a base fontset doesn't specify a
30398
dde5ab185aad (fontset_ref): Remove INLINE declaration.
Kenichi Handa <handa@m17n.org>
parents: 30172
diff changeset
109 font for a specific character, the corresponding value in the
dde5ab185aad (fontset_ref): Remove INLINE declaration.
Kenichi Handa <handa@m17n.org>
parents: 30172
diff changeset
110 default fontset is used. The format is the same as a base fontset.
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
111
30398
dde5ab185aad (fontset_ref): Remove INLINE declaration.
Kenichi Handa <handa@m17n.org>
parents: 30172
diff changeset
112 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
113 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
114
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
115
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
116 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
117 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
118 usually use the variable name `fontset' for IDs. But, in this
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
119 file, we always use varialbe name `id' for IDs, and name `fontset'
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
120 for the actual fontset objects (i.e. char-table objects).
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
121
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
122 */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
123
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
124 /********** VARIABLES and FUNCTION PROTOTYPES **********/
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
125
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
126 extern Lisp_Object Qfont;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
127 Lisp_Object Qfontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
128
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
129 /* Vector containing all fontsets. */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
130 static Lisp_Object Vfontset_table;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
131
41987
34952771ae85 Fix typos, remove unnecessary space.
Pavel Janík <Pavel@Janik.cz>
parents: 41052
diff changeset
132 /* 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
133 fontset ID not yet used. */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
134 static int next_fontset_id;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
135
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
136 /* The default fontset. This gives default FAMILY and REGISTRY of
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
137 font for each character. */
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
138 static Lisp_Object Vdefault_fontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
139
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
140 Lisp_Object Vfont_encoding_alist;
17112
5c48ff325655 (syms_of_fontset): Intern Qfontset. Declare new lisp
Kenichi Handa <handa@m17n.org>
parents: 17071
diff changeset
141 Lisp_Object Vuse_default_ascent;
19282
09a1536debb4 (Vignore_relative_composition): New variable.
Kenichi Handa <handa@m17n.org>
parents: 19172
diff changeset
142 Lisp_Object Vignore_relative_composition;
19450
895dc2520755 (Valternate_fontname_alist): Name changed from
Kenichi Handa <handa@m17n.org>
parents: 19282
diff changeset
143 Lisp_Object Valternate_fontname_alist;
17730
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
144 Lisp_Object Vfontset_alias_alist;
26858
7cc081b4e084 (Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents: 26164
diff changeset
145 Lisp_Object Vvertical_centering_font_regexp;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
146
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
147 /* 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
148 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
149 detail. */
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
150
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
151 /* 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
152 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
153
41987
34952771ae85 Fix typos, remove unnecessary space.
Pavel Janík <Pavel@Janik.cz>
parents: 41052
diff changeset
154 /* 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
155 of `x-list-fonts' for more details. */
23517
73f09e7bc96e Include frame.h before fontset.h.
Kenichi Handa <handa@m17n.org>
parents: 22719
diff changeset
156 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
157 Lisp_Object pattern,
73f09e7bc96e Include frame.h before fontset.h.
Kenichi Handa <handa@m17n.org>
parents: 22719
diff changeset
158 int size,
73f09e7bc96e Include frame.h before fontset.h.
Kenichi Handa <handa@m17n.org>
parents: 22719
diff changeset
159 int maxnames));
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
160
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
161 /* 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
162 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
163 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
164
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
165 /* 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
166 struct font_info *(*query_font_func) P_ ((FRAME_PTR f, char *name));
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
167
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
168 /* Additional function for setting fontset or changing fontset
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
169 contents of frame F. */
20315
931b4ddf7966 Protoize functions declarations.
Andreas Schwab <schwab@suse.de>
parents: 19450
diff changeset
170 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
171 Lisp_Object oldval));
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
172
21553
2d7afcd11b72 (find_ccl_program_func): New variable.
Kenichi Handa <handa@m17n.org>
parents: 21514
diff changeset
173 /* 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
174 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
175 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
176 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
177
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
178 /* Check if any window system is used now. */
20315
931b4ddf7966 Protoize functions declarations.
Andreas Schwab <schwab@suse.de>
parents: 19450
diff changeset
179 void (*check_window_system_func) P_ ((void));
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
180
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 /* Prototype declarations for static functions. */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
183 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
184 static int fontset_id_valid_p P_ ((int));
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
185 static Lisp_Object fontset_pattern_regexp P_ ((Lisp_Object));
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
186
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
187
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
188 /********** 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
189
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
190 /* 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
191 #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
192
30398
dde5ab185aad (fontset_ref): Remove INLINE declaration.
Kenichi Handa <handa@m17n.org>
parents: 30172
diff changeset
193 /* 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
194 #define FONTSET_ID(fontset) XCHAR_TABLE (fontset)->extras[0]
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
195
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
196 /* 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
197 #define FONTSET_NAME(fontset) XCHAR_TABLE (fontset)->extras[1]
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
198 #define FONTSET_ASCII(fontset) XCHAR_TABLE (fontset)->extras[4]
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
199
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
200 #define BASE_FONTSET_P(fontset) STRINGP (FONTSET_NAME (fontset))
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
201
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
202 /* Macros to access special values of (realized) FONTSET. */
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
203 #define FONTSET_BASE(fontset) XCHAR_TABLE (fontset)->extras[2]
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
204 #define FONTSET_FRAME(fontset) XCHAR_TABLE (fontset)->extras[3]
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
205 #define FONTSET_CHARSET_ALIST(fontset) XCHAR_TABLE (fontset)->extras[5]
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
206 #define FONTSET_FACE_ALIST(fontset) XCHAR_TABLE (fontset)->extras[6]
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
207
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
208
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
209 /* Return the element of FONTSET (char-table) at index C (character). */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
210
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
211 #define FONTSET_REF(fontset, c, etl) ((elt) = fontset_ref ((fontset), (c)))
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
212
30398
dde5ab185aad (fontset_ref): Remove INLINE declaration.
Kenichi Handa <handa@m17n.org>
parents: 30172
diff changeset
213 static Lisp_Object
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
214 fontset_ref (fontset, c)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
215 Lisp_Object fontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
216 int c;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
217 {
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
218 Lisp_Object elt;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
219
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
220 while (1)
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
221 {
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
222 elt = CHAR_TABLE_REF (fontset, c);
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
223 if (NILP (elt) && ASCII_CHAR_P (c))
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
224 elt = FONTSET_ASCII (fontset);
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
225 if (NILP (elt))
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
226 {
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
227 Lisp_Object tail;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
228 struct charset *charset;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
229
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
230 for (tail = FONTSET_CHARSET_ALIST (fontset);
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
231 CONSP (tail); tail = XCDR (tail))
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
232 {
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
233 charset = CHARSET_FROM_ID (XCAR (XCAR (tail)));
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
234 if (ENCODE_CHAR (charset, c) != CHARSET_INVALID_CODE (charset))
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
235 {
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
236 elt = XCDR (XCAR (tail));
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
237 break;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
238 }
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
239 }
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
240 }
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
241 if (! NILP (elt) || EQ (fontset, Vdefault_fontset))
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
242 break;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
243 fontset = Vdefault_fontset;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
244 }
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
245 return elt;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
246 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
247
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
248
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
249 /* Set the element of FONTSET at index IDX to the value ELT. IDX may
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
250 be a character or a charset. */
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
251
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
252 #define FONTSET_SET(fontset, c, newelt) fontset_set(fontset, c, newelt)
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
253
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
254 static void
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
255 fontset_set (fontset, idx, elt)
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
256 Lisp_Object fontset, idx, elt;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
257 {
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
258 if (SYMBOLP (idx))
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
259 {
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
260 Lisp_Object id, slot, tail;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
261
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
262 id = make_number (CHARSET_SYMBOL_ID (idx));
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
263 if (id == charset_ascii)
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
264 Fset_char_table_range (fontset,
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
265 Fcons (make_number (0), make_number (127)),
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
266 elt);
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
267 else
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
268 {
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
269 slot = Fassq (id, FONTSET_CHARSET_ALIST (fontset));
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
270 if (CONSP (slot))
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
271 XCDR (slot) = elt;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
272 else if (CONSP (FONTSET_CHARSET_ALIST (fontset)))
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 for (tail = FONTSET_CHARSET_ALIST (fontset);
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
275 CONSP (XCDR (tail)); tail = XCDR (tail));
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
276 XCDR (tail) = Fcons (Fcons (id, elt), Qnil);
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
277 }
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
278 else
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
279 FONTSET_CHARSET_ALIST (fontset) = Fcons (Fcons (id, elt), Qnil);
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
280 }
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
281 }
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
282 else
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
283 {
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
284 int from = XINT (XCAR (idx));
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
285 int to = XINT (XCDR (idx));
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
286
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
287 if (from == to)
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
288 CHAR_TABLE_SET (fontset, from, elt);
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
289 else
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
290 Fset_char_table_range (fontset, idx, elt);
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
291 }
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
292 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
293
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
294
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
295 /* Return a face registerd in the realized fontset FONTSET for the
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
296 character C. Return -1 if a face ID is not yet set. */
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
297
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
298 static struct face *
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
299 fontset_face (fontset, c)
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
300 Lisp_Object fontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
301 int c;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
302 {
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
303 Lisp_Object base, elt;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
304 int id;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
305 struct face *face;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
306
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
307 base = FONTSET_BASE (fontset);
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
308 FONTSET_REF (base, c, elt);
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
309
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
310 if (NILP (elt))
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
311 return NULL;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
312
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
313 elt = Fassoc (elt, FONTSET_FACE_ALIST (fontset));
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
314 if (! CONSP (elt))
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
315 return NULL;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
316 id = XINT (XCDR (elt));
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
317 face = FACE_FROM_ID (XFRAME (FONTSET_FRAME (fontset)), id);
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
318 return face;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
319 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
320
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
321
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
322 /* 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
323 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
324 BASE. */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
325
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
326 static Lisp_Object
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
327 make_fontset (frame, name, base)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
328 Lisp_Object frame, name, base;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
329 {
34975
0d69e2d2724e (fontset_ref): Remove unused variable `i'.
Eli Zaretskii <eliz@gnu.org>
parents: 32978
diff changeset
330 Lisp_Object fontset;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
331 int size = ASIZE (Vfontset_table);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
332 int id = next_fontset_id;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
333
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
334 /* 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
335 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
336 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
337 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
338 id. */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
339 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
340
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
341 if (id + 1 == size)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
342 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
343 Lisp_Object tem;
41987
34952771ae85 Fix typos, remove unnecessary space.
Pavel Janík <Pavel@Janik.cz>
parents: 41052
diff changeset
344 int i;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
345
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
346 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
347 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
348 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
349 Vfontset_table = tem;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
350 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
351
29767
c8e5453dc85d (FONTSET_ASCII): Use the first element of char table
Kenichi Handa <handa@m17n.org>
parents: 29501
diff changeset
352 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
353
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
354 FONTSET_ID (fontset) = make_number (id);
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
355 if (NILP (base))
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
356 {
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
357 FONTSET_NAME (fontset) = name;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
358 }
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
359 else
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
360 {
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
361 FONTSET_NAME (fontset) = Qnil;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
362 FONTSET_FRAME (fontset) = frame;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
363 FONTSET_BASE (fontset) = base;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
364 }
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
365
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
366 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
367 next_fontset_id = id + 1;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
368 return fontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
369 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
370
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
371
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
372
41987
34952771ae85 Fix typos, remove unnecessary space.
Pavel Janík <Pavel@Janik.cz>
parents: 41052
diff changeset
373 /********** INTERFACES TO xfaces.c and dispextern.h **********/
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
374
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
375 /* Return name of the fontset with ID. */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
376
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
377 Lisp_Object
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
378 fontset_name (id)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
379 int id;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
380 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
381 Lisp_Object fontset;
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
382
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
383 fontset = FONTSET_FROM_ID (id);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
384 return FONTSET_NAME (fontset);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
385 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
386
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
387
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
388 /* Return ASCII font name of the fontset with ID. */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
389
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
390 Lisp_Object
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
391 fontset_ascii (id)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
392 int id;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
393 {
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
394 Lisp_Object fontset;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
395
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
396 fontset= FONTSET_FROM_ID (id);
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
397 return FONTSET_ASCII (fontset);
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
398 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
399
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
400
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
401 /* Free fontset of FACE defined on frame F. Called from
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
402 free_realized_face. */
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
403
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
404 void
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
405 free_face_fontset (f, face)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
406 FRAME_PTR f;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
407 struct face *face;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
408 {
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
409 AREF (Vfontset_table, face->fontset) = Qnil;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
410 if (face->fontset < next_fontset_id)
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
411 next_fontset_id = face->fontset;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
412 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
413
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
414
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
415 /* 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
416 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
417 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
418
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
419 int
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
420 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
421 struct face *face;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
422 int c;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
423 {
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
424 Lisp_Object fontset;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
425
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
426 fontset = FONTSET_FROM_ID (face->fontset);
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
427 return (face == fontset_face (fontset, c));
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
428 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
429
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
430
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
431 /* Return ID of face suitable for displaying character C on frame F.
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
432 The selection of face is done based on the fontset of FACE. FACE
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
433 must be reazlied for ASCII characters in advance. Called from the
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
434 macro FACE_FOR_CHAR when C is not an ASCII character. */
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
435
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
436 int
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
437 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
438 FRAME_PTR f;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
439 struct face *face;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
440 int c;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
441 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
442 Lisp_Object fontset, elt;
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
443 struct face *new_face;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
444
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
445 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
446 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
447 xassert (!BASE_FONTSET_P (fontset));
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
448
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
449 new_face = fontset_face (fontset, c);
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
450 if (new_face)
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
451 return new_face->id;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
452
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
453 /* No face is recorded for C in the fontset of FACE. Make a new
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
454 realized face for C that has the same fontset. */
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
455 return lookup_face (f, face->lface, c, face);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
456 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
457
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
458
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
459 /* 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
460 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
461 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
462 Called from realize_x_face. */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
463
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
464 int
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
465 make_fontset_for_ascii_face (f, base_fontset_id)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
466 FRAME_PTR f;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
467 int base_fontset_id;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
468 {
34975
0d69e2d2724e (fontset_ref): Remove unused variable `i'.
Eli Zaretskii <eliz@gnu.org>
parents: 32978
diff changeset
469 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
470
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
471 XSETFRAME (frame, f);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
472 if (base_fontset_id >= 0)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
473 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
474 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
475 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
476 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
477 xassert (BASE_FONTSET_P (base_fontset));
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
478 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
479 else
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
480 base_fontset = Vdefault_fontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
481
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
482 fontset = make_fontset (frame, Qnil, base_fontset);
28511
7a9707590ccd (make_fontset_for_ascii_face): Use XINT on return value.
Ken Raeburn <raeburn@raeburn.org>
parents: 28241
diff changeset
483 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
484 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
485
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
486
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
487 /* Return FONT-SPEC recorded in the fontset of FACE for character C.
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
488 If FACE is null, or the fontset doesn't contain information about
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
489 C, get the font name pattern from the default fontset. Called from
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
490 choose_face_font. */
18346
c46e9f750033 (font_idx_temp): New temprary variable used in FS_LOAD_FONT.
Kenichi Handa <handa@m17n.org>
parents: 18341
diff changeset
491
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
492 Lisp_Object
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
493 fontset_font_pattern (f, face, c)
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
494 FRAME_PTR f;
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
495 struct face *face;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
496 int c;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
497 {
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
498 Lisp_Object fontset, base, elt;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
499 int id = face ? face->fontset : -1;
41987
34952771ae85 Fix typos, remove unnecessary space.
Pavel Janík <Pavel@Janik.cz>
parents: 41052
diff changeset
500
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
501 if (id >= 0)
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
502 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
503 fontset = FONTSET_FROM_ID (id);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
504 xassert (!BASE_FONTSET_P (fontset));
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
505 base = FONTSET_BASE (fontset);
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
506 }
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
507 else
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
508 {
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
509 base = Vdefault_fontset;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
510 }
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
511
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
512 FONTSET_REF (base, c, elt);
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
513 if (face && ! NILP (elt))
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
514 {
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
515 Lisp_Object slot;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
516
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
517 slot = Fassoc (elt, FONTSET_FACE_ALIST (fontset));
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
518 if (CONSP (slot))
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
519 XSETCDR (slot, make_number (face->id));
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
520 FONTSET_FACE_ALIST (fontset)
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
521 = Fcons (Fcons (elt, make_number (face->id)),
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
522 FONTSET_FACE_ALIST (fontset));
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
523 }
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
524 return elt;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
525 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
526
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
527
40028
392c2fe9edd7 (fs_load_font) [WINDOWSNT && _MSC_VER]: Disable
Andrew Innes <andrewi@gnu.org>
parents: 39973
diff changeset
528 #if defined(WINDOWSNT) && defined (_MSC_VER)
392c2fe9edd7 (fs_load_font) [WINDOWSNT && _MSC_VER]: Disable
Andrew Innes <andrewi@gnu.org>
parents: 39973
diff changeset
529 #pragma optimize("", off)
392c2fe9edd7 (fs_load_font) [WINDOWSNT && _MSC_VER]: Disable
Andrew Innes <andrewi@gnu.org>
parents: 39973
diff changeset
530 #endif
392c2fe9edd7 (fs_load_font) [WINDOWSNT && _MSC_VER]: Disable
Andrew Innes <andrewi@gnu.org>
parents: 39973
diff changeset
531
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
532 /* 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
533 struct font_info of the loaded font. If loading fails, return
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
534 NULL. */
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
535
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
536 struct font_info *
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
537 fs_load_font (f, fontname)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
538 FRAME_PTR f;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
539 char *fontname;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
540 {
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
541 Lisp_Object tail, elt;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
542 struct font_info *fontp;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
543
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
544 if (!fontname)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
545 /* No way to get fontname. */
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
546 return 0;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
547
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
548 fontp = (*load_font_func) (f, fontname, 0);
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
549 if (!fontp)
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
550 return NULL;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
551
88500
3d67875ee2b1 (fs_load_font): Check fontp->full_name (not fontname)
Kenichi Handa <handa@m17n.org>
parents: 88482
diff changeset
552 fontname = fontp->full_name;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
553 /* Fill in members (charset, vertical_centering, encoding, etc) of
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
554 font_info structure that are not set by (*load_font_func). */
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
555 for (tail = Vfont_encoding_alist; CONSP (tail); tail = XCDR (tail))
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
556 {
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
557 elt = XCAR (tail);
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
558 if (STRINGP (XCAR (elt)) && CHARSETP (XCDR (elt))
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
559 && fast_c_string_match_ignore_case (XCAR (elt), fontname) >= 0)
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
560 {
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
561 fontp->charset = CHARSET_SYMBOL_ID (XCDR (elt));
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
562 break;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
563 }
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
564 }
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
565 if (! CONSP (tail))
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
566 return NULL;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
567
26858
7cc081b4e084 (Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents: 26164
diff changeset
568 fontp->vertical_centering
7cc081b4e084 (Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents: 26164
diff changeset
569 = (STRINGP (Vvertical_centering_font_regexp)
41987
34952771ae85 Fix typos, remove unnecessary space.
Pavel Janík <Pavel@Janik.cz>
parents: 41052
diff changeset
570 && (fast_c_string_match_ignore_case
88500
3d67875ee2b1 (fs_load_font): Check fontp->full_name (not fontname)
Kenichi Handa <handa@m17n.org>
parents: 88482
diff changeset
571 (Vvertical_centering_font_regexp, fontname) >= 0));
26858
7cc081b4e084 (Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents: 26164
diff changeset
572
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
573 fontp->font_encoder = NULL;
21553
2d7afcd11b72 (find_ccl_program_func): New variable.
Kenichi Handa <handa@m17n.org>
parents: 21514
diff changeset
574
2d7afcd11b72 (find_ccl_program_func): New variable.
Kenichi Handa <handa@m17n.org>
parents: 21514
diff changeset
575 if (find_ccl_program_func)
2d7afcd11b72 (find_ccl_program_func): New variable.
Kenichi Handa <handa@m17n.org>
parents: 21514
diff changeset
576 (*find_ccl_program_func) (fontp);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
577
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
578 return fontp;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
579 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
580
40028
392c2fe9edd7 (fs_load_font) [WINDOWSNT && _MSC_VER]: Disable
Andrew Innes <andrewi@gnu.org>
parents: 39973
diff changeset
581 #if defined(WINDOWSNT) && defined (_MSC_VER)
392c2fe9edd7 (fs_load_font) [WINDOWSNT && _MSC_VER]: Disable
Andrew Innes <andrewi@gnu.org>
parents: 39973
diff changeset
582 #pragma optimize("", on)
392c2fe9edd7 (fs_load_font) [WINDOWSNT && _MSC_VER]: Disable
Andrew Innes <andrewi@gnu.org>
parents: 39973
diff changeset
583 #endif
392c2fe9edd7 (fs_load_font) [WINDOWSNT && _MSC_VER]: Disable
Andrew Innes <andrewi@gnu.org>
parents: 39973
diff changeset
584
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
585
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
586 /* Cache data used by fontset_pattern_regexp. The car part is a
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
587 pattern string containing at least one wild card, the cdr part is
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
588 the corresponding regular expression. */
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
589 static Lisp_Object Vcached_fontset_data;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
590
26164
d39ec0a27081 more XCAR/XCDR/XFLOAT_DATA uses, to help isolete lisp engine
Ken Raeburn <raeburn@raeburn.org>
parents: 25668
diff changeset
591 #define CACHED_FONTSET_NAME (XSTRING (XCAR (Vcached_fontset_data))->data)
d39ec0a27081 more XCAR/XCDR/XFLOAT_DATA uses, to help isolete lisp engine
Ken Raeburn <raeburn@raeburn.org>
parents: 25668
diff changeset
592 #define CACHED_FONTSET_REGEX (XCDR (Vcached_fontset_data))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
593
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
594 /* If fontset name PATTERN contains any wild card, return regular
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
595 expression corresponding to PATTERN. */
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
596
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
597 static Lisp_Object
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
598 fontset_pattern_regexp (pattern)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
599 Lisp_Object pattern;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
600 {
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
601 if (!index (XSTRING (pattern)->data, '*')
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
602 && !index (XSTRING (pattern)->data, '?'))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
603 /* PATTERN does not contain any wild cards. */
17730
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
604 return Qnil;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
605
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
606 if (!CONSP (Vcached_fontset_data)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
607 || strcmp (XSTRING (pattern)->data, CACHED_FONTSET_NAME))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
608 {
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
609 /* We must at first update the cached data. */
35663
e5dea4a61cab * fontset.c (fontset_pattern_regexp): Allocate three more bytes to
Andrew Choi <akochoi@shaw.ca>
parents: 35658
diff changeset
610 char *regex = (char *) alloca (XSTRING (pattern)->size * 2 + 3);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
611 char *p0, *p1 = regex;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
612
17730
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
613 /* Convert "*" to ".*", "?" to ".". */
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
614 *p1++ = '^';
17827
95010205f916 (fontset_pattern_regexp): Cast to (char *) before
Kenichi Handa <handa@m17n.org>
parents: 17730
diff changeset
615 for (p0 = (char *) XSTRING (pattern)->data; *p0; p0++)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
616 {
17730
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
617 if (*p0 == '*')
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
618 {
17730
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
619 *p1++ = '.';
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
620 *p1++ = '*';
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
621 }
17730
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
622 else if (*p0 == '?')
21127
577865651099 (fontset_pattern_regexp): `==' was used instead of `='.
Richard M. Stallman <rms@gnu.org>
parents: 20346
diff changeset
623 *p1++ = '.';
17730
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
624 else
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
625 *p1++ = *p0;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
626 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
627 *p1++ = '$';
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
628 *p1++ = 0;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
629
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
630 Vcached_fontset_data = Fcons (build_string (XSTRING (pattern)->data),
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
631 build_string (regex));
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
632 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
633
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
634 return CACHED_FONTSET_REGEX;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
635 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
636
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
637 /* 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
638 fontset, return -1. */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
639
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
640 int
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
641 fs_query_fontset (name, regexpp)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
642 Lisp_Object name;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
643 int regexpp;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
644 {
34975
0d69e2d2724e (fontset_ref): Remove unused variable `i'.
Eli Zaretskii <eliz@gnu.org>
parents: 32978
diff changeset
645 Lisp_Object tem;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
646 int i;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
647
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
648 name = Fdowncase (name);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
649 if (!regexpp)
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 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
652 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
653 name = XCAR (tem);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
654 else
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 tem = fontset_pattern_regexp (name);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
657 if (STRINGP (tem))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
658 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
659 name = tem;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
660 regexpp = 1;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
661 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
662 }
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
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
665 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
666 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
667 Lisp_Object fontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
668 unsigned char *this_name;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
669
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
670 fontset = FONTSET_FROM_ID (i);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
671 if (NILP (fontset)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
672 || !BASE_FONTSET_P (fontset))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
673 continue;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
674
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
675 this_name = XSTRING (FONTSET_NAME (fontset))->data;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
676 if (regexpp
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
677 ? fast_c_string_match_ignore_case (name, this_name) >= 0
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
678 : !strcmp (XSTRING (name)->data, this_name))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
679 return i;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
680 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
681 return -1;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
682 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
683
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
684
21553
2d7afcd11b72 (find_ccl_program_func): New variable.
Kenichi Handa <handa@m17n.org>
parents: 21514
diff changeset
685 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
686 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
687 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
688 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
689 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
690 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
691 (pattern, regexpp)
21553
2d7afcd11b72 (find_ccl_program_func): New variable.
Kenichi Handa <handa@m17n.org>
parents: 21514
diff changeset
692 Lisp_Object pattern, regexpp;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
693 {
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
694 Lisp_Object fontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
695 int id;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
696
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
697 (*check_window_system_func) ();
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
698
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40028
diff changeset
699 CHECK_STRING (pattern);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
700
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
701 if (XSTRING (pattern)->size == 0)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
702 return Qnil;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
703
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
704 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
705 if (id < 0)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
706 return Qnil;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
707
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
708 fontset = FONTSET_FROM_ID (id);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
709 return FONTSET_NAME (fontset);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
710 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
711
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
712 /* Return a list of base fontset names matching PATTERN on frame F. */
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
713
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
714 Lisp_Object
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
715 list_fontsets (f, pattern, size)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
716 FRAME_PTR f;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
717 Lisp_Object pattern;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
718 int size;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
719 {
34975
0d69e2d2724e (fontset_ref): Remove unused variable `i'.
Eli Zaretskii <eliz@gnu.org>
parents: 32978
diff changeset
720 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
721 int id;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
722
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
723 XSETFRAME (frame, f);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
724
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
725 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
726 val = Qnil;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
727
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
728 for (id = 0; id < ASIZE (Vfontset_table); id++)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
729 {
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
730 Lisp_Object fontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
731 unsigned char *name;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
732
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
733 fontset = FONTSET_FROM_ID (id);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
734 if (NILP (fontset)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
735 || !BASE_FONTSET_P (fontset)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
736 || !EQ (frame, FONTSET_FRAME (fontset)))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
737 continue;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
738 name = XSTRING (FONTSET_NAME (fontset))->data;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
739
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
740 if (!NILP (regexp)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
741 ? (fast_c_string_match_ignore_case (regexp, name) < 0)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
742 : strcmp (XSTRING (pattern)->data, name))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
743 continue;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
744
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
745 val = Fcons (Fcopy_sequence (FONTSET_NAME (fontset)), val);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
746 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
747
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
748 return val;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
749 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
750
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
751
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
752 /* Free all realized fontsets whose base fontset is BASE. */
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
753
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
754 static void
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
755 free_realized_fontsets (base)
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
756 Lisp_Object base;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
757 {
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
758 int id;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
759
88482
effba1417b74 (free_realized_fontsets): Call Fclear_face_cache instead
Kenichi Handa <handa@m17n.org>
parents: 88405
diff changeset
760 #if 0
effba1417b74 (free_realized_fontsets): Call Fclear_face_cache instead
Kenichi Handa <handa@m17n.org>
parents: 88405
diff changeset
761 /* 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
762 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
763 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
764 that is not efficient. */
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
765 BLOCK_INPUT;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
766 for (id = 0; id < ASIZE (Vfontset_table); id++)
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
767 {
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
768 Lisp_Object this = AREF (Vfontset_table, id);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
769
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
770 if (EQ (FONTSET_BASE (this), base))
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
771 {
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
772 Lisp_Object tail;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
773
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
774 for (tail = FONTSET_FACE_ALIST (this); CONSP (tail);
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
775 tail = XCDR (tail))
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
776 {
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
777 FRAME_PTR f = XFRAME (FONTSET_FRAME (this));
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
778 int face_id = XINT (XCDR (XCAR (tail)));
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
779 struct face *face = FACE_FROM_ID (f, face_id);
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
780
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
781 /* Face THIS itself is also freed by the following call. */
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
782 free_realized_face (f, face);
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
783 }
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
784 }
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
785 }
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
786 UNBLOCK_INPUT;
88482
effba1417b74 (free_realized_fontsets): Call Fclear_face_cache instead
Kenichi Handa <handa@m17n.org>
parents: 88405
diff changeset
787 #else /* not 0 */
effba1417b74 (free_realized_fontsets): Call Fclear_face_cache instead
Kenichi Handa <handa@m17n.org>
parents: 88405
diff changeset
788 Fclear_face_cache (Qt);
effba1417b74 (free_realized_fontsets): Call Fclear_face_cache instead
Kenichi Handa <handa@m17n.org>
parents: 88405
diff changeset
789 #endif /* not 0 */
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
790 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
791
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
792
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
793 /* 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
794 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
795 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
796
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
797 static Lisp_Object
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
798 check_fontset_name (name)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
799 Lisp_Object name;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
800 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
801 int id;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
802
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
803 if (EQ (name, Qt))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
804 return Vdefault_fontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
805
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40028
diff changeset
806 CHECK_STRING (name);
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
807 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
808 if (id < 0)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
809 error ("Fontset `%s' does not exist", XSTRING (name)->data);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
810 return FONTSET_FROM_ID (id);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
811 }
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
812
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
813 DEFUN ("set-fontset-font", Fset_fontset_font, Sset_fontset_font, 3, 4, 0,
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
814 doc: /* Modify fontset NAME to use FONT-SPEC for characters of CHARSETS.
41001
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
815
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
816 CHARSET may be a cons; (FROM . TO), where FROM and TO are characters.
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
817 In that case, use FONT-SPEC for all characters in the range FROM and
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
818 TO (inclusive).
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
819
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
820 FONT-SPEC is be a vector; [ FAMILY WEIGHT SLANT WIDTH ADSTYLE REGISTRY ]
41001
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
821
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
822 FONT-SPEC may be a cons; (FAMILY . REGISTRY), where FAMILY is a family
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
823 name of a font, REGSITRY is a registry name of a font.
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
824
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
825 FONT-SPEC may be a font name string. */)
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
826 (name, charset, font_spec, frame)
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
827 Lisp_Object name, charset, font_spec, frame;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
828 {
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
829 Lisp_Object fontset;
29233
a09ee5c15dcb (check_registry_encoding): This function deleted.
Kenichi Handa <handa@m17n.org>
parents: 29231
diff changeset
830 Lisp_Object family, registry;
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
831 int charset_id;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
832
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
833 fontset = check_fontset_name (name);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
834
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
835 if (VECTORP (font_spec))
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
836 {
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
837 int i;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
838 Lisp_Object val;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
839
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
840 font_spec = Fcopy_sequence (font_spec);
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
841 for (i = 0; i < 5; i++)
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
842 {
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
843 val = Faref (font_spec, make_number (i));
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
844 if (! NILP (val))
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
845 {
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
846 CHECK_STRING (val);
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
847 ASET (font_spec, i, Fdowncase (val));
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
848 }
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
849 }
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
850 val = Faref (font_spec, make_number (5));
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
851 CHECK_STRING (val);
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
852 ASET (font_spec, 5, Fdowncase (val));
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
853 }
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
854 else if (STRINGP (font_spec))
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
855 font_spec = Fdowncase (font_spec);
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
856 else if (CONSP (font_spec))
29501
f901ec87b147 (Fset_fontset_font): The arg CHARACTER may be a charset.
Kenichi Handa <handa@m17n.org>
parents: 29233
diff changeset
857 {
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
858 CHECK_CONS (font_spec);
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
859 family = XCAR (font_spec);
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
860 registry = XCDR (font_spec);
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
861 font_spec = Fmake_vector (make_number (6), Qnil);
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
862 if (!NILP (family))
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
863 {
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
864 CHECK_STRING (family);
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
865 ASET (font_spec, 0, Fdowncase (family));
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
866 }
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
867 CHECK_STRING (registry);
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
868 ASET (font_spec, 5, Fdowncase (registry));
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
869 }
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
870
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
871 if (SYMBOLP (charset))
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
872 {
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
873 CHECK_CHARSET (charset);
29501
f901ec87b147 (Fset_fontset_font): The arg CHARACTER may be a charset.
Kenichi Handa <handa@m17n.org>
parents: 29233
diff changeset
874 }
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
875 else
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
876 {
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
877 Lisp_Object from, to;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
878
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
879 /* CHARSET should be (FROM . TO). */
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
880 from = Fcar (charset);
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
881 to = Fcdr (charset);
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
882 CHECK_CHARACTER (from);
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
883 CHECK_CHARACTER (to);
29233
a09ee5c15dcb (check_registry_encoding): This function deleted.
Kenichi Handa <handa@m17n.org>
parents: 29231
diff changeset
884 }
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
885
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
886 /* 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
887 the validity. */
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
888 if (!NILP (frame))
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40028
diff changeset
889 CHECK_LIVE_FRAME (frame);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
890
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
891 FONTSET_SET (fontset, charset, font_spec);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
892
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
893 /* Free all realized fontsets whose base is FONTSET. This way, the
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
894 specified character(s) are surely redisplayed by a correct
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
895 font. */
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
896 free_realized_fontsets (fontset);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
897
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
898 return Qnil;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
899 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
900
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
901
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
902 DEFUN ("new-fontset", Fnew_fontset, Snew_fontset, 2, 2, 0,
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
903 doc: /* Create a new fontset NAME from font information in FONTLIST.
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
904
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
905 FONTLIST is an alist of charsets vs corresponding font specifications.
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
906 Each element of FONTLIST has the form (CHARSET . FONT-SPEC), where
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
907 a character of CHARSET is displayed by a font that matches FONT-SPEC.
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
908
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
909 FONT-SPEC is a vector [ FAMILY WEIGHT SLANT WIDTH ADSTYLE REGISTRY ], where
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
910 FAMILY is a string specifying the font family,
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
911 WEIGHT is a string specifying the weight of the font,
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
912 SLANT is a string specifying the slant of the font,
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
913 WIDTH is a string specifying the width of the font,
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
914 ADSTYLE is a string specifying the adstyle of the font,
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
915 REGISTRY is a string specifying the charset-registry of the font.
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
916
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
917 See also the documentation of `set-face-attribute' for the detail of
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
918 these vector elements.
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
919
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
920 FONT-SPEC may be a font name (string). */)
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
921 (name, fontlist)
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
922 Lisp_Object name, fontlist;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
923 {
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
924 Lisp_Object fontset, ascii_font;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
925 Lisp_Object tem, tail;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
926
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
927 CHECK_STRING (name);
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
928 CHECK_LIST (fontlist);
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
929
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
930 name = Fdowncase (name);
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
931 tem = Fquery_fontset (name, Qnil);
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
932 if (! NILP (tem))
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
933 free_realized_fontsets (tem);
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
934
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
935 fontset = make_fontset (Qnil, name, Qnil);
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
936
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
937 /* Check the validity of FONTLIST. */
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
938 ascii_font = Fcdr (Fassq (Qascii, fontlist));
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
939 if (NILP (ascii_font))
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
940 error ("No ascii font specified");
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
941 if (! STRINGP (ascii_font))
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
942 ascii_font = generate_ascii_font (name, ascii_font);
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
943
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
944 fontlist = Fcopy_sequence (fontlist);
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
945 for (tail = fontlist; ! NILP (tail); tail = Fcdr (tail))
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
946 Fset_fontset_font (name, Fcar (Fcar (tail)), Fcdr (Fcar (tail)), Qnil);
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
947
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
948 FONTSET_ASCII (fontset) = ascii_font;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
949
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
950 return name;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
951 }
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
952
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
953
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
954 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
955 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
956 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
957 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
958 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
959 where
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
960 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
961 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
962 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
963 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
964 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
965 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
966 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
967 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
968 (name, frame)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
969 Lisp_Object name, frame;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
970 {
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
971 FRAME_PTR f;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
972 struct font_info *fontp;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
973 Lisp_Object info;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
974
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
975 (*check_window_system_func) ();
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
976
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40028
diff changeset
977 CHECK_STRING (name);
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
978 name = Fdowncase (name);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
979 if (NILP (frame))
25668
99290b59352d (Ffont_info): Change for Lisp_Object selected_frame.
Gerd Moellmann <gerd@gnu.org>
parents: 24611
diff changeset
980 frame = selected_frame;
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40028
diff changeset
981 CHECK_LIVE_FRAME (frame);
25668
99290b59352d (Ffont_info): Change for Lisp_Object selected_frame.
Gerd Moellmann <gerd@gnu.org>
parents: 24611
diff changeset
982 f = XFRAME (frame);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
983
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
984 if (!query_font_func)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
985 error ("Font query function is not supported");
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
986
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
987 fontp = (*query_font_func) (f, XSTRING (name)->data);
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
988 if (!fontp)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
989 return Qnil;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
990
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
991 info = Fmake_vector (make_number (7), Qnil);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
992
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
993 XVECTOR (info)->contents[0] = build_string (fontp->name);
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
994 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
995 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
996 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
997 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
998 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
999 XVECTOR (info)->contents[6] = make_number (fontp->default_ascent);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1000
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1001 return info;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1002 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1003
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1004
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1005 /* 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
1006 buffer. This is computed from all the text properties and overlays
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1007 that apply to POSITION. It returns nil in the following cases:
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1008
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1009 (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
1010 it is displayed by an empty box).
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1011
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1012 (2) The character code is invalid.
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1013
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1014 (3) The current buffer is not displayed in any window.
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1015
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1016 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
1017 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
1018 POSITION is currently not visible. */
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1019
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1020
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1021 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
1022 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
1023 (position)
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1024 Lisp_Object position;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1025 {
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1026 int pos, pos_byte, dummy;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1027 int face_id;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1028 int c;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1029 Lisp_Object window;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1030 struct window *w;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1031 struct frame *f;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1032 struct face *face;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1033
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40028
diff changeset
1034 CHECK_NUMBER_COERCE_MARKER (position);
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1035 pos = XINT (position);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1036 if (pos < BEGV || pos >= ZV)
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1037 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
1038 pos_byte = CHAR_TO_BYTE (pos);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1039 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
1040 window = Fget_buffer_window (Fcurrent_buffer (), Qnil);
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1041 if (NILP (window))
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1042 return Qnil;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1043 w = XWINDOW (window);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1044 f = XFRAME (w->frame);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1045 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
1046 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
1047 face = FACE_FROM_ID (f, face_id);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1048 return (face->font && face->font_name
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1049 ? build_string (face->font_name)
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1050 : Qnil);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1051 }
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1052
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1053
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1054 /* Called from Ffontset_info via map_char_table on each leaf of
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1055 fontset. ARG is a list (LAST FONT-INFO ...), where LAST is `(last
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1056 ARG)' and FONT-INFOs have this form:
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1057 (CHAR FONT-SPEC) or ((FROM . TO) FONT-SPEC)
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1058 The current leaf is indexed by CHARACTER and has value ELT. This
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1059 function add the information of the current leaf to ARG by
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1060 appending a new element or modifying the last element.. */
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1061
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1062 static void
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1063 accumulate_font_info (arg, character, elt)
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1064 Lisp_Object arg, character, elt;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1065 {
34975
0d69e2d2724e (fontset_ref): Remove unused variable `i'.
Eli Zaretskii <eliz@gnu.org>
parents: 32978
diff changeset
1066 Lisp_Object last, last_char, last_elt;
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1067
29767
c8e5453dc85d (FONTSET_ASCII): Use the first element of char table
Kenichi Handa <handa@m17n.org>
parents: 29501
diff changeset
1068 if (!CONSP (elt) && !SINGLE_BYTE_CHAR_P (XINT (character)))
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1069 FONTSET_REF (Vdefault_fontset, XINT (character), elt);
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1070 if (!CONSP (elt))
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1071 return;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1072 last = XCAR (arg);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1073 last_char = XCAR (XCAR (last));
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1074 last_elt = XCAR (XCDR (XCAR (last)));
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1075 elt = XCDR (elt);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1076 if (!NILP (Fequal (elt, last_elt)))
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1077 {
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1078 struct charset *this_charset = CHAR_CHARSET (XINT (character));
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1079
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1080 if (CONSP (last_char)) /* LAST_CHAR == (FROM . TO) */
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1081 {
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1082 if (this_charset == CHAR_CHARSET (XINT (XCAR (last_char))))
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1083 {
39973
579177964efa Avoid (most) uses of XCAR/XCDR as lvalues, for flexibility in experimenting
Ken Raeburn <raeburn@raeburn.org>
parents: 37744
diff changeset
1084 XSETCDR (last_char, character);
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1085 return;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1086 }
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1087 }
29767
c8e5453dc85d (FONTSET_ASCII): Use the first element of char table
Kenichi Handa <handa@m17n.org>
parents: 29501
diff changeset
1088 else if (XINT (last_char) == XINT (character))
c8e5453dc85d (FONTSET_ASCII): Use the first element of char table
Kenichi Handa <handa@m17n.org>
parents: 29501
diff changeset
1089 return;
c8e5453dc85d (FONTSET_ASCII): Use the first element of char table
Kenichi Handa <handa@m17n.org>
parents: 29501
diff changeset
1090 else if (this_charset == CHAR_CHARSET (XINT (last_char)))
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1091 {
39973
579177964efa Avoid (most) uses of XCAR/XCDR as lvalues, for flexibility in experimenting
Ken Raeburn <raeburn@raeburn.org>
parents: 37744
diff changeset
1092 XSETCAR (XCAR (last), Fcons (last_char, character));
29767
c8e5453dc85d (FONTSET_ASCII): Use the first element of char table
Kenichi Handa <handa@m17n.org>
parents: 29501
diff changeset
1093 return;
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1094 }
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1095 }
39973
579177964efa Avoid (most) uses of XCAR/XCDR as lvalues, for flexibility in experimenting
Ken Raeburn <raeburn@raeburn.org>
parents: 37744
diff changeset
1096 XSETCDR (last, Fcons (Fcons (character, Fcons (elt, Qnil)), Qnil));
579177964efa Avoid (most) uses of XCAR/XCDR as lvalues, for flexibility in experimenting
Ken Raeburn <raeburn@raeburn.org>
parents: 37744
diff changeset
1097 XSETCAR (arg, XCDR (last));
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1098 }
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1099
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1100
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1101 DEFUN ("fontset-info", Ffontset_info, Sfontset_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
1102 doc: /* Return information about a fontset 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
1103 The value is a vector:
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1104 [ SIZE HEIGHT ((CHARSET-OR-RANGE FONT-SPEC OPENED ...) ...) ],
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1105 where,
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1106 SIZE is the maximum bound width of ASCII font in the fontset,
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1107 HEIGHT is the maximum bound height of ASCII font in the fontset,
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1108 CHARSET-OR-RANGE is a charset or a cons of two characters specifying
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1109 the range of characters.
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1110 FONT-SPEC is a fontname pattern string or a vector
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1111 [ FAMILY WEIGHT SLANT ADSTYLE REGISTRY ].
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1112 See the documentation of `new-fontset' for the meanings those elements.
41001
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1113 OPENEDs are names of fonts actually opened.
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1114 If the ASCII font is not yet opened, SIZE and HEIGHT are 0.
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1115 If FRAME is omitted, it defaults to the currently selected frame. */)
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1116 (name, frame)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1117 Lisp_Object name, frame;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1118 {
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1119 Lisp_Object fontset;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1120 FRAME_PTR f;
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1121 Lisp_Object val, tail, elt;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1122 Lisp_Object *realized;
30124
26076259e03f (Ffontset_info): Make the return value more compatible
Kenichi Handa <handa@m17n.org>
parents: 29767
diff changeset
1123 struct font_info *fontp = NULL;
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1124 int n_realized = 0;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1125 int i;
41987
34952771ae85 Fix typos, remove unnecessary space.
Pavel Janík <Pavel@Janik.cz>
parents: 41052
diff changeset
1126
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1127 (*check_window_system_func) ();
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1128
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1129 fontset = check_fontset_name (name);
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 if (NILP (frame))
25668
99290b59352d (Ffont_info): Change for Lisp_Object selected_frame.
Gerd Moellmann <gerd@gnu.org>
parents: 24611
diff changeset
1132 frame = selected_frame;
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40028
diff changeset
1133 CHECK_LIVE_FRAME (frame);
25668
99290b59352d (Ffont_info): Change for Lisp_Object selected_frame.
Gerd Moellmann <gerd@gnu.org>
parents: 24611
diff changeset
1134 f = XFRAME (frame);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1135
29767
c8e5453dc85d (FONTSET_ASCII): Use the first element of char table
Kenichi Handa <handa@m17n.org>
parents: 29501
diff changeset
1136 /* Recode realized fontsets whose base is FONTSET in the table
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1137 `realized'. */
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1138 realized = (Lisp_Object *) alloca (sizeof (Lisp_Object)
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1139 * ASIZE (Vfontset_table));
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1140 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
1141 {
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1142 elt = FONTSET_FROM_ID (i);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1143 if (!NILP (elt)
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1144 && EQ (FONTSET_BASE (elt), fontset))
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1145 realized[n_realized++] = elt;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1146 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1147
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1148 /* Accumulate information of the fontset in VAL. The format is
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1149 (LAST FONT-INFO FONT-INFO ...), where FONT-INFO is (CHAR-OR-RANGE
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1150 FONT-SPEC). See the comment for accumulate_font_info for the
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1151 detail. */
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1152 val = Fcons (Fcons (Qascii, Fcons (FONTSET_ASCII (fontset), Qnil)), Qnil);
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1153 val = Fcons (val, val);
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1154 for (i = 128; i <= MAX_CHAR; )
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1155 {
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1156 Lisp_Object elt;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1157 int from, to;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1158
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1159 elt = char_table_ref_and_range (fontset, i, &from, &to);
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1160 if (! NILP (elt))
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1161 {
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1162 elt = Fcons (Fcons (make_number (from), make_number (to)),
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1163 Fcons (elt, Qnil));
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1164 XSETCDR (XCAR (val), Fcons (elt, Qnil));
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1165 XSETCAR (val, XCDR (XCAR (val)));
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1166 }
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1167 i = to + 1;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1168 }
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1169
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1170 for (tail = FONTSET_CHARSET_ALIST (fontset);
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1171 CONSP (tail); tail = XCDR (tail))
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1172 {
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1173 elt = XCAR (tail);
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1174 elt = Fcons (XCAR (elt), Fcons (XCDR (elt), Qnil));
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1175 XSETCDR (XCAR (val), Fcons (elt, Qnil));
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1176 XSETCAR (val, XCDR (XCAR (val)));
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1177 }
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1178
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1179 val = XCDR (val);
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1180
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1181 /* If fonts are opened for FONT-SPEC, append the names of the fonts to
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1182 FONT-SPEC. */
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1183 for (tail = val; CONSP (tail); tail = XCDR (tail))
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1184 {
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1185 int c;
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1186
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1187 elt = XCAR (tail);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1188 for (i = 0; i < n_realized; i++)
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1189 {
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1190 int face_id;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1191 struct face *face;
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1192 Lisp_Object face_list, fontname;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1193
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1194 for (face_list = FONTSET_FACE_ALIST (realized[i]);
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1195 CONSP (face_list); face_list = XCDR (face_list))
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1196 {
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1197 int face_id = XINT (XCDR (XCAR (face_list)));
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1198 struct face *face = FACE_FROM_ID (f, face_id);
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1199
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1200 if (face->font && face->font_name)
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1201 {
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1202 fontname = build_string (face->font_name);
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1203 if (NILP (Fmember (fontname, XCDR (XCDR (elt)))))
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1204 XSETCDR (XCDR (elt), Fcons (fontname, XCDR (XCDR (elt))));
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1205 }
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1206 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1207 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1208 }
30124
26076259e03f (Ffontset_info): Make the return value more compatible
Kenichi Handa <handa@m17n.org>
parents: 29767
diff changeset
1209
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1210 elt = XCDR (XCDR (XCAR (val)));
30124
26076259e03f (Ffontset_info): Make the return value more compatible
Kenichi Handa <handa@m17n.org>
parents: 29767
diff changeset
1211 if (CONSP (elt))
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1212 fontp = (*query_font_func) (f, XSTRING (XCAR (elt))->data);
30124
26076259e03f (Ffontset_info): Make the return value more compatible
Kenichi Handa <handa@m17n.org>
parents: 29767
diff changeset
1213 val = Fmake_vector (make_number (3), val);
26076259e03f (Ffontset_info): Make the return value more compatible
Kenichi Handa <handa@m17n.org>
parents: 29767
diff changeset
1214 AREF (val, 0) = fontp ? make_number (fontp->size) : make_number (0);
26076259e03f (Ffontset_info): Make the return value more compatible
Kenichi Handa <handa@m17n.org>
parents: 29767
diff changeset
1215 AREF (val, 1) = fontp ? make_number (fontp->height) : make_number (0);
26076259e03f (Ffontset_info): Make the return value more compatible
Kenichi Handa <handa@m17n.org>
parents: 29767
diff changeset
1216 return val;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1217 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1218
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1219 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
1220 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
1221 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
1222 (name, ch)
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1223 Lisp_Object name, ch;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1224 {
34975
0d69e2d2724e (fontset_ref): Remove unused variable `i'.
Eli Zaretskii <eliz@gnu.org>
parents: 32978
diff changeset
1225 int c;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1226 Lisp_Object fontset, elt;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1227
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1228 fontset = check_fontset_name (name);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1229
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1230 CHECK_CHARACTER (ch);
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1231 c = XINT (ch);
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1232 FONTSET_REF (fontset, c, elt);
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1233 return elt;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1234 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1235
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1236 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
1237 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
1238 ()
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1239 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1240 Lisp_Object fontset, list;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1241 int i;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1242
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1243 list = Qnil;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1244 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
1245 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1246 fontset = FONTSET_FROM_ID (i);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1247 if (!NILP (fontset)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1248 && BASE_FONTSET_P (fontset))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1249 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
1250 }
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1251
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1252 return list;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1253 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1254
21514
fa9ff387d260 Fix -Wimplicit warnings.
Andreas Schwab <schwab@suse.de>
parents: 21127
diff changeset
1255 void
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1256 syms_of_fontset ()
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1257 {
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1258 if (!load_font_func)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1259 /* Window system initializer should have set proper functions. */
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1260 abort ();
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1261
17112
5c48ff325655 (syms_of_fontset): Intern Qfontset. Declare new lisp
Kenichi Handa <handa@m17n.org>
parents: 17071
diff changeset
1262 Qfontset = intern ("fontset");
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1263 staticpro (&Qfontset);
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1264 Fput (Qfontset, Qchar_table_extra_slots, make_number (7));
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1265
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1266 Vcached_fontset_data = Qnil;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1267 staticpro (&Vcached_fontset_data);
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1268
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1269 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
1270 staticpro (&Vfontset_table);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1271
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1272 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
1273 staticpro (&Vdefault_fontset);
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1274 FONTSET_ID (Vdefault_fontset) = make_number (0);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1275 FONTSET_NAME (Vdefault_fontset)
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1276 = build_string ("-*-*-*-*-*-*-*-*-*-*-*-*-fontset-default");
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1277 {
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1278 Lisp_Object default_ascii_font;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1279
32790
131348208699 (syms_of_fontset) [WINDOWSNT]: Special case for ASCII font of default
Jason Rumney <jasonr@gnu.org>
parents: 32752
diff changeset
1280 #if defined (macintosh)
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1281 default_ascii_font
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1282 = 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
1283 #elif defined (WINDOWSNT)
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1284 default_ascii_font
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1285 = 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
1286 #else
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1287 default_ascii_font
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1288 = 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
1289 #endif
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1290 FONTSET_ASCII (Vdefault_fontset) = default_ascii_font;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1291 }
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1292 AREF (Vfontset_table, 0) = Vdefault_fontset;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1293 next_fontset_id = 1;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1294
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1295 DEFVAR_LISP ("font-encoding-alist", &Vfont_encoding_alist,
41001
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1296 doc: /* Alist of fontname patterns vs corresponding encoding info.
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1297 Each element looks like (REGEXP . ENCODING-INFO),
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1298 where ENCODING-INFO is an alist of CHARSET vs ENCODING.
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1299 ENCODING is one of the following integer values:
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1300 0: code points 0x20..0x7F or 0x2020..0x7F7F are used,
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1301 1: code points 0xA0..0xFF or 0xA0A0..0xFFFF are used,
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1302 2: code points 0x20A0..0x7FFF are used,
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1303 3: code points 0xA020..0xFF7F are used. */);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1304 Vfont_encoding_alist = Qnil;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1305
17112
5c48ff325655 (syms_of_fontset): Intern Qfontset. Declare new lisp
Kenichi Handa <handa@m17n.org>
parents: 17071
diff changeset
1306 DEFVAR_LISP ("use-default-ascent", &Vuse_default_ascent,
41001
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1307 doc: /* Char table of characters whose ascent values should be ignored.
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1308 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
1309 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
1310
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1311 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
1312 such a character is displayed on screen. */);
19282
09a1536debb4 (Vignore_relative_composition): New variable.
Kenichi Handa <handa@m17n.org>
parents: 19172
diff changeset
1313 Vuse_default_ascent = Qnil;
09a1536debb4 (Vignore_relative_composition): New variable.
Kenichi Handa <handa@m17n.org>
parents: 19172
diff changeset
1314
09a1536debb4 (Vignore_relative_composition): New variable.
Kenichi Handa <handa@m17n.org>
parents: 19172
diff changeset
1315 DEFVAR_LISP ("ignore-relative-composition", &Vignore_relative_composition,
41001
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1316 doc: /* Char table of characters which is not composed relatively.
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1317 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
1318 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
1319 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
1320 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
1321 Vignore_relative_composition = Qnil;
17112
5c48ff325655 (syms_of_fontset): Intern Qfontset. Declare new lisp
Kenichi Handa <handa@m17n.org>
parents: 17071
diff changeset
1322
19450
895dc2520755 (Valternate_fontname_alist): Name changed from
Kenichi Handa <handa@m17n.org>
parents: 19282
diff changeset
1323 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
1324 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
1325 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
1326 alternate fontnames (if any) are tried instead. */);
19450
895dc2520755 (Valternate_fontname_alist): Name changed from
Kenichi Handa <handa@m17n.org>
parents: 19282
diff changeset
1327 Valternate_fontname_alist = Qnil;
17193
dc4562b0152a (Valternative_fontname_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17190
diff changeset
1328
17730
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
1329 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
1330 doc: /* Alist of fontset names vs the aliases. */);
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1331 Vfontset_alias_alist = Fcons (Fcons (FONTSET_NAME (Vdefault_fontset),
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1332 build_string ("fontset-default")),
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1333 Qnil);
17730
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
1334
26858
7cc081b4e084 (Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents: 26164
diff changeset
1335 DEFVAR_LISP ("vertical-centering-font-regexp",
7cc081b4e084 (Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents: 26164
diff changeset
1336 &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
1337 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
1338 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
1339 at the vertical center of lines. */);
26858
7cc081b4e084 (Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents: 26164
diff changeset
1340 Vvertical_centering_font_regexp = Qnil;
7cc081b4e084 (Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents: 26164
diff changeset
1341
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1342 defsubr (&Squery_fontset);
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1343 defsubr (&Snew_fontset);
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1344 defsubr (&Sset_fontset_font);
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1345 defsubr (&Sfont_info);
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1346 defsubr (&Sinternal_char_font);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1347 defsubr (&Sfontset_info);
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1348 defsubr (&Sfontset_font);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1349 defsubr (&Sfontset_list);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1350 }