annotate src/fontset.c @ 88652:8b4e3bbe01d4

(coding-system-post-read-conversion) (coding-system-pre-write-conversion) (coding-system-translation-table-for-decode) (coding-system-translation-table-for-encode): Get the right properties. (with-coding-priority): New macro. (detect-coding-with-language-environment): Use it. (coding-system-equal): Use coding-system-plist.
author Dave Love <fx@gnu.org>
date Sun, 26 May 2002 22:42:00 +0000
parents 443aecffdcc5
children 477f764c048a
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
88546
7471723e43b0 (Fclear_face_cache): Declare.
Dave Love <fx@gnu.org>
parents: 88500
diff changeset
52 EXFUN (Fclear_face_cache, 1);
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
53
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
54 /* FONTSET
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
55
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
56 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
57 similar appearance (style, etc) of characters. There are two kinds
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
58 of fontsets; base and realized. A base fontset is created by
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
59 `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
60 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
61 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
62 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
63 the same realized fontset.
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
64
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
65 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
66 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
67
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
68 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
69 [ FAMILY WEIGHT SLANT SWIDTH REGISTRY ] (vector of size 5)
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
70 or
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
71 FONT-NAME (strig)
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
72
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
73 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
74
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
75 WEIGHT, SLANT, and SWIDTH must be symbols that set-face-attribute
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
76 accepts as attribute values for :weight, :slant, :swidth
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
77 respectively.
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
78
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
79
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
80 A fontset has 7 extra slots.
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
81
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
82 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
83
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
84 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
85 a realized fontset.
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
86
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
87 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
88 realized fontset.
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
89
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
90 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
91 in a base fontset.
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
92
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
93 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
94 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
95
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
96 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
97 specification.
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
98
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
99 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
100 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
101 nil.
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
102
30398
dde5ab185aad (fontset_ref): Remove INLINE declaration.
Kenichi Handa <handa@m17n.org>
parents: 30172
diff changeset
103 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
104
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
105
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
106 DEFAULT FONTSET
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
107
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
108 There's a special fontset named `default fontset' which defines the
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
109 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
110 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
111 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
112
30398
dde5ab185aad (fontset_ref): Remove INLINE declaration.
Kenichi Handa <handa@m17n.org>
parents: 30172
diff changeset
113 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
114 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
115
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
116
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
117 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
118 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
119 usually use the variable name `fontset' for IDs. But, in this
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
120 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
121 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
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
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
125 /********** VARIABLES and FUNCTION PROTOTYPES **********/
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
126
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
127 extern Lisp_Object Qfont;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
128 Lisp_Object Qfontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
129
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
130 /* Vector containing all fontsets. */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
131 static Lisp_Object Vfontset_table;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
132
41987
34952771ae85 Fix typos, remove unnecessary space.
Pavel Janík <Pavel@Janik.cz>
parents: 41052
diff changeset
133 /* 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
134 fontset ID not yet used. */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
135 static int next_fontset_id;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
136
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
137 /* The default fontset. This gives default FAMILY and REGISTRY of
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
138 font for each character. */
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
139 static Lisp_Object Vdefault_fontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
140
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
141 Lisp_Object Vfont_encoding_alist;
17112
5c48ff325655 (syms_of_fontset): Intern Qfontset. Declare new lisp
Kenichi Handa <handa@m17n.org>
parents: 17071
diff changeset
142 Lisp_Object Vuse_default_ascent;
19282
09a1536debb4 (Vignore_relative_composition): New variable.
Kenichi Handa <handa@m17n.org>
parents: 19172
diff changeset
143 Lisp_Object Vignore_relative_composition;
19450
895dc2520755 (Valternate_fontname_alist): Name changed from
Kenichi Handa <handa@m17n.org>
parents: 19282
diff changeset
144 Lisp_Object Valternate_fontname_alist;
17730
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
145 Lisp_Object Vfontset_alias_alist;
26858
7cc081b4e084 (Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents: 26164
diff changeset
146 Lisp_Object Vvertical_centering_font_regexp;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
147
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
148 /* 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
149 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
150 detail. */
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
151
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
152 /* 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
153 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
154
41987
34952771ae85 Fix typos, remove unnecessary space.
Pavel Janík <Pavel@Janik.cz>
parents: 41052
diff changeset
155 /* 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
156 of `x-list-fonts' for more details. */
23517
73f09e7bc96e Include frame.h before fontset.h.
Kenichi Handa <handa@m17n.org>
parents: 22719
diff changeset
157 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
158 Lisp_Object pattern,
73f09e7bc96e Include frame.h before fontset.h.
Kenichi Handa <handa@m17n.org>
parents: 22719
diff changeset
159 int size,
73f09e7bc96e Include frame.h before fontset.h.
Kenichi Handa <handa@m17n.org>
parents: 22719
diff changeset
160 int maxnames));
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
161
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
162 /* 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
163 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
164 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
165
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
166 /* 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
167 struct font_info *(*query_font_func) P_ ((FRAME_PTR f, char *name));
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
168
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
169 /* Additional function for setting fontset or changing fontset
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
170 contents of frame F. */
20315
931b4ddf7966 Protoize functions declarations.
Andreas Schwab <schwab@suse.de>
parents: 19450
diff changeset
171 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
172 Lisp_Object oldval));
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
173
21553
2d7afcd11b72 (find_ccl_program_func): New variable.
Kenichi Handa <handa@m17n.org>
parents: 21514
diff changeset
174 /* 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
175 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
176 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
177 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
178
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
179 /* Check if any window system is used now. */
20315
931b4ddf7966 Protoize functions declarations.
Andreas Schwab <schwab@suse.de>
parents: 19450
diff changeset
180 void (*check_window_system_func) P_ ((void));
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
181
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
182
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
183 /* Prototype declarations for static functions. */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
184 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
185 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
186 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
187
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
188
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
189 /********** 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
190
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
191 /* 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
192 #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
193
30398
dde5ab185aad (fontset_ref): Remove INLINE declaration.
Kenichi Handa <handa@m17n.org>
parents: 30172
diff changeset
194 /* 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
195 #define FONTSET_ID(fontset) XCHAR_TABLE (fontset)->extras[0]
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
196
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
197 /* 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
198 #define FONTSET_NAME(fontset) XCHAR_TABLE (fontset)->extras[1]
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
199 #define FONTSET_ASCII(fontset) XCHAR_TABLE (fontset)->extras[4]
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
200
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
201 #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
202
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
203 /* Macros to access special values of (realized) FONTSET. */
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
204 #define FONTSET_BASE(fontset) XCHAR_TABLE (fontset)->extras[2]
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
205 #define FONTSET_FRAME(fontset) XCHAR_TABLE (fontset)->extras[3]
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
206 #define FONTSET_CHARSET_ALIST(fontset) XCHAR_TABLE (fontset)->extras[5]
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
207 #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
208
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
209
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
210 /* 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
211
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
212 #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
213
30398
dde5ab185aad (fontset_ref): Remove INLINE declaration.
Kenichi Handa <handa@m17n.org>
parents: 30172
diff changeset
214 static Lisp_Object
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
215 fontset_ref (fontset, c)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
216 Lisp_Object fontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
217 int c;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
218 {
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
219 Lisp_Object elt;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
220
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
221 while (1)
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
222 {
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
223 elt = CHAR_TABLE_REF (fontset, c);
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
224 if (NILP (elt) && ASCII_CHAR_P (c))
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
225 elt = FONTSET_ASCII (fontset);
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
226 if (NILP (elt))
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
227 {
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
228 Lisp_Object tail;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
229 struct charset *charset;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
230
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
231 for (tail = FONTSET_CHARSET_ALIST (fontset);
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
232 CONSP (tail); tail = XCDR (tail))
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
233 {
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
234 charset = CHARSET_FROM_ID (XCAR (XCAR (tail)));
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
235 if (ENCODE_CHAR (charset, c) != CHARSET_INVALID_CODE (charset))
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
236 {
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
237 elt = XCDR (XCAR (tail));
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
238 break;
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 }
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
242 if (! NILP (elt) || EQ (fontset, Vdefault_fontset))
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
243 break;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
244 fontset = Vdefault_fontset;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
245 }
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
246 return elt;
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
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
249
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
250 /* 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
251 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
252
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
253 #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
254
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
255 static void
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
256 fontset_set (fontset, idx, elt)
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
257 Lisp_Object fontset, idx, elt;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
258 {
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
259 if (SYMBOLP (idx))
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
260 {
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
261 Lisp_Object id, slot, tail;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
262
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
263 id = make_number (CHARSET_SYMBOL_ID (idx));
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
264 if (id == charset_ascii)
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
265 Fset_char_table_range (fontset,
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
266 Fcons (make_number (0), make_number (127)),
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
267 elt);
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
268 else
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
269 {
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
270 slot = Fassq (id, FONTSET_CHARSET_ALIST (fontset));
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
271 if (CONSP (slot))
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
272 XCDR (slot) = elt;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
273 else if (CONSP (FONTSET_CHARSET_ALIST (fontset)))
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
274 {
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
275 for (tail = FONTSET_CHARSET_ALIST (fontset);
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
276 CONSP (XCDR (tail)); tail = XCDR (tail));
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
277 XCDR (tail) = Fcons (Fcons (id, elt), Qnil);
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
278 }
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
279 else
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
280 FONTSET_CHARSET_ALIST (fontset) = Fcons (Fcons (id, elt), Qnil);
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 }
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
283 else
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
284 {
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
285 int from = XINT (XCAR (idx));
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
286 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
287
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
288 if (from == to)
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
289 CHAR_TABLE_SET (fontset, from, elt);
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
290 else
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
291 Fset_char_table_range (fontset, idx, elt);
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
292 }
28223
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
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
295
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
296 /* Return a face registerd in the realized fontset FONTSET for the
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
297 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
298
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
299 static struct face *
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
300 fontset_face (fontset, c)
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
301 Lisp_Object fontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
302 int c;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
303 {
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
304 Lisp_Object base, elt;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
305 int id;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
306 struct face *face;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
307
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
308 base = FONTSET_BASE (fontset);
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
309 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
310
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
311 if (NILP (elt))
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
312 return NULL;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
313
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
314 elt = Fassoc (elt, FONTSET_FACE_ALIST (fontset));
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
315 if (! CONSP (elt))
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
316 return NULL;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
317 id = XINT (XCDR (elt));
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
318 face = FACE_FROM_ID (XFRAME (FONTSET_FRAME (fontset)), id);
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
319 return face;
28223
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
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
323 /* 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
324 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
325 BASE. */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
326
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
327 static Lisp_Object
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
328 make_fontset (frame, name, base)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
329 Lisp_Object frame, name, base;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
330 {
34975
0d69e2d2724e (fontset_ref): Remove unused variable `i'.
Eli Zaretskii <eliz@gnu.org>
parents: 32978
diff changeset
331 Lisp_Object fontset;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
332 int size = ASIZE (Vfontset_table);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
333 int id = next_fontset_id;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
334
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
335 /* 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
336 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
337 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
338 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
339 id. */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
340 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
341
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
342 if (id + 1 == size)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
343 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
344 Lisp_Object tem;
41987
34952771ae85 Fix typos, remove unnecessary space.
Pavel Janík <Pavel@Janik.cz>
parents: 41052
diff changeset
345 int i;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
346
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
347 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
348 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
349 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
350 Vfontset_table = tem;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
351 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
352
29767
c8e5453dc85d (FONTSET_ASCII): Use the first element of char table
Kenichi Handa <handa@m17n.org>
parents: 29501
diff changeset
353 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
354
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
355 FONTSET_ID (fontset) = make_number (id);
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
356 if (NILP (base))
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
357 {
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
358 FONTSET_NAME (fontset) = name;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
359 }
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
360 else
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
361 {
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
362 FONTSET_NAME (fontset) = Qnil;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
363 FONTSET_FRAME (fontset) = frame;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
364 FONTSET_BASE (fontset) = base;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
365 }
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
366
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
367 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
368 next_fontset_id = id + 1;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
369 return fontset;
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
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
373
41987
34952771ae85 Fix typos, remove unnecessary space.
Pavel Janík <Pavel@Janik.cz>
parents: 41052
diff changeset
374 /********** 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
375
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
376 /* 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
377
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
378 Lisp_Object
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
379 fontset_name (id)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
380 int id;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
381 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
382 Lisp_Object fontset;
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
383
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
384 fontset = FONTSET_FROM_ID (id);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
385 return FONTSET_NAME (fontset);
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
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
389 /* 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
390
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
391 Lisp_Object
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
392 fontset_ascii (id)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
393 int id;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
394 {
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
395 Lisp_Object fontset;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
396
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
397 fontset= FONTSET_FROM_ID (id);
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
398 return FONTSET_ASCII (fontset);
28223
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
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
401
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
402 /* Free fontset of FACE defined on frame F. Called from
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
403 free_realized_face. */
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
404
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
405 void
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
406 free_face_fontset (f, face)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
407 FRAME_PTR f;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
408 struct face *face;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
409 {
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
410 AREF (Vfontset_table, face->fontset) = Qnil;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
411 if (face->fontset < next_fontset_id)
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
412 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
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
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
416 /* 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
417 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
418 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
419
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
420 int
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
421 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
422 struct face *face;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
423 int c;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
424 {
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
425 Lisp_Object fontset;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
426
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
427 fontset = FONTSET_FROM_ID (face->fontset);
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
428 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
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
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
432 /* 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
433 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
434 must be reazlied for ASCII characters in advance. Called from the
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
435 macro FACE_FOR_CHAR when C is not an ASCII character. */
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
436
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
437 int
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
438 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
439 FRAME_PTR f;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
440 struct face *face;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
441 int c;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
442 {
88546
7471723e43b0 (Fclear_face_cache): Declare.
Dave Love <fx@gnu.org>
parents: 88500
diff changeset
443 Lisp_Object fontset;
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
444 struct face *new_face;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
445
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
446 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
447 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
448 xassert (!BASE_FONTSET_P (fontset));
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
449
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
450 new_face = fontset_face (fontset, c);
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
451 if (new_face)
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
452 return new_face->id;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
453
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
454 /* 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
455 realized face for C that has the same fontset. */
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
456 return lookup_face (f, face->lface, c, face);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
457 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
458
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
459
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
460 /* 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
461 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
462 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
463 Called from realize_x_face. */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
464
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
465 int
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
466 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
467 FRAME_PTR f;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
468 int base_fontset_id;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
469 {
34975
0d69e2d2724e (fontset_ref): Remove unused variable `i'.
Eli Zaretskii <eliz@gnu.org>
parents: 32978
diff changeset
470 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
471
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
472 XSETFRAME (frame, f);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
473 if (base_fontset_id >= 0)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
474 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
475 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
476 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
477 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
478 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
479 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
480 else
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
481 base_fontset = Vdefault_fontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
482
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
483 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
484 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
485 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
486
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
487
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
488 /* 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
489 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
490 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
491 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
492
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
493 Lisp_Object
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
494 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
495 FRAME_PTR f;
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
496 struct face *face;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
497 int c;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
498 {
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
499 Lisp_Object fontset, base, elt;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
500 int id = face ? face->fontset : -1;
41987
34952771ae85 Fix typos, remove unnecessary space.
Pavel Janík <Pavel@Janik.cz>
parents: 41052
diff changeset
501
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
502 if (id >= 0)
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
503 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
504 fontset = FONTSET_FROM_ID (id);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
505 xassert (!BASE_FONTSET_P (fontset));
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
506 base = FONTSET_BASE (fontset);
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
507 }
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
508 else
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
509 {
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
510 base = Vdefault_fontset;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
511 }
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
512
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
513 FONTSET_REF (base, c, elt);
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
514 if (face && ! NILP (elt))
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
515 {
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
516 Lisp_Object slot;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
517
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
518 slot = Fassoc (elt, FONTSET_FACE_ALIST (fontset));
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
519 if (CONSP (slot))
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
520 XSETCDR (slot, make_number (face->id));
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
521 FONTSET_FACE_ALIST (fontset)
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
522 = Fcons (Fcons (elt, make_number (face->id)),
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
523 FONTSET_FACE_ALIST (fontset));
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
524 }
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
525 return elt;
28223
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
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
528
40028
392c2fe9edd7 (fs_load_font) [WINDOWSNT && _MSC_VER]: Disable
Andrew Innes <andrewi@gnu.org>
parents: 39973
diff changeset
529 #if defined(WINDOWSNT) && defined (_MSC_VER)
392c2fe9edd7 (fs_load_font) [WINDOWSNT && _MSC_VER]: Disable
Andrew Innes <andrewi@gnu.org>
parents: 39973
diff changeset
530 #pragma optimize("", off)
392c2fe9edd7 (fs_load_font) [WINDOWSNT && _MSC_VER]: Disable
Andrew Innes <andrewi@gnu.org>
parents: 39973
diff changeset
531 #endif
392c2fe9edd7 (fs_load_font) [WINDOWSNT && _MSC_VER]: Disable
Andrew Innes <andrewi@gnu.org>
parents: 39973
diff changeset
532
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
533 /* 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
534 struct font_info of the loaded font. If loading fails, return
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
535 NULL. */
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
536
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
537 struct font_info *
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
538 fs_load_font (f, fontname)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
539 FRAME_PTR f;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
540 char *fontname;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
541 {
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
542 Lisp_Object tail, elt;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
543 struct font_info *fontp;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
544
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
545 if (!fontname)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
546 /* No way to get fontname. */
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
547 return 0;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
548
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
549 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
550 if (!fontp)
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
551 return NULL;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
552
88500
3d67875ee2b1 (fs_load_font): Check fontp->full_name (not fontname)
Kenichi Handa <handa@m17n.org>
parents: 88482
diff changeset
553 fontname = fontp->full_name;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
554 /* 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
555 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
556 for (tail = Vfont_encoding_alist; CONSP (tail); tail = XCDR (tail))
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
557 {
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
558 elt = XCAR (tail);
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
559 if (STRINGP (XCAR (elt)) && CHARSETP (XCDR (elt))
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
560 && fast_c_string_match_ignore_case (XCAR (elt), fontname) >= 0)
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
561 {
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
562 fontp->charset = CHARSET_SYMBOL_ID (XCDR (elt));
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
563 break;
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 }
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
566 if (! CONSP (tail))
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
567 return NULL;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
568
26858
7cc081b4e084 (Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents: 26164
diff changeset
569 fontp->vertical_centering
7cc081b4e084 (Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents: 26164
diff changeset
570 = (STRINGP (Vvertical_centering_font_regexp)
41987
34952771ae85 Fix typos, remove unnecessary space.
Pavel Janík <Pavel@Janik.cz>
parents: 41052
diff changeset
571 && (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
572 (Vvertical_centering_font_regexp, fontname) >= 0));
26858
7cc081b4e084 (Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents: 26164
diff changeset
573
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
574 fontp->font_encoder = NULL;
21553
2d7afcd11b72 (find_ccl_program_func): New variable.
Kenichi Handa <handa@m17n.org>
parents: 21514
diff changeset
575
2d7afcd11b72 (find_ccl_program_func): New variable.
Kenichi Handa <handa@m17n.org>
parents: 21514
diff changeset
576 if (find_ccl_program_func)
2d7afcd11b72 (find_ccl_program_func): New variable.
Kenichi Handa <handa@m17n.org>
parents: 21514
diff changeset
577 (*find_ccl_program_func) (fontp);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
578
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
579 return fontp;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
580 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
581
40028
392c2fe9edd7 (fs_load_font) [WINDOWSNT && _MSC_VER]: Disable
Andrew Innes <andrewi@gnu.org>
parents: 39973
diff changeset
582 #if defined(WINDOWSNT) && defined (_MSC_VER)
392c2fe9edd7 (fs_load_font) [WINDOWSNT && _MSC_VER]: Disable
Andrew Innes <andrewi@gnu.org>
parents: 39973
diff changeset
583 #pragma optimize("", on)
392c2fe9edd7 (fs_load_font) [WINDOWSNT && _MSC_VER]: Disable
Andrew Innes <andrewi@gnu.org>
parents: 39973
diff changeset
584 #endif
392c2fe9edd7 (fs_load_font) [WINDOWSNT && _MSC_VER]: Disable
Andrew Innes <andrewi@gnu.org>
parents: 39973
diff changeset
585
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
586
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
587 /* Cache data used by fontset_pattern_regexp. The car part is a
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
588 pattern string containing at least one wild card, the cdr part is
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
589 the corresponding regular expression. */
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
590 static Lisp_Object Vcached_fontset_data;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
591
26164
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_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
593 #define CACHED_FONTSET_REGEX (XCDR (Vcached_fontset_data))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
594
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
595 /* If fontset name PATTERN contains any wild card, return regular
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
596 expression corresponding to PATTERN. */
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
597
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
598 static Lisp_Object
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
599 fontset_pattern_regexp (pattern)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
600 Lisp_Object pattern;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
601 {
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
602 if (!index (XSTRING (pattern)->data, '*')
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
603 && !index (XSTRING (pattern)->data, '?'))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
604 /* PATTERN does not contain any wild cards. */
17730
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
605 return Qnil;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
606
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
607 if (!CONSP (Vcached_fontset_data)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
608 || strcmp (XSTRING (pattern)->data, CACHED_FONTSET_NAME))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
609 {
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
610 /* 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
611 char *regex = (char *) alloca (XSTRING (pattern)->size * 2 + 3);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
612 char *p0, *p1 = regex;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
613
17730
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
614 /* Convert "*" to ".*", "?" to ".". */
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
615 *p1++ = '^';
17827
95010205f916 (fontset_pattern_regexp): Cast to (char *) before
Kenichi Handa <handa@m17n.org>
parents: 17730
diff changeset
616 for (p0 = (char *) XSTRING (pattern)->data; *p0; p0++)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
617 {
17730
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
618 if (*p0 == '*')
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
619 {
17730
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
620 *p1++ = '.';
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
621 *p1++ = '*';
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
622 }
17730
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
623 else if (*p0 == '?')
21127
577865651099 (fontset_pattern_regexp): `==' was used instead of `='.
Richard M. Stallman <rms@gnu.org>
parents: 20346
diff changeset
624 *p1++ = '.';
17730
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
625 else
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
626 *p1++ = *p0;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
627 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
628 *p1++ = '$';
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
629 *p1++ = 0;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
630
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
631 Vcached_fontset_data = Fcons (build_string (XSTRING (pattern)->data),
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
632 build_string (regex));
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
633 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
634
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
635 return CACHED_FONTSET_REGEX;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
636 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
637
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
638 /* 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
639 fontset, return -1. */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
640
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
641 int
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
642 fs_query_fontset (name, regexpp)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
643 Lisp_Object name;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
644 int regexpp;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
645 {
34975
0d69e2d2724e (fontset_ref): Remove unused variable `i'.
Eli Zaretskii <eliz@gnu.org>
parents: 32978
diff changeset
646 Lisp_Object tem;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
647 int i;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
648
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
649 name = Fdowncase (name);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
650 if (!regexpp)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
651 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
652 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
653 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
654 name = XCAR (tem);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
655 else
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
656 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
657 tem = fontset_pattern_regexp (name);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
658 if (STRINGP (tem))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
659 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
660 name = tem;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
661 regexpp = 1;
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
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
666 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
667 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
668 Lisp_Object fontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
669 unsigned char *this_name;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
670
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
671 fontset = FONTSET_FROM_ID (i);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
672 if (NILP (fontset)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
673 || !BASE_FONTSET_P (fontset))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
674 continue;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
675
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
676 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
677 if (regexpp
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
678 ? 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
679 : !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
680 return i;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
681 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
682 return -1;
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
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
685
21553
2d7afcd11b72 (find_ccl_program_func): New variable.
Kenichi Handa <handa@m17n.org>
parents: 21514
diff changeset
686 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
687 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
688 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
689 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
690 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
691 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
692 (pattern, regexpp)
21553
2d7afcd11b72 (find_ccl_program_func): New variable.
Kenichi Handa <handa@m17n.org>
parents: 21514
diff changeset
693 Lisp_Object pattern, regexpp;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
694 {
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
695 Lisp_Object fontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
696 int id;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
697
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
698 (*check_window_system_func) ();
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
699
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40028
diff changeset
700 CHECK_STRING (pattern);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
701
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
702 if (XSTRING (pattern)->size == 0)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
703 return Qnil;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
704
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
705 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
706 if (id < 0)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
707 return Qnil;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
708
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
709 fontset = FONTSET_FROM_ID (id);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
710 return FONTSET_NAME (fontset);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
711 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
712
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
713 /* Return a list of base fontset names matching PATTERN on frame F. */
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
714
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
715 Lisp_Object
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
716 list_fontsets (f, pattern, size)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
717 FRAME_PTR f;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
718 Lisp_Object pattern;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
719 int size;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
720 {
34975
0d69e2d2724e (fontset_ref): Remove unused variable `i'.
Eli Zaretskii <eliz@gnu.org>
parents: 32978
diff changeset
721 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
722 int id;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
723
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
724 XSETFRAME (frame, f);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
725
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
726 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
727 val = Qnil;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
728
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
729 for (id = 0; id < ASIZE (Vfontset_table); id++)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
730 {
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
731 Lisp_Object fontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
732 unsigned char *name;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
733
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
734 fontset = FONTSET_FROM_ID (id);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
735 if (NILP (fontset)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
736 || !BASE_FONTSET_P (fontset)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
737 || !EQ (frame, FONTSET_FRAME (fontset)))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
738 continue;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
739 name = XSTRING (FONTSET_NAME (fontset))->data;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
740
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
741 if (!NILP (regexp)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
742 ? (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
743 : strcmp (XSTRING (pattern)->data, name))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
744 continue;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
745
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
746 val = Fcons (Fcopy_sequence (FONTSET_NAME (fontset)), val);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
747 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
748
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
749 return val;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
750 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
751
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
752
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
753 /* Free all realized fontsets whose base fontset is BASE. */
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
754
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
755 static void
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
756 free_realized_fontsets (base)
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
757 Lisp_Object base;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
758 {
88546
7471723e43b0 (Fclear_face_cache): Declare.
Dave Love <fx@gnu.org>
parents: 88500
diff changeset
759 #if 0
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
760 int id;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
761
88482
effba1417b74 (free_realized_fontsets): Call Fclear_face_cache instead
Kenichi Handa <handa@m17n.org>
parents: 88405
diff changeset
762 /* 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
763 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
764 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
765 that is not efficient. */
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
766 BLOCK_INPUT;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
767 for (id = 0; id < ASIZE (Vfontset_table); id++)
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
768 {
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
769 Lisp_Object this = AREF (Vfontset_table, id);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
770
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
771 if (EQ (FONTSET_BASE (this), base))
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
772 {
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
773 Lisp_Object tail;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
774
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
775 for (tail = FONTSET_FACE_ALIST (this); CONSP (tail);
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
776 tail = XCDR (tail))
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
777 {
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
778 FRAME_PTR f = XFRAME (FONTSET_FRAME (this));
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
779 int face_id = XINT (XCDR (XCAR (tail)));
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
780 struct face *face = FACE_FROM_ID (f, face_id);
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
781
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
782 /* Face THIS itself is also freed by the following call. */
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
783 free_realized_face (f, face);
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
784 }
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
785 }
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
786 }
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
787 UNBLOCK_INPUT;
88482
effba1417b74 (free_realized_fontsets): Call Fclear_face_cache instead
Kenichi Handa <handa@m17n.org>
parents: 88405
diff changeset
788 #else /* not 0 */
effba1417b74 (free_realized_fontsets): Call Fclear_face_cache instead
Kenichi Handa <handa@m17n.org>
parents: 88405
diff changeset
789 Fclear_face_cache (Qt);
effba1417b74 (free_realized_fontsets): Call Fclear_face_cache instead
Kenichi Handa <handa@m17n.org>
parents: 88405
diff changeset
790 #endif /* not 0 */
28223
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
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
794 /* 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
795 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
796 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
797
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
798 static Lisp_Object
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
799 check_fontset_name (name)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
800 Lisp_Object name;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
801 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
802 int id;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
803
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
804 if (EQ (name, Qt))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
805 return Vdefault_fontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
806
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40028
diff changeset
807 CHECK_STRING (name);
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
808 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
809 if (id < 0)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
810 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
811 return FONTSET_FROM_ID (id);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
812 }
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
813
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
814 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
815 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
816
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
817 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
818 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
819 TO (inclusive).
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
820
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
821 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
822
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
823 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
824 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
825
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
826 FONT-SPEC may be a font name string. */)
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
827 (name, charset, font_spec, frame)
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
828 Lisp_Object name, charset, font_spec, frame;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
829 {
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
830 Lisp_Object fontset;
29233
a09ee5c15dcb (check_registry_encoding): This function deleted.
Kenichi Handa <handa@m17n.org>
parents: 29231
diff changeset
831 Lisp_Object family, registry;
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
88546
7471723e43b0 (Fclear_face_cache): Declare.
Dave Love <fx@gnu.org>
parents: 88500
diff changeset
1054 #if 0 /* unused */
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1055 /* 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
1056 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
1057 ARG)' and FONT-INFOs have this form:
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1058 (CHAR FONT-SPEC) or ((FROM . TO) FONT-SPEC)
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1059 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
1060 function add the information of the current leaf to ARG by
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1061 appending a new element or modifying the last element.. */
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1062
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1063 static void
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1064 accumulate_font_info (arg, character, elt)
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1065 Lisp_Object arg, character, elt;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1066 {
34975
0d69e2d2724e (fontset_ref): Remove unused variable `i'.
Eli Zaretskii <eliz@gnu.org>
parents: 32978
diff changeset
1067 Lisp_Object last, last_char, last_elt;
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1068
29767
c8e5453dc85d (FONTSET_ASCII): Use the first element of char table
Kenichi Handa <handa@m17n.org>
parents: 29501
diff changeset
1069 if (!CONSP (elt) && !SINGLE_BYTE_CHAR_P (XINT (character)))
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1070 FONTSET_REF (Vdefault_fontset, XINT (character), elt);
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1071 if (!CONSP (elt))
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1072 return;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1073 last = XCAR (arg);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1074 last_char = XCAR (XCAR (last));
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1075 last_elt = XCAR (XCDR (XCAR (last)));
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1076 elt = XCDR (elt);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1077 if (!NILP (Fequal (elt, last_elt)))
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1078 {
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1079 struct charset *this_charset = CHAR_CHARSET (XINT (character));
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1080
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1081 if (CONSP (last_char)) /* LAST_CHAR == (FROM . TO) */
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1082 {
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1083 if (this_charset == CHAR_CHARSET (XINT (XCAR (last_char))))
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1084 {
39973
579177964efa Avoid (most) uses of XCAR/XCDR as lvalues, for flexibility in experimenting
Ken Raeburn <raeburn@raeburn.org>
parents: 37744
diff changeset
1085 XSETCDR (last_char, character);
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1086 return;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1087 }
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1088 }
29767
c8e5453dc85d (FONTSET_ASCII): Use the first element of char table
Kenichi Handa <handa@m17n.org>
parents: 29501
diff changeset
1089 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
1090 return;
c8e5453dc85d (FONTSET_ASCII): Use the first element of char table
Kenichi Handa <handa@m17n.org>
parents: 29501
diff changeset
1091 else if (this_charset == CHAR_CHARSET (XINT (last_char)))
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1092 {
39973
579177964efa Avoid (most) uses of XCAR/XCDR as lvalues, for flexibility in experimenting
Ken Raeburn <raeburn@raeburn.org>
parents: 37744
diff changeset
1093 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
1094 return;
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1095 }
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1096 }
39973
579177964efa Avoid (most) uses of XCAR/XCDR as lvalues, for flexibility in experimenting
Ken Raeburn <raeburn@raeburn.org>
parents: 37744
diff changeset
1097 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
1098 XSETCAR (arg, XCDR (last));
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1099 }
88546
7471723e43b0 (Fclear_face_cache): Declare.
Dave Love <fx@gnu.org>
parents: 88500
diff changeset
1100 #endif /* 0 */
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1101
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1102 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
1103 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
1104 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
1105 [ 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
1106 where,
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1107 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
1108 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
1109 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
1110 the range of characters.
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1111 FONT-SPEC is a fontname pattern string or a vector
88632
443aecffdcc5 (Ffontset_info): Doc fix. Return charset names, not
Dave Love <fx@gnu.org>
parents: 88546
diff changeset
1112 [ FAMILY WEIGHT SLANT WIDTH ADSTYLE REGISTRY ].
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1113 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
1114 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
1115 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
1116 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
1117 (name, frame)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1118 Lisp_Object name, frame;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1119 {
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1120 Lisp_Object fontset;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1121 FRAME_PTR f;
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1122 Lisp_Object val, tail, elt;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1123 Lisp_Object *realized;
30124
26076259e03f (Ffontset_info): Make the return value more compatible
Kenichi Handa <handa@m17n.org>
parents: 29767
diff changeset
1124 struct font_info *fontp = NULL;
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1125 int n_realized = 0;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1126 int i;
41987
34952771ae85 Fix typos, remove unnecessary space.
Pavel Janík <Pavel@Janik.cz>
parents: 41052
diff changeset
1127
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1128 (*check_window_system_func) ();
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1129
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1130 fontset = check_fontset_name (name);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1131
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1132 if (NILP (frame))
25668
99290b59352d (Ffont_info): Change for Lisp_Object selected_frame.
Gerd Moellmann <gerd@gnu.org>
parents: 24611
diff changeset
1133 frame = selected_frame;
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40028
diff changeset
1134 CHECK_LIVE_FRAME (frame);
25668
99290b59352d (Ffont_info): Change for Lisp_Object selected_frame.
Gerd Moellmann <gerd@gnu.org>
parents: 24611
diff changeset
1135 f = XFRAME (frame);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1136
29767
c8e5453dc85d (FONTSET_ASCII): Use the first element of char table
Kenichi Handa <handa@m17n.org>
parents: 29501
diff changeset
1137 /* Recode realized fontsets whose base is FONTSET in the table
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1138 `realized'. */
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1139 realized = (Lisp_Object *) alloca (sizeof (Lisp_Object)
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1140 * ASIZE (Vfontset_table));
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1141 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
1142 {
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1143 elt = FONTSET_FROM_ID (i);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1144 if (!NILP (elt)
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1145 && EQ (FONTSET_BASE (elt), fontset))
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1146 realized[n_realized++] = elt;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1147 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1148
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1149 /* Accumulate information of the fontset in VAL. The format is
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1150 (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
1151 FONT-SPEC). See the comment for accumulate_font_info for the
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1152 detail. */
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1153 val = Fcons (Fcons (Qascii, Fcons (FONTSET_ASCII (fontset), Qnil)), Qnil);
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1154 val = Fcons (val, val);
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1155 for (i = 128; i <= MAX_CHAR; )
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1156 {
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1157 Lisp_Object elt;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1158 int from, to;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1159
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1160 elt = char_table_ref_and_range (fontset, i, &from, &to);
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1161 if (! NILP (elt))
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1162 {
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1163 elt = Fcons (Fcons (make_number (from), make_number (to)),
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1164 Fcons (elt, Qnil));
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1165 XSETCDR (XCAR (val), Fcons (elt, Qnil));
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1166 XSETCAR (val, XCDR (XCAR (val)));
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1167 }
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1168 i = to + 1;
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
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1171 for (tail = FONTSET_CHARSET_ALIST (fontset);
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1172 CONSP (tail); tail = XCDR (tail))
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1173 {
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1174 elt = XCAR (tail);
88632
443aecffdcc5 (Ffontset_info): Doc fix. Return charset names, not
Dave Love <fx@gnu.org>
parents: 88546
diff changeset
1175 elt = Fcons ((INTEGERP (XCAR (elt))
443aecffdcc5 (Ffontset_info): Doc fix. Return charset names, not
Dave Love <fx@gnu.org>
parents: 88546
diff changeset
1176 ? CHARSET_NAME (CHARSET_FROM_ID (XCAR (elt)))
443aecffdcc5 (Ffontset_info): Doc fix. Return charset names, not
Dave Love <fx@gnu.org>
parents: 88546
diff changeset
1177 : XCAR (elt)),
443aecffdcc5 (Ffontset_info): Doc fix. Return charset names, not
Dave Love <fx@gnu.org>
parents: 88546
diff changeset
1178 Fcons (XCDR (elt), Qnil));
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1179 XSETCDR (XCAR (val), Fcons (elt, Qnil));
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1180 XSETCAR (val, XCDR (XCAR (val)));
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1181 }
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1182
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1183 val = XCDR (val);
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1184
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1185 /* 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
1186 FONT-SPEC. */
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1187 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
1188 {
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1189 elt = XCAR (tail);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1190 for (i = 0; i < n_realized; i++)
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1191 {
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.
88632
443aecffdcc5 (Ffontset_info): Doc fix. Return charset names, not
Dave Love <fx@gnu.org>
parents: 88546
diff changeset
1297 Each element looks like (REGEXP . CHARSET), where CHARSET is an
443aecffdcc5 (Ffontset_info): Doc fix. Return charset names, not
Dave Love <fx@gnu.org>
parents: 88546
diff changeset
1298 Emacs charset symbol. */);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1299 Vfont_encoding_alist = Qnil;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1300
17112
5c48ff325655 (syms_of_fontset): Intern Qfontset. Declare new lisp
Kenichi Handa <handa@m17n.org>
parents: 17071
diff changeset
1301 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
1302 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
1303 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
1304 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
1305
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1306 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
1307 such a character is displayed on screen. */);
19282
09a1536debb4 (Vignore_relative_composition): New variable.
Kenichi Handa <handa@m17n.org>
parents: 19172
diff changeset
1308 Vuse_default_ascent = Qnil;
09a1536debb4 (Vignore_relative_composition): New variable.
Kenichi Handa <handa@m17n.org>
parents: 19172
diff changeset
1309
09a1536debb4 (Vignore_relative_composition): New variable.
Kenichi Handa <handa@m17n.org>
parents: 19172
diff changeset
1310 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
1311 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
1312 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
1313 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
1314 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
1315 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
1316 Vignore_relative_composition = Qnil;
17112
5c48ff325655 (syms_of_fontset): Intern Qfontset. Declare new lisp
Kenichi Handa <handa@m17n.org>
parents: 17071
diff changeset
1317
19450
895dc2520755 (Valternate_fontname_alist): Name changed from
Kenichi Handa <handa@m17n.org>
parents: 19282
diff changeset
1318 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
1319 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
1320 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
1321 alternate fontnames (if any) are tried instead. */);
19450
895dc2520755 (Valternate_fontname_alist): Name changed from
Kenichi Handa <handa@m17n.org>
parents: 19282
diff changeset
1322 Valternate_fontname_alist = Qnil;
17193
dc4562b0152a (Valternative_fontname_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17190
diff changeset
1323
17730
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
1324 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
1325 doc: /* Alist of fontset names vs the aliases. */);
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1326 Vfontset_alias_alist = Fcons (Fcons (FONTSET_NAME (Vdefault_fontset),
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1327 build_string ("fontset-default")),
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1328 Qnil);
17730
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
1329
26858
7cc081b4e084 (Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents: 26164
diff changeset
1330 DEFVAR_LISP ("vertical-centering-font-regexp",
7cc081b4e084 (Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents: 26164
diff changeset
1331 &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
1332 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
1333 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
1334 at the vertical center of lines. */);
26858
7cc081b4e084 (Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents: 26164
diff changeset
1335 Vvertical_centering_font_regexp = Qnil;
7cc081b4e084 (Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents: 26164
diff changeset
1336
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1337 defsubr (&Squery_fontset);
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1338 defsubr (&Snew_fontset);
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1339 defsubr (&Sset_fontset_font);
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1340 defsubr (&Sfont_info);
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1341 defsubr (&Sinternal_char_font);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1342 defsubr (&Sfontset_info);
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1343 defsubr (&Sfontset_font);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1344 defsubr (&Sfontset_list);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1345 }