annotate src/fontset.c @ 88265:defd9948075b

(rmail-highlight-face): Doc. (rmail-font-lock-keywords): Add the stuff necessary to make rmail-highlight-headers obsolete. (rmail-toggle-header, rmail-show-message): Don't call rmail-highlight-headers anymore. (rmail-highlight-headers): Deleted.
author Alex Schroeder <alex@gnu.org>
date Sat, 21 Jan 2006 18:21:07 +0000
parents d7ddb3e565de
children
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.
88155
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
2 Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
3 Copyright (C) 1995, 1997, 1998, 2000, 2003, 2004, 2005
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
4 National Institute of Advanced Industrial Science and Technology (AIST)
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
5 Registration Number H14PRO021
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
6
17071
70194012fb3a Fix FSF address in comment.
Karl Heuer <kwzh@gnu.org>
parents: 17052
diff changeset
7 This file is part of GNU Emacs.
70194012fb3a Fix FSF address in comment.
Karl Heuer <kwzh@gnu.org>
parents: 17052
diff changeset
8
70194012fb3a Fix FSF address in comment.
Karl Heuer <kwzh@gnu.org>
parents: 17052
diff changeset
9 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
10 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
11 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
12 any later version.
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
13
17071
70194012fb3a Fix FSF address in comment.
Karl Heuer <kwzh@gnu.org>
parents: 17052
diff changeset
14 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
15 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
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
70194012fb3a Fix FSF address in comment.
Karl Heuer <kwzh@gnu.org>
parents: 17052
diff changeset
17 GNU General Public License for more details.
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
18
17071
70194012fb3a Fix FSF address in comment.
Karl Heuer <kwzh@gnu.org>
parents: 17052
diff changeset
19 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
20 along with GNU Emacs; see the file COPYING. If not, write to
88155
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
21 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
22 Boston, MA 02110-1301, USA. */
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
23
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
24 /* #define FONTSET_DEBUG */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
25
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
26 #include <config.h>
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
27
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
28 #ifdef FONTSET_DEBUG
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
29 #include <stdio.h>
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
30 #endif
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
31
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
32 #include "lisp.h"
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
33 #include "buffer.h"
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
34 #include "charset.h"
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
35 #include "ccl.h"
31102
6a0caa788013 Include keyboard.h before frame.h.
Andrew Innes <andrewi@gnu.org>
parents: 30941
diff changeset
36 #include "keyboard.h"
23517
73f09e7bc96e Include frame.h before fontset.h.
Kenichi Handa <handa@m17n.org>
parents: 22719
diff changeset
37 #include "frame.h"
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
38 #include "dispextern.h"
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
39 #include "fontset.h"
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
40 #include "window.h"
88155
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
41 #ifdef HAVE_X_WINDOWS
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
42 #include "xterm.h"
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
43 #endif
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
44 #ifdef WINDOWSNT
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
45 #include "w32term.h"
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
46 #endif
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
47 #ifdef MAC_OS
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
48 #include "macterm.h"
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
49 #endif
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
50
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
51 #ifdef FONTSET_DEBUG
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
52 #undef xassert
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
53 #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
54 #undef INLINE
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
55 #define INLINE
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
56 #endif
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
57
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
58
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
59 /* FONTSET
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
60
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
61 A fontset is a collection of font related information to give
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
62 similar appearance (style, size, etc) of characters. There are two
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
63 kinds of fontsets; base and realized. A base fontset is created by
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
64 new-fontset from Emacs Lisp explicitly. A realized fontset is
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
65 created implicitly when a face is realized for ASCII characters. A
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
66 face is also realized for multibyte characters based on an ASCII
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
67 face. All of the multibyte faces based on the same ASCII face
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
68 share the same realized fontset.
41987
34952771ae85 Fix typos, remove unnecessary space.
Pavel Janík <Pavel@Janik.cz>
parents: 41052
diff changeset
69
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
70 A fontset object is implemented by a char-table.
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
71
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
72 An element of a base fontset is:
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
73 (INDEX . FONTNAME) or
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
74 (INDEX . (FOUNDRY . REGISTRY ))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
75 FONTNAME is a font name pattern for the corresponding character.
41987
34952771ae85 Fix typos, remove unnecessary space.
Pavel Janík <Pavel@Janik.cz>
parents: 41052
diff changeset
76 FOUNDRY and REGISTRY are respectively foundry and registry fields of
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
77 a font name for the corresponding character. INDEX specifies for
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
78 which character (or generic character) the element is defined. It
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
79 may be different from an index to access this element. For
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
80 instance, if a fontset defines some font for all characters of
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
81 charset `japanese-jisx0208', INDEX is the generic character of this
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
82 charset. REGISTRY is the
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
83
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
84 An element of a realized fontset is FACE-ID which is a face to use
41987
34952771ae85 Fix typos, remove unnecessary space.
Pavel Janík <Pavel@Janik.cz>
parents: 41052
diff changeset
85 for displaying the corresponding character.
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
86
41987
34952771ae85 Fix typos, remove unnecessary space.
Pavel Janík <Pavel@Janik.cz>
parents: 41052
diff changeset
87 All single byte characters (ASCII and 8bit-unibyte) share the same
29767
c8e5453dc85d (FONTSET_ASCII): Use the first element of char table
Kenichi Handa <handa@m17n.org>
parents: 29501
diff changeset
88 element in a fontset. The element is stored in the first element
c8e5453dc85d (FONTSET_ASCII): Use the first element of char table
Kenichi Handa <handa@m17n.org>
parents: 29501
diff changeset
89 of the fontset.
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
90
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
91 To access or set each element, use macros FONTSET_REF and
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
92 FONTSET_SET respectively for efficiency.
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
93
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
94 A fontset has 3 extra slots.
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
95
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
96 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
97
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
98 The 2nd slot is a name of the fontset. This is nil for a realized
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
99 face.
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
100
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
101 The 3rd slot is a frame that the fontset belongs to. This is nil
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
102 for a default face.
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
103
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
104 A parent of a base fontset is nil. A parent of a realized fontset
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
105 is a base fontset.
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
106
30398
dde5ab185aad (fontset_ref): Remove INLINE declaration.
Kenichi Handa <handa@m17n.org>
parents: 30172
diff changeset
107 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
108
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
109
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
110 DEFAULT FONTSET
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
111
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
112 There's a special fontset named `default fontset' which defines a
30398
dde5ab185aad (fontset_ref): Remove INLINE declaration.
Kenichi Handa <handa@m17n.org>
parents: 30172
diff changeset
113 default fontname pattern. When a base fontset doesn't specify a
dde5ab185aad (fontset_ref): Remove INLINE declaration.
Kenichi Handa <handa@m17n.org>
parents: 30172
diff changeset
114 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
115 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
116
30398
dde5ab185aad (fontset_ref): Remove INLINE declaration.
Kenichi Handa <handa@m17n.org>
parents: 30172
diff changeset
117 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
118 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
119
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
120
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
121 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
122 The other codes handle fontsets only by their ID numbers. They
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
123 usually use variable name `fontset' for IDs. But, in this file, we
41987
34952771ae85 Fix typos, remove unnecessary space.
Pavel Janík <Pavel@Janik.cz>
parents: 41052
diff changeset
124 always use variable name `id' for IDs, and name `fontset' for the
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
125 actual fontset objects.
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 */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
128
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
129 /********** VARIABLES and FUNCTION PROTOTYPES **********/
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
130
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
131 extern Lisp_Object Qfont;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
132 Lisp_Object Qfontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
133
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
134 /* Vector containing all fontsets. */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
135 static Lisp_Object Vfontset_table;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
136
41987
34952771ae85 Fix typos, remove unnecessary space.
Pavel Janík <Pavel@Janik.cz>
parents: 41052
diff changeset
137 /* 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
138 fontset ID not yet used. */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
139 static int next_fontset_id;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
140
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
141 /* The default fontset. This gives default FAMILY and REGISTRY of
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
142 font for each characters. */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
143 static Lisp_Object Vdefault_fontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
144
88155
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
145 /* Alist of font specifications. It override the font specification
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
146 in the default fontset. */
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
147 static Lisp_Object Voverriding_fontspec_alist;
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
148
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
149 Lisp_Object Vfont_encoding_alist;
17112
5c48ff325655 (syms_of_fontset): Intern Qfontset. Declare new lisp
Kenichi Handa <handa@m17n.org>
parents: 17071
diff changeset
150 Lisp_Object Vuse_default_ascent;
19282
09a1536debb4 (Vignore_relative_composition): New variable.
Kenichi Handa <handa@m17n.org>
parents: 19172
diff changeset
151 Lisp_Object Vignore_relative_composition;
19450
895dc2520755 (Valternate_fontname_alist): Name changed from
Kenichi Handa <handa@m17n.org>
parents: 19282
diff changeset
152 Lisp_Object Valternate_fontname_alist;
17730
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
153 Lisp_Object Vfontset_alias_alist;
26858
7cc081b4e084 (Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents: 26164
diff changeset
154 Lisp_Object Vvertical_centering_font_regexp;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
155
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
156 /* 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
157 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
158 detail. */
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
159
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
160 /* 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
161 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
162
41987
34952771ae85 Fix typos, remove unnecessary space.
Pavel Janík <Pavel@Janik.cz>
parents: 41052
diff changeset
163 /* 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
164 of `x-list-fonts' for more details. */
23517
73f09e7bc96e Include frame.h before fontset.h.
Kenichi Handa <handa@m17n.org>
parents: 22719
diff changeset
165 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
166 Lisp_Object pattern,
73f09e7bc96e Include frame.h before fontset.h.
Kenichi Handa <handa@m17n.org>
parents: 22719
diff changeset
167 int size,
73f09e7bc96e Include frame.h before fontset.h.
Kenichi Handa <handa@m17n.org>
parents: 22719
diff changeset
168 int maxnames));
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
169
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
170 /* 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
171 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
172 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
173
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
174 /* 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
175 struct font_info *(*query_font_func) P_ ((FRAME_PTR f, char *name));
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
176
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
177 /* Additional function for setting fontset or changing fontset
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
178 contents of frame F. */
20315
931b4ddf7966 Protoize functions declarations.
Andreas Schwab <schwab@suse.de>
parents: 19450
diff changeset
179 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
180 Lisp_Object oldval));
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
181
21553
2d7afcd11b72 (find_ccl_program_func): New variable.
Kenichi Handa <handa@m17n.org>
parents: 21514
diff changeset
182 /* 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
183 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
184 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
185 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
186
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
187 /* Check if any window system is used now. */
20315
931b4ddf7966 Protoize functions declarations.
Andreas Schwab <schwab@suse.de>
parents: 19450
diff changeset
188 void (*check_window_system_func) P_ ((void));
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
189
28223
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 /* Prototype declarations for static functions. */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
192 static Lisp_Object fontset_ref P_ ((Lisp_Object, int));
88155
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
193 static Lisp_Object lookup_overriding_fontspec P_ ((Lisp_Object, int));
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
194 static void fontset_set P_ ((Lisp_Object, int, Lisp_Object));
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
195 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
196 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
197 static Lisp_Object fontset_pattern_regexp P_ ((Lisp_Object));
35658
3551e8549d4e (font_family_registry): Even if FONTNAME conform to
Kenichi Handa <handa@m17n.org>
parents: 34975
diff changeset
198 static Lisp_Object font_family_registry P_ ((Lisp_Object, int));
88155
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
199 static Lisp_Object regularize_fontname P_ ((Lisp_Object));
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
200
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
201
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
202 /********** 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
203
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
204 /* 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
205 #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
206
30398
dde5ab185aad (fontset_ref): Remove INLINE declaration.
Kenichi Handa <handa@m17n.org>
parents: 30172
diff changeset
207 /* 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
208 #define FONTSET_ID(fontset) XCHAR_TABLE (fontset)->extras[0]
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
209 #define FONTSET_NAME(fontset) XCHAR_TABLE (fontset)->extras[1]
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
210 #define FONTSET_FRAME(fontset) XCHAR_TABLE (fontset)->extras[2]
29767
c8e5453dc85d (FONTSET_ASCII): Use the first element of char table
Kenichi Handa <handa@m17n.org>
parents: 29501
diff changeset
211 #define FONTSET_ASCII(fontset) XCHAR_TABLE (fontset)->contents[0]
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
212 #define FONTSET_BASE(fontset) XCHAR_TABLE (fontset)->parent
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
213
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
214 #define BASE_FONTSET_P(fontset) NILP (FONTSET_BASE(fontset))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
215
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
216
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
217 /* 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
218
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
219 #define FONTSET_REF(fontset, c) fontset_ref (fontset, c)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
220
30398
dde5ab185aad (fontset_ref): Remove INLINE declaration.
Kenichi Handa <handa@m17n.org>
parents: 30172
diff changeset
221 static Lisp_Object
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
222 fontset_ref (fontset, c)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
223 Lisp_Object fontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
224 int c;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
225 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
226 int charset, c1, c2;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
227 Lisp_Object elt, defalt;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
228
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
229 if (SINGLE_BYTE_CHAR_P (c))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
230 return FONTSET_ASCII (fontset);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
231
29011
b60861d6c1e0 (fontset_ref): Use SPLIT_CHAR instead of
Kenichi Handa <handa@m17n.org>
parents: 28971
diff changeset
232 SPLIT_CHAR (c, charset, c1, c2);
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
233 elt = XCHAR_TABLE (fontset)->contents[charset + 128];
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
234 if (!SUB_CHAR_TABLE_P (elt))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
235 return elt;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
236 defalt = XCHAR_TABLE (elt)->defalt;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
237 if (c1 < 32
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
238 || (elt = XCHAR_TABLE (elt)->contents[c1],
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
239 NILP (elt)))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
240 return defalt;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
241 if (!SUB_CHAR_TABLE_P (elt))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
242 return elt;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
243 defalt = XCHAR_TABLE (elt)->defalt;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
244 if (c2 < 32
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
245 || (elt = XCHAR_TABLE (elt)->contents[c2],
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
246 NILP (elt)))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
247 return defalt;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
248 return elt;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
249 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
250
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
251
88155
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
252 static Lisp_Object
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
253 lookup_overriding_fontspec (frame, c)
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
254 Lisp_Object frame;
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
255 int c;
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
256 {
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
257 Lisp_Object tail;
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
258
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
259 for (tail = Voverriding_fontspec_alist; CONSP (tail); tail = XCDR (tail))
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
260 {
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
261 Lisp_Object val, target, elt;
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
262
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
263 val = XCAR (tail);
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
264 target = XCAR (val);
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
265 val = XCDR (val);
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
266 /* Now VAL is (NO-FRAME-LIST OK-FRAME-LIST CHAR FONTNAME). */
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
267 if (NILP (Fmemq (frame, XCAR (val)))
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
268 && (CHAR_TABLE_P (target)
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
269 ? ! NILP (CHAR_TABLE_REF (target, c))
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
270 : XINT (target) == CHAR_CHARSET (c)))
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
271 {
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
272 val = XCDR (val);
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
273 elt = XCDR (val);
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
274 if (NILP (Fmemq (frame, XCAR (val))))
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
275 {
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
276 if (! face_font_available_p (XFRAME (frame), XCDR (elt)))
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
277 {
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
278 val = XCDR (XCAR (tail));
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
279 XSETCAR (val, Fcons (frame, XCAR (val)));
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
280 continue;
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
281 }
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
282 XSETCAR (val, Fcons (frame, XCAR (val)));
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
283 }
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
284 if (NILP (XCAR (elt)))
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
285 XSETCAR (elt, make_number (c));
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
286 return elt;
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
287 }
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
288 }
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
289 return Qnil;
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
290 }
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
291
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
292 #define FONTSET_REF_VIA_BASE(fontset, c) fontset_ref_via_base (fontset, &c)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
293
30398
dde5ab185aad (fontset_ref): Remove INLINE declaration.
Kenichi Handa <handa@m17n.org>
parents: 30172
diff changeset
294 static Lisp_Object
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
295 fontset_ref_via_base (fontset, c)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
296 Lisp_Object fontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
297 int *c;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
298 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
299 int charset, c1, c2;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
300 Lisp_Object elt;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
301
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
302 if (SINGLE_BYTE_CHAR_P (*c))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
303 return FONTSET_ASCII (fontset);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
304
88155
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
305 elt = Qnil;
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
306 if (! EQ (FONTSET_BASE (fontset), Vdefault_fontset))
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
307 elt = FONTSET_REF (FONTSET_BASE (fontset), *c);
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
308 if (NILP (elt))
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
309 elt = lookup_overriding_fontspec (FONTSET_FRAME (fontset), *c);
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
310 if (NILP (elt))
29767
c8e5453dc85d (FONTSET_ASCII): Use the first element of char table
Kenichi Handa <handa@m17n.org>
parents: 29501
diff changeset
311 elt = FONTSET_REF (Vdefault_fontset, *c);
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
312 if (NILP (elt))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
313 return Qnil;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
314
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
315 *c = XINT (XCAR (elt));
29011
b60861d6c1e0 (fontset_ref): Use SPLIT_CHAR instead of
Kenichi Handa <handa@m17n.org>
parents: 28971
diff changeset
316 SPLIT_CHAR (*c, charset, c1, c2);
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
317 elt = XCHAR_TABLE (fontset)->contents[charset + 128];
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
318 if (c1 < 32)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
319 return (SUB_CHAR_TABLE_P (elt) ? XCHAR_TABLE (elt)->defalt : elt);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
320 if (!SUB_CHAR_TABLE_P (elt))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
321 return Qnil;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
322 elt = XCHAR_TABLE (elt)->contents[c1];
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
323 if (c2 < 32)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
324 return (SUB_CHAR_TABLE_P (elt) ? XCHAR_TABLE (elt)->defalt : elt);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
325 if (!SUB_CHAR_TABLE_P (elt))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
326 return Qnil;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
327 elt = XCHAR_TABLE (elt)->contents[c2];
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
328 return elt;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
329 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
330
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
331
30398
dde5ab185aad (fontset_ref): Remove INLINE declaration.
Kenichi Handa <handa@m17n.org>
parents: 30172
diff changeset
332 /* Store into the element of FONTSET at index C the value NEWELT. */
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
333 #define FONTSET_SET(fontset, c, newelt) fontset_set(fontset, c, newelt)
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 static void
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
336 fontset_set (fontset, c, newelt)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
337 Lisp_Object fontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
338 int c;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
339 Lisp_Object newelt;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
340 {
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
341 int charset, code[3];
34975
0d69e2d2724e (fontset_ref): Remove unused variable `i'.
Eli Zaretskii <eliz@gnu.org>
parents: 32978
diff changeset
342 Lisp_Object *elt;
0d69e2d2724e (fontset_ref): Remove unused variable `i'.
Eli Zaretskii <eliz@gnu.org>
parents: 32978
diff changeset
343 int i;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
344
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
345 if (SINGLE_BYTE_CHAR_P (c))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
346 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
347 FONTSET_ASCII (fontset) = newelt;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
348 return;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
349 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
350
29011
b60861d6c1e0 (fontset_ref): Use SPLIT_CHAR instead of
Kenichi Handa <handa@m17n.org>
parents: 28971
diff changeset
351 SPLIT_CHAR (c, charset, code[0], code[1]);
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
352 code[2] = 0; /* anchor */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
353 elt = &XCHAR_TABLE (fontset)->contents[charset + 128];
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
354 for (i = 0; code[i] > 0; i++)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
355 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
356 if (!SUB_CHAR_TABLE_P (*elt))
88155
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
357 {
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
358 Lisp_Object val = *elt;
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
359 *elt = make_sub_char_table (Qnil);
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
360 XCHAR_TABLE (*elt)->defalt = val;
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
361 }
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
362 elt = &XCHAR_TABLE (*elt)->contents[code[i]];
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
363 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
364 if (SUB_CHAR_TABLE_P (*elt))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
365 XCHAR_TABLE (*elt)->defalt = newelt;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
366 else
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
367 *elt = newelt;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
368 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
369
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
370
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
371 /* Return a newly created fontset with NAME. If BASE is nil, make a
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
372 base fontset. Otherwise make a realized fontset whose parent is
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
373 BASE. */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
374
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
375 static Lisp_Object
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
376 make_fontset (frame, name, base)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
377 Lisp_Object frame, name, base;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
378 {
34975
0d69e2d2724e (fontset_ref): Remove unused variable `i'.
Eli Zaretskii <eliz@gnu.org>
parents: 32978
diff changeset
379 Lisp_Object fontset;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
380 int size = ASIZE (Vfontset_table);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
381 int id = next_fontset_id;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
382
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
383 /* 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
384 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
385 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
386 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
387 id. */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
388 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
389
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
390 if (id + 1 == size)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
391 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
392 Lisp_Object tem;
41987
34952771ae85 Fix typos, remove unnecessary space.
Pavel Janík <Pavel@Janik.cz>
parents: 41052
diff changeset
393 int i;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
394
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
395 tem = Fmake_vector (make_number (size + 8), Qnil);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
396 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
397 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
398 Vfontset_table = tem;
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
29767
c8e5453dc85d (FONTSET_ASCII): Use the first element of char table
Kenichi Handa <handa@m17n.org>
parents: 29501
diff changeset
401 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
402
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
403 FONTSET_ID (fontset) = make_number (id);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
404 FONTSET_NAME (fontset) = name;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
405 FONTSET_FRAME (fontset) = frame;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
406 FONTSET_BASE (fontset) = base;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
407
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
408 AREF (Vfontset_table, id) = fontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
409 next_fontset_id = id + 1;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
410 return fontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
411 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
412
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
413
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
414 /* Return 1 if ID is a valid fontset id, else return 0. */
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 static INLINE int
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
417 fontset_id_valid_p (id)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
418 int id;
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 return (id >= 0 && id < ASIZE (Vfontset_table) - 1);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
421 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
422
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
423
35658
3551e8549d4e (font_family_registry): Even if FONTNAME conform to
Kenichi Handa <handa@m17n.org>
parents: 34975
diff changeset
424 /* Extract `family' and `registry' string from FONTNAME and a cons of
3551e8549d4e (font_family_registry): Even if FONTNAME conform to
Kenichi Handa <handa@m17n.org>
parents: 34975
diff changeset
425 them. Actually, `family' may also contain `foundry', `registry'
3551e8549d4e (font_family_registry): Even if FONTNAME conform to
Kenichi Handa <handa@m17n.org>
parents: 34975
diff changeset
426 may also contain `encoding' of FONTNAME. But, if FONTNAME doesn't
3551e8549d4e (font_family_registry): Even if FONTNAME conform to
Kenichi Handa <handa@m17n.org>
parents: 34975
diff changeset
427 conform to XLFD nor explicitely specifies the other fields
3551e8549d4e (font_family_registry): Even if FONTNAME conform to
Kenichi Handa <handa@m17n.org>
parents: 34975
diff changeset
428 (i.e. not using wildcard `*'), return FONTNAME. If FORCE is
3551e8549d4e (font_family_registry): Even if FONTNAME conform to
Kenichi Handa <handa@m17n.org>
parents: 34975
diff changeset
429 nonzero, specifications of the other fields are ignored, and return
3551e8549d4e (font_family_registry): Even if FONTNAME conform to
Kenichi Handa <handa@m17n.org>
parents: 34975
diff changeset
430 a cons as far as FONTNAME conform to XLFD. */
28223
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 static Lisp_Object
35658
3551e8549d4e (font_family_registry): Even if FONTNAME conform to
Kenichi Handa <handa@m17n.org>
parents: 34975
diff changeset
433 font_family_registry (fontname, force)
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
434 Lisp_Object fontname;
35658
3551e8549d4e (font_family_registry): Even if FONTNAME conform to
Kenichi Handa <handa@m17n.org>
parents: 34975
diff changeset
435 int force;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
436 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
437 Lisp_Object family, registry;
46466
9629aca792bb (font_family_registry, fs_query_fontset):
Ken Raeburn <raeburn@raeburn.org>
parents: 46440
diff changeset
438 const char *p = SDATA (fontname);
9629aca792bb (font_family_registry, fs_query_fontset):
Ken Raeburn <raeburn@raeburn.org>
parents: 46440
diff changeset
439 const char *sep[15];
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
440 int i = 0;
41987
34952771ae85 Fix typos, remove unnecessary space.
Pavel Janík <Pavel@Janik.cz>
parents: 41052
diff changeset
441
35658
3551e8549d4e (font_family_registry): Even if FONTNAME conform to
Kenichi Handa <handa@m17n.org>
parents: 34975
diff changeset
442 while (*p && i < 15)
3551e8549d4e (font_family_registry): Even if FONTNAME conform to
Kenichi Handa <handa@m17n.org>
parents: 34975
diff changeset
443 if (*p++ == '-')
3551e8549d4e (font_family_registry): Even if FONTNAME conform to
Kenichi Handa <handa@m17n.org>
parents: 34975
diff changeset
444 {
3551e8549d4e (font_family_registry): Even if FONTNAME conform to
Kenichi Handa <handa@m17n.org>
parents: 34975
diff changeset
445 if (!force && i >= 2 && i <= 11 && *p != '*' && p[1] != '-')
3551e8549d4e (font_family_registry): Even if FONTNAME conform to
Kenichi Handa <handa@m17n.org>
parents: 34975
diff changeset
446 return fontname;
3551e8549d4e (font_family_registry): Even if FONTNAME conform to
Kenichi Handa <handa@m17n.org>
parents: 34975
diff changeset
447 sep[i++] = p;
3551e8549d4e (font_family_registry): Even if FONTNAME conform to
Kenichi Handa <handa@m17n.org>
parents: 34975
diff changeset
448 }
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
449 if (i != 14)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
450 return fontname;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
451
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
452 family = make_unibyte_string (sep[0], sep[2] - 1 - sep[0]);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
453 registry = make_unibyte_string (sep[12], p - sep[12]);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
454 return Fcons (family, registry);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
455 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
456
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
457
41987
34952771ae85 Fix typos, remove unnecessary space.
Pavel Janík <Pavel@Janik.cz>
parents: 41052
diff changeset
458 /********** 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
459
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
460 /* 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
461
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
462 Lisp_Object
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
463 fontset_name (id)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
464 int id;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
465 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
466 Lisp_Object fontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
467 fontset = FONTSET_FROM_ID (id);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
468 return FONTSET_NAME (fontset);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
469 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
470
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
471
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
472 /* 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
473
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
474 Lisp_Object
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
475 fontset_ascii (id)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
476 int id;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
477 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
478 Lisp_Object fontset, elt;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
479 fontset= FONTSET_FROM_ID (id);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
480 elt = FONTSET_ASCII (fontset);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
481 return XCDR (elt);
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
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
484
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
485 /* Free fontset of FACE. Called from free_realized_face. */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
486
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
487 void
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
488 free_face_fontset (f, face)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
489 FRAME_PTR f;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
490 struct face *face;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
491 {
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
492 if (fontset_id_valid_p (face->fontset))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
493 {
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
494 AREF (Vfontset_table, face->fontset) = Qnil;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
495 if (face->fontset < next_fontset_id)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
496 next_fontset_id = face->fontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
497 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
498 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
499
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
500
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
501 /* 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
502 Otherwise return 0. Called from the macro FACE_SUITABLE_FOR_CHAR_P
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
503 when C is not a single byte character.. */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
504
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
505 int
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
506 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
507 struct face *face;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
508 int c;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
509 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
510 Lisp_Object fontset, elt;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
511
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
512 if (SINGLE_BYTE_CHAR_P (c))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
513 return (face == face->ascii_face);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
514
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
515 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
516 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
517 xassert (!BASE_FONTSET_P (fontset));
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
518
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
519 elt = FONTSET_REF_VIA_BASE (fontset, c);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
520 return (!NILP (elt) && face->id == XFASTINT (elt));
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
521 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
522
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
523
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
524 /* 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
525 The selection of face is done based on the fontset of FACE. FACE
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
526 should already have been realized for ASCII characters. Called
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
527 from the macro FACE_FOR_CHAR when C is not a single byte character. */
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
528
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
529 int
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
530 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
531 FRAME_PTR f;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
532 struct face *face;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
533 int c;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
534 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
535 Lisp_Object fontset, elt;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
536 int face_id;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
537
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
538 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
539 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
540 xassert (!BASE_FONTSET_P (fontset));
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
541
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
542 elt = FONTSET_REF_VIA_BASE (fontset, c);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
543 if (!NILP (elt))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
544 return XINT (elt);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
545
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
546 /* 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
547 realized face for C that has the same fontset. */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
548 face_id = lookup_face (f, face->lface, c, face);
41987
34952771ae85 Fix typos, remove unnecessary space.
Pavel Janík <Pavel@Janik.cz>
parents: 41052
diff changeset
549
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
550 /* Record the face ID in FONTSET at the same index as the
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
551 information in the base fontset. */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
552 FONTSET_SET (fontset, c, make_number (face_id));
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
553 return face_id;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
554 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
555
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
556
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
557 /* 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
558 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
559 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
560 Called from realize_x_face. */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
561
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
562 int
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
563 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
564 FRAME_PTR f;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
565 int base_fontset_id;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
566 {
34975
0d69e2d2724e (fontset_ref): Remove unused variable `i'.
Eli Zaretskii <eliz@gnu.org>
parents: 32978
diff changeset
567 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
568
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
569 XSETFRAME (frame, f);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
570 if (base_fontset_id >= 0)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
571 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
572 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
573 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
574 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
575 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
576 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
577 else
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
578 base_fontset = Vdefault_fontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
579
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
580 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
581 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
582 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
583
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
584
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
585 /* Return the font name pattern for C that is recorded in the fontset
35658
3551e8549d4e (font_family_registry): Even if FONTNAME conform to
Kenichi Handa <handa@m17n.org>
parents: 34975
diff changeset
586 with ID. If a font name pattern is specified (instead of a cons of
3551e8549d4e (font_family_registry): Even if FONTNAME conform to
Kenichi Handa <handa@m17n.org>
parents: 34975
diff changeset
587 family and registry), check if a font can be opened by that pattern
3551e8549d4e (font_family_registry): Even if FONTNAME conform to
Kenichi Handa <handa@m17n.org>
parents: 34975
diff changeset
588 to get the fullname. If a font is opened, return that name.
3551e8549d4e (font_family_registry): Even if FONTNAME conform to
Kenichi Handa <handa@m17n.org>
parents: 34975
diff changeset
589 Otherwise, return nil. If ID is -1, or the fontset doesn't contain
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
590 information about C, get the registry and encoding of C from the
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
591 default fontset. Called from 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
592
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
593 Lisp_Object
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
594 fontset_font_pattern (f, id, c)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
595 FRAME_PTR f;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
596 int id, c;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
597 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
598 Lisp_Object fontset, elt;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
599 struct font_info *fontp;
41987
34952771ae85 Fix typos, remove unnecessary space.
Pavel Janík <Pavel@Janik.cz>
parents: 41052
diff changeset
600
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
601 elt = Qnil;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
602 if (fontset_id_valid_p (id))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
603 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
604 fontset = FONTSET_FROM_ID (id);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
605 xassert (!BASE_FONTSET_P (fontset));
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
606 fontset = FONTSET_BASE (fontset);
88155
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
607 if (! EQ (fontset, Vdefault_fontset))
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
608 elt = FONTSET_REF (fontset, c);
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
609 }
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
610 if (NILP (elt))
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
611 {
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
612 Lisp_Object frame;
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
613
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
614 XSETFRAME (frame, f);
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
615 elt = lookup_overriding_fontspec (frame, c);
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
616 }
29767
c8e5453dc85d (FONTSET_ASCII): Use the first element of char table
Kenichi Handa <handa@m17n.org>
parents: 29501
diff changeset
617 if (NILP (elt))
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
618 elt = FONTSET_REF (Vdefault_fontset, c);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
619
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
620 if (!CONSP (elt))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
621 return Qnil;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
622 if (CONSP (XCDR (elt)))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
623 return XCDR (elt);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
624
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
625 /* The fontset specifies only a font name pattern (not cons of
35658
3551e8549d4e (font_family_registry): Even if FONTNAME conform to
Kenichi Handa <handa@m17n.org>
parents: 34975
diff changeset
626 family and registry). If a font can be opened by that pattern,
3551e8549d4e (font_family_registry): Even if FONTNAME conform to
Kenichi Handa <handa@m17n.org>
parents: 34975
diff changeset
627 return the name of opened font. Otherwise return nil. The
3551e8549d4e (font_family_registry): Even if FONTNAME conform to
Kenichi Handa <handa@m17n.org>
parents: 34975
diff changeset
628 exception is a font for single byte characters. In that case, we
3551e8549d4e (font_family_registry): Even if FONTNAME conform to
Kenichi Handa <handa@m17n.org>
parents: 34975
diff changeset
629 return a cons of FAMILY and REGISTRY extracted from the opened
3551e8549d4e (font_family_registry): Even if FONTNAME conform to
Kenichi Handa <handa@m17n.org>
parents: 34975
diff changeset
630 font name. */
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
631 elt = XCDR (elt);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
632 xassert (STRINGP (elt));
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 45848
diff changeset
633 fontp = FS_LOAD_FONT (f, c, SDATA (elt), -1);
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
634 if (!fontp)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
635 return Qnil;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
636
35658
3551e8549d4e (font_family_registry): Even if FONTNAME conform to
Kenichi Handa <handa@m17n.org>
parents: 34975
diff changeset
637 return font_family_registry (build_string (fontp->full_name),
3551e8549d4e (font_family_registry): Even if FONTNAME conform to
Kenichi Handa <handa@m17n.org>
parents: 34975
diff changeset
638 SINGLE_BYTE_CHAR_P (c));
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
639 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
640
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
641
40028
392c2fe9edd7 (fs_load_font) [WINDOWSNT && _MSC_VER]: Disable
Andrew Innes <andrewi@gnu.org>
parents: 39973
diff changeset
642 #if defined(WINDOWSNT) && defined (_MSC_VER)
392c2fe9edd7 (fs_load_font) [WINDOWSNT && _MSC_VER]: Disable
Andrew Innes <andrewi@gnu.org>
parents: 39973
diff changeset
643 #pragma optimize("", off)
392c2fe9edd7 (fs_load_font) [WINDOWSNT && _MSC_VER]: Disable
Andrew Innes <andrewi@gnu.org>
parents: 39973
diff changeset
644 #endif
392c2fe9edd7 (fs_load_font) [WINDOWSNT && _MSC_VER]: Disable
Andrew Innes <andrewi@gnu.org>
parents: 39973
diff changeset
645
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
646 /* Load a font named FONTNAME to display character C on frame F.
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
647 Return a pointer to the struct font_info of the loaded font. If
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
648 loading fails, return NULL. If FACE is non-zero and a fontset is
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
649 assigned to it, record FACE->id in the fontset for C. If FONTNAME
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
650 is NULL, the name is taken from the fontset of FACE or what
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
651 specified by ID. */
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
652
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
653 struct font_info *
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
654 fs_load_font (f, c, fontname, id, face)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
655 FRAME_PTR f;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
656 int c;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
657 char *fontname;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
658 int id;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
659 struct face *face;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
660 {
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
661 Lisp_Object fontset;
88155
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
662 Lisp_Object list, elt, fullname;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
663 int size = 0;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
664 struct font_info *fontp;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
665 int charset = CHAR_CHARSET (c);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
666
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
667 if (face)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
668 id = face->fontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
669 if (id < 0)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
670 fontset = Qnil;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
671 else
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
672 fontset = FONTSET_FROM_ID (id);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
673
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
674 if (!NILP (fontset)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
675 && !BASE_FONTSET_P (fontset))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
676 {
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
677 elt = FONTSET_REF_VIA_BASE (fontset, c);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
678 if (!NILP (elt))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
679 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
680 /* A suitable face for C is already recorded, which means
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
681 that a proper font is already loaded. */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
682 int face_id = XINT (elt);
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 xassert (face_id == face->id);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
685 face = FACE_FROM_ID (f, face_id);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
686 return (*get_font_info_func) (f, face->font_info_id);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
687 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
688
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
689 if (!fontname && charset == CHARSET_ASCII)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
690 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
691 elt = FONTSET_ASCII (fontset);
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 45848
diff changeset
692 fontname = SDATA (XCDR (elt));
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
693 }
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
694 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
695
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
696 if (!fontname)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
697 /* No way to get fontname. */
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
698 return 0;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
699
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
700 fontp = (*load_font_func) (f, fontname, size);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
701 if (!fontp)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
702 return 0;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
703
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
704 /* 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
705 font_info structure that are not set by (*load_font_func). */
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
706 fontp->charset = charset;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
707
88155
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
708 fullname = build_string (fontp->full_name);
26858
7cc081b4e084 (Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents: 26164
diff changeset
709 fontp->vertical_centering
7cc081b4e084 (Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents: 26164
diff changeset
710 = (STRINGP (Vvertical_centering_font_regexp)
88155
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
711 && (fast_string_match_ignore_case
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
712 (Vvertical_centering_font_regexp, fullname) >= 0));
26858
7cc081b4e084 (Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents: 26164
diff changeset
713
17999
5e325c8057c8 (fs_load_font): Before using a fontset, be sure to
Kenichi Handa <handa@m17n.org>
parents: 17882
diff changeset
714 if (fontp->encoding[1] != FONT_ENCODING_NOT_DECIDED)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
715 {
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
716 /* The font itself tells which code points to be used. Use this
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
717 encoding for all other charsets. */
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
718 int i;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
719
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
720 fontp->encoding[0] = fontp->encoding[1];
17190
6637001cdb4b Adjusted for the change of MAX_CHARSET.
Kenichi Handa <handa@m17n.org>
parents: 17112
diff changeset
721 for (i = MIN_CHARSET_OFFICIAL_DIMENSION1; i <= MAX_CHARSET; i++)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
722 fontp->encoding[i] = fontp->encoding[1];
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
723 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
724 else
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
725 {
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
726 /* The font itself doesn't have information about encoding. */
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
727 int i;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
728
28766
da7e00e4eaa6 (fs_load_font): By default, use 0x00..0x7f for ASCII.
Kenichi Handa <handa@m17n.org>
parents: 28676
diff changeset
729 /* By default, encoding of ASCII chars is 0 (i.e. 0x00..0x7F),
da7e00e4eaa6 (fs_load_font): By default, use 0x00..0x7f for ASCII.
Kenichi Handa <handa@m17n.org>
parents: 28676
diff changeset
730 others is 1 (i.e. 0x80..0xFF). */
da7e00e4eaa6 (fs_load_font): By default, use 0x00..0x7f for ASCII.
Kenichi Handa <handa@m17n.org>
parents: 28676
diff changeset
731 fontp->encoding[0] = 0;
17190
6637001cdb4b Adjusted for the change of MAX_CHARSET.
Kenichi Handa <handa@m17n.org>
parents: 17112
diff changeset
732 for (i = MIN_CHARSET_OFFICIAL_DIMENSION1; i <= MAX_CHARSET; i++)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
733 fontp->encoding[i] = 1;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
734 /* Then override them by a specification in Vfont_encoding_alist. */
26164
d39ec0a27081 more XCAR/XCDR/XFLOAT_DATA uses, to help isolete lisp engine
Ken Raeburn <raeburn@raeburn.org>
parents: 25668
diff changeset
735 for (list = Vfont_encoding_alist; CONSP (list); list = XCDR (list))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
736 {
26164
d39ec0a27081 more XCAR/XCDR/XFLOAT_DATA uses, to help isolete lisp engine
Ken Raeburn <raeburn@raeburn.org>
parents: 25668
diff changeset
737 elt = XCAR (list);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
738 if (CONSP (elt)
26164
d39ec0a27081 more XCAR/XCDR/XFLOAT_DATA uses, to help isolete lisp engine
Ken Raeburn <raeburn@raeburn.org>
parents: 25668
diff changeset
739 && STRINGP (XCAR (elt)) && CONSP (XCDR (elt))
88155
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
740 && (fast_string_match_ignore_case (XCAR (elt), fullname) >= 0))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
741 {
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
742 Lisp_Object tmp;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
743
26164
d39ec0a27081 more XCAR/XCDR/XFLOAT_DATA uses, to help isolete lisp engine
Ken Raeburn <raeburn@raeburn.org>
parents: 25668
diff changeset
744 for (tmp = XCDR (elt); CONSP (tmp); tmp = XCDR (tmp))
d39ec0a27081 more XCAR/XCDR/XFLOAT_DATA uses, to help isolete lisp engine
Ken Raeburn <raeburn@raeburn.org>
parents: 25668
diff changeset
745 if (CONSP (XCAR (tmp))
d39ec0a27081 more XCAR/XCDR/XFLOAT_DATA uses, to help isolete lisp engine
Ken Raeburn <raeburn@raeburn.org>
parents: 25668
diff changeset
746 && ((i = get_charset_id (XCAR (XCAR (tmp))))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
747 >= 0)
26164
d39ec0a27081 more XCAR/XCDR/XFLOAT_DATA uses, to help isolete lisp engine
Ken Raeburn <raeburn@raeburn.org>
parents: 25668
diff changeset
748 && INTEGERP (XCDR (XCAR (tmp)))
d39ec0a27081 more XCAR/XCDR/XFLOAT_DATA uses, to help isolete lisp engine
Ken Raeburn <raeburn@raeburn.org>
parents: 25668
diff changeset
749 && XFASTINT (XCDR (XCAR (tmp))) < 4)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
750 fontp->encoding[i]
26164
d39ec0a27081 more XCAR/XCDR/XFLOAT_DATA uses, to help isolete lisp engine
Ken Raeburn <raeburn@raeburn.org>
parents: 25668
diff changeset
751 = XFASTINT (XCDR (XCAR (tmp)));
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
752 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
753 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
754 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
755
88155
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
756 if (! fontp->font_encoder && find_ccl_program_func)
21553
2d7afcd11b72 (find_ccl_program_func): New variable.
Kenichi Handa <handa@m17n.org>
parents: 21514
diff changeset
757 (*find_ccl_program_func) (fontp);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
758
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
759 /* If we loaded a font for a face that has fontset, record the face
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
760 ID in the fontset for C. */
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
761 if (face
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
762 && !NILP (fontset)
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
763 && !BASE_FONTSET_P (fontset))
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
764 FONTSET_SET (fontset, c, make_number (face->id));
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
765 return fontp;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
766 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
767
40028
392c2fe9edd7 (fs_load_font) [WINDOWSNT && _MSC_VER]: Disable
Andrew Innes <andrewi@gnu.org>
parents: 39973
diff changeset
768 #if defined(WINDOWSNT) && defined (_MSC_VER)
392c2fe9edd7 (fs_load_font) [WINDOWSNT && _MSC_VER]: Disable
Andrew Innes <andrewi@gnu.org>
parents: 39973
diff changeset
769 #pragma optimize("", on)
392c2fe9edd7 (fs_load_font) [WINDOWSNT && _MSC_VER]: Disable
Andrew Innes <andrewi@gnu.org>
parents: 39973
diff changeset
770 #endif
392c2fe9edd7 (fs_load_font) [WINDOWSNT && _MSC_VER]: Disable
Andrew Innes <andrewi@gnu.org>
parents: 39973
diff changeset
771
88155
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
772 /* Set the ASCII font of the default fontset to FONTNAME if that is
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
773 not yet set. */
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
774 void
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
775 set_default_ascii_font (fontname)
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
776 Lisp_Object fontname;
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
777 {
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
778 if (! CONSP (FONTSET_ASCII (Vdefault_fontset)))
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
779 {
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
780 int id = fs_query_fontset (fontname, 2);
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
781
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
782 if (id >= 0)
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
783 fontname = XCDR (FONTSET_ASCII (FONTSET_FROM_ID (id)));
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
784 FONTSET_ASCII (Vdefault_fontset)
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
785 = Fcons (make_number (0), fontname);
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
786 }
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
787 }
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
788
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
789
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
790 /* Cache data used by fontset_pattern_regexp. The car part is a
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
791 pattern string containing at least one wild card, the cdr part is
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
792 the corresponding regular expression. */
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
793 static Lisp_Object Vcached_fontset_data;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
794
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 45848
diff changeset
795 #define CACHED_FONTSET_NAME (SDATA (XCAR (Vcached_fontset_data)))
26164
d39ec0a27081 more XCAR/XCDR/XFLOAT_DATA uses, to help isolete lisp engine
Ken Raeburn <raeburn@raeburn.org>
parents: 25668
diff changeset
796 #define CACHED_FONTSET_REGEX (XCDR (Vcached_fontset_data))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
797
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
798 /* If fontset name PATTERN contains any wild card, return regular
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
799 expression corresponding to PATTERN. */
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
800
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
801 static Lisp_Object
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
802 fontset_pattern_regexp (pattern)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
803 Lisp_Object pattern;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
804 {
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 45848
diff changeset
805 if (!index (SDATA (pattern), '*')
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 45848
diff changeset
806 && !index (SDATA (pattern), '?'))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
807 /* PATTERN does not contain any wild cards. */
17730
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
808 return Qnil;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
809
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
810 if (!CONSP (Vcached_fontset_data)
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 45848
diff changeset
811 || strcmp (SDATA (pattern), CACHED_FONTSET_NAME))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
812 {
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
813 /* We must at first update the cached data. */
88155
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
814 unsigned char *regex, *p0, *p1;
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
815 int ndashes = 0, nstars = 0;
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
816
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
817 for (p0 = SDATA (pattern); *p0; p0++)
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
818 {
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
819 if (*p0 == '-')
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
820 ndashes++;
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
821 else if (*p0 == '*')
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
822 nstars++;
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
823 }
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
824
88155
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
825 /* If PATTERN is not full XLFD we conert "*" to ".*". Otherwise
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
826 we convert "*" to "[^-]*" which is much faster in regular
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
827 expression matching. */
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
828 if (ndashes < 14)
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
829 p1 = regex = (unsigned char *) alloca (SBYTES (pattern) + 2 * nstars + 1);
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
830 else
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
831 p1 = regex = (unsigned char *) alloca (SBYTES (pattern) + 5 * nstars + 1);
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
832
17730
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
833 *p1++ = '^';
88155
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
834 for (p0 = SDATA (pattern); *p0; p0++)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
835 {
17730
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
836 if (*p0 == '*')
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
837 {
88155
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
838 if (ndashes < 14)
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
839 *p1++ = '.';
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
840 else
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
841 *p1++ = '[', *p1++ = '^', *p1++ = '-', *p1++ = ']';
17730
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
842 *p1++ = '*';
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
843 }
17730
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
844 else if (*p0 == '?')
21127
577865651099 (fontset_pattern_regexp): `==' was used instead of `='.
Richard M. Stallman <rms@gnu.org>
parents: 20346
diff changeset
845 *p1++ = '.';
17730
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
846 else
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
847 *p1++ = *p0;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
848 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
849 *p1++ = '$';
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
850 *p1++ = 0;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
851
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 45848
diff changeset
852 Vcached_fontset_data = Fcons (build_string (SDATA (pattern)),
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
853 build_string (regex));
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
854 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
855
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
856 return CACHED_FONTSET_REGEX;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
857 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
858
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
859 /* Return ID of the base fontset named NAME. If there's no such
88155
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
860 fontset, return -1. NAME_PATTERN specifies how to treat NAME as this:
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
861 0: pattern containing '*' and '?' as wildcards
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
862 1: regular expression
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
863 2: literal fontset name
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
864 */
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
865
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
866 int
88155
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
867 fs_query_fontset (name, name_pattern)
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
868 Lisp_Object name;
88155
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
869 int name_pattern;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
870 {
34975
0d69e2d2724e (fontset_ref): Remove unused variable `i'.
Eli Zaretskii <eliz@gnu.org>
parents: 32978
diff changeset
871 Lisp_Object tem;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
872 int i;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
873
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
874 name = Fdowncase (name);
88155
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
875 if (name_pattern != 1)
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
876 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
877 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
878 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
879 name = XCAR (tem);
88155
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
880 else if (name_pattern == 0)
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
881 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
882 tem = fontset_pattern_regexp (name);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
883 if (STRINGP (tem))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
884 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
885 name = tem;
88155
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
886 name_pattern = 1;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
887 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
888 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
889 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
890
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
891 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
892 {
88155
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
893 Lisp_Object fontset, this_name;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
894
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
895 fontset = FONTSET_FROM_ID (i);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
896 if (NILP (fontset)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
897 || !BASE_FONTSET_P (fontset))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
898 continue;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
899
88155
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
900 this_name = FONTSET_NAME (fontset);
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
901 if (name_pattern == 1
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
902 ? fast_string_match (name, this_name) >= 0
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
903 : !strcmp (SDATA (name), SDATA (this_name)))
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
904 return i;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
905 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
906 return -1;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
907 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
908
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
909
21553
2d7afcd11b72 (find_ccl_program_func): New variable.
Kenichi Handa <handa@m17n.org>
parents: 21514
diff changeset
910 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
911 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
912 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
913 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
914 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
915 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
916 (pattern, regexpp)
21553
2d7afcd11b72 (find_ccl_program_func): New variable.
Kenichi Handa <handa@m17n.org>
parents: 21514
diff changeset
917 Lisp_Object pattern, regexpp;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
918 {
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
919 Lisp_Object fontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
920 int id;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
921
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
922 (*check_window_system_func) ();
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
923
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40028
diff changeset
924 CHECK_STRING (pattern);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
925
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 45848
diff changeset
926 if (SCHARS (pattern) == 0)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
927 return Qnil;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
928
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
929 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
930 if (id < 0)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
931 return Qnil;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
932
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
933 fontset = FONTSET_FROM_ID (id);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
934 return FONTSET_NAME (fontset);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
935 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
936
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
937 /* Return a list of base fontset names matching PATTERN on frame F.
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
938 If SIZE is not 0, it is the size (maximum bound width) of fontsets
41987
34952771ae85 Fix typos, remove unnecessary space.
Pavel Janík <Pavel@Janik.cz>
parents: 41052
diff changeset
939 to be listed. */
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
940
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
941 Lisp_Object
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
942 list_fontsets (f, pattern, size)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
943 FRAME_PTR f;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
944 Lisp_Object pattern;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
945 int size;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
946 {
34975
0d69e2d2724e (fontset_ref): Remove unused variable `i'.
Eli Zaretskii <eliz@gnu.org>
parents: 32978
diff changeset
947 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
948 int id;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
949
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
950 XSETFRAME (frame, f);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
951
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
952 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
953 val = Qnil;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
954
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
955 for (id = 0; id < ASIZE (Vfontset_table); id++)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
956 {
88155
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
957 Lisp_Object fontset, name;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
958
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
959 fontset = FONTSET_FROM_ID (id);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
960 if (NILP (fontset)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
961 || !BASE_FONTSET_P (fontset)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
962 || !EQ (frame, FONTSET_FRAME (fontset)))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
963 continue;
88155
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
964 name = FONTSET_NAME (fontset);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
965
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
966 if (!NILP (regexp)
88155
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
967 ? (fast_string_match (regexp, name) < 0)
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
968 : strcmp (SDATA (pattern), SDATA (name)))
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
969 continue;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
970
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
971 if (size)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
972 {
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
973 struct font_info *fontp;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
974 fontp = FS_LOAD_FONT (f, 0, NULL, id);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
975 if (!fontp || size != fontp->size)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
976 continue;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
977 }
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
978 val = Fcons (Fcopy_sequence (FONTSET_NAME (fontset)), val);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
979 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
980
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
981 return val;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
982 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
983
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
984 DEFUN ("new-fontset", Fnew_fontset, Snew_fontset, 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
985 doc: /* Create a new fontset NAME that contains font information in FONTLIST.
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
986 FONTLIST is an alist of charsets vs corresponding font name patterns. */)
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
987 (name, fontlist)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
988 Lisp_Object name, fontlist;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
989 {
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
990 Lisp_Object fontset, elements, ascii_font;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
991 Lisp_Object tem, tail, elt;
88155
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
992 int id;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
993
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
994 (*check_window_system_func) ();
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
995
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40028
diff changeset
996 CHECK_STRING (name);
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40028
diff changeset
997 CHECK_LIST (fontlist);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
998
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
999 name = Fdowncase (name);
88155
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1000 id = fs_query_fontset (name, 2);
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1001 if (id >= 0)
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1002 {
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1003 fontset = FONTSET_FROM_ID (id);
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1004 tem = FONTSET_NAME (fontset);
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1005 error ("Fontset `%s' matches the existing fontset `%s'",
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1006 SDATA (name), SDATA (tem));
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1007 }
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1008
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1009 /* Check the validity of FONTLIST while creating a template for
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1010 fontset elements. */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1011 elements = ascii_font = Qnil;
26164
d39ec0a27081 more XCAR/XCDR/XFLOAT_DATA uses, to help isolete lisp engine
Ken Raeburn <raeburn@raeburn.org>
parents: 25668
diff changeset
1012 for (tail = fontlist; CONSP (tail); tail = XCDR (tail))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1013 {
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1014 int c, charset;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1015
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1016 tem = XCAR (tail);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1017 if (!CONSP (tem)
26164
d39ec0a27081 more XCAR/XCDR/XFLOAT_DATA uses, to help isolete lisp engine
Ken Raeburn <raeburn@raeburn.org>
parents: 25668
diff changeset
1018 || (charset = get_charset_id (XCAR (tem))) < 0
36370
751cb07c5f11 (Fnew_fontset): Fix handling of the case that an
Kenichi Handa <handa@m17n.org>
parents: 35663
diff changeset
1019 || (!STRINGP (XCDR (tem)) && !CONSP (XCDR (tem))))
751cb07c5f11 (Fnew_fontset): Fix handling of the case that an
Kenichi Handa <handa@m17n.org>
parents: 35663
diff changeset
1020 error ("Elements of fontlist must be a cons of charset and font name pattern");
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1021
36370
751cb07c5f11 (Fnew_fontset): Fix handling of the case that an
Kenichi Handa <handa@m17n.org>
parents: 35663
diff changeset
1022 tem = XCDR (tem);
751cb07c5f11 (Fnew_fontset): Fix handling of the case that an
Kenichi Handa <handa@m17n.org>
parents: 35663
diff changeset
1023 if (STRINGP (tem))
751cb07c5f11 (Fnew_fontset): Fix handling of the case that an
Kenichi Handa <handa@m17n.org>
parents: 35663
diff changeset
1024 tem = Fdowncase (tem);
751cb07c5f11 (Fnew_fontset): Fix handling of the case that an
Kenichi Handa <handa@m17n.org>
parents: 35663
diff changeset
1025 else
751cb07c5f11 (Fnew_fontset): Fix handling of the case that an
Kenichi Handa <handa@m17n.org>
parents: 35663
diff changeset
1026 tem = Fcons (Fdowncase (Fcar (tem)), Fdowncase (Fcdr (tem)));
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1027 if (charset == CHARSET_ASCII)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1028 ascii_font = tem;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1029 else
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1030 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1031 c = MAKE_CHAR (charset, 0, 0);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1032 elements = Fcons (Fcons (make_number (c), tem), elements);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1033 }
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1034 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1035
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1036 if (NILP (ascii_font))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1037 error ("No ASCII font in the fontlist");
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1038
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1039 fontset = make_fontset (Qnil, name, Qnil);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1040 FONTSET_ASCII (fontset) = Fcons (make_number (0), ascii_font);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1041 for (; CONSP (elements); elements = XCDR (elements))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1042 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1043 elt = XCAR (elements);
36370
751cb07c5f11 (Fnew_fontset): Fix handling of the case that an
Kenichi Handa <handa@m17n.org>
parents: 35663
diff changeset
1044 tem = XCDR (elt);
751cb07c5f11 (Fnew_fontset): Fix handling of the case that an
Kenichi Handa <handa@m17n.org>
parents: 35663
diff changeset
1045 if (STRINGP (tem))
751cb07c5f11 (Fnew_fontset): Fix handling of the case that an
Kenichi Handa <handa@m17n.org>
parents: 35663
diff changeset
1046 tem = font_family_registry (tem, 0);
751cb07c5f11 (Fnew_fontset): Fix handling of the case that an
Kenichi Handa <handa@m17n.org>
parents: 35663
diff changeset
1047 tem = Fcons (XCAR (elt), tem);
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1048 FONTSET_SET (fontset, XINT (XCAR (elt)), tem);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1049 }
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1050
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1051 return Qnil;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1052 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1053
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1054
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1055 /* Clear all elements of FONTSET for multibyte characters. */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1056
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1057 static void
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1058 clear_fontset_elements (fontset)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1059 Lisp_Object fontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1060 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1061 int i;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1062
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1063 for (i = CHAR_TABLE_SINGLE_BYTE_SLOTS; i < CHAR_TABLE_ORDINARY_SLOTS; i++)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1064 XCHAR_TABLE (fontset)->contents[i] = Qnil;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1065 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1066
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1067
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1068 /* 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
1069 corresponding fontset. If not valid, signal an error.
88155
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1070 If NAME is nil, return Vdefault_fontset. */
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1071
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1072 static Lisp_Object
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1073 check_fontset_name (name)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1074 Lisp_Object name;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1075 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1076 int id;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1077
88155
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1078 if (EQ (name, Qnil))
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1079 return Vdefault_fontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1080
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40028
diff changeset
1081 CHECK_STRING (name);
88155
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1082 /* First try NAME as literal. */
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1083 id = fs_query_fontset (name, 2);
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1084 if (id < 0)
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1085 /* For backward compatibility, try again NAME as pattern. */
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1086 id = fs_query_fontset (name, 0);
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1087 if (id < 0)
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 45848
diff changeset
1088 error ("Fontset `%s' does not exist", SDATA (name));
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1089 return FONTSET_FROM_ID (id);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1090 }
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1091
88155
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1092 /* Downcase FONTNAME or car and cdr of FONTNAME. If FONTNAME is a
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1093 string, maybe change FONTNAME to (FAMILY . REGISTRY). */
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1094
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1095 static Lisp_Object
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1096 regularize_fontname (Lisp_Object fontname)
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1097 {
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1098 Lisp_Object family, registry;
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1099
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1100 if (STRINGP (fontname))
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1101 return font_family_registry (Fdowncase (fontname), 0);
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1102
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1103 CHECK_CONS (fontname);
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1104 family = XCAR (fontname);
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1105 registry = XCDR (fontname);
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1106 if (!NILP (family))
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1107 {
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1108 CHECK_STRING (family);
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1109 family = Fdowncase (family);
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1110 }
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1111 if (!NILP (registry))
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1112 {
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1113 CHECK_STRING (registry);
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1114 registry = Fdowncase (registry);
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1115 }
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1116 return Fcons (family, registry);
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1117 }
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1118
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1119 DEFUN ("set-fontset-font", Fset_fontset_font, Sset_fontset_font, 3, 4, 0,
41001
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1120 doc: /* Modify fontset NAME to use FONTNAME for CHARACTER.
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1121
88155
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1122 If NAME is nil, modify the default fontset.
41001
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1123 CHARACTER may be a cons; (FROM . TO), where FROM and TO are
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1124 non-generic characters. In that case, use FONTNAME
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1125 for all characters in the range FROM and TO (inclusive).
47277
8a4e82b00f6f (Fset_fontset_font): Fix spacing.
Juanma Barranquero <lekktu@gmail.com>
parents: 46466
diff changeset
1126 CHARACTER may be a charset. In that case, use FONTNAME
41001
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1127 for all character in the charsets.
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1128
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1129 FONTNAME may be a cons; (FAMILY . REGISTRY), where FAMILY is a family
41987
34952771ae85 Fix typos, remove unnecessary space.
Pavel Janík <Pavel@Janik.cz>
parents: 41052
diff changeset
1130 name of a font, REGISTRY is a registry name of a font. */)
41001
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1131 (name, character, fontname, frame)
28676
0a677c35ad99 (Fset_fontset_font): Fix docstring. Local variable
Kenichi Handa <handa@m17n.org>
parents: 28511
diff changeset
1132 Lisp_Object name, character, fontname, frame;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1133 {
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1134 Lisp_Object fontset, elt;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1135 Lisp_Object realized;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1136 int from, to;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1137 int id;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1138
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1139 fontset = check_fontset_name (name);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1140
28676
0a677c35ad99 (Fset_fontset_font): Fix docstring. Local variable
Kenichi Handa <handa@m17n.org>
parents: 28511
diff changeset
1141 if (CONSP (character))
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1142 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1143 /* CH should be (FROM . TO) where FROM and TO are non-generic
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1144 characters. */
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40028
diff changeset
1145 CHECK_NUMBER_CAR (character);
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40028
diff changeset
1146 CHECK_NUMBER_CDR (character);
28676
0a677c35ad99 (Fset_fontset_font): Fix docstring. Local variable
Kenichi Handa <handa@m17n.org>
parents: 28511
diff changeset
1147 from = XINT (XCAR (character));
0a677c35ad99 (Fset_fontset_font): Fix docstring. Local variable
Kenichi Handa <handa@m17n.org>
parents: 28511
diff changeset
1148 to = XINT (XCDR (character));
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1149 if (!char_valid_p (from, 0) || !char_valid_p (to, 0))
88155
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1150 error ("Character range should be by non-generic characters");
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1151 if (!NILP (name)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1152 && (SINGLE_BYTE_CHAR_P (from) || SINGLE_BYTE_CHAR_P (to)))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1153 error ("Can't change font for a single byte character");
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1154 }
29501
f901ec87b147 (Fset_fontset_font): The arg CHARACTER may be a charset.
Kenichi Handa <handa@m17n.org>
parents: 29233
diff changeset
1155 else if (SYMBOLP (character))
f901ec87b147 (Fset_fontset_font): The arg CHARACTER may be a charset.
Kenichi Handa <handa@m17n.org>
parents: 29233
diff changeset
1156 {
f901ec87b147 (Fset_fontset_font): The arg CHARACTER may be a charset.
Kenichi Handa <handa@m17n.org>
parents: 29233
diff changeset
1157 elt = Fget (character, Qcharset);
f901ec87b147 (Fset_fontset_font): The arg CHARACTER may be a charset.
Kenichi Handa <handa@m17n.org>
parents: 29233
diff changeset
1158 if (!VECTORP (elt) || ASIZE (elt) < 1 || !NATNUMP (AREF (elt, 0)))
46440
dd231f1390d2 (Fset_fontset_font): Use SDATA instead of XSTRING()->data.
Ken Raeburn <raeburn@raeburn.org>
parents: 46370
diff changeset
1159 error ("Invalid charset: %s", SDATA (SYMBOL_NAME (character)));
29501
f901ec87b147 (Fset_fontset_font): The arg CHARACTER may be a charset.
Kenichi Handa <handa@m17n.org>
parents: 29233
diff changeset
1160 from = MAKE_CHAR (XINT (AREF (elt, 0)), 0, 0);
f901ec87b147 (Fset_fontset_font): The arg CHARACTER may be a charset.
Kenichi Handa <handa@m17n.org>
parents: 29233
diff changeset
1161 to = from;
f901ec87b147 (Fset_fontset_font): The arg CHARACTER may be a charset.
Kenichi Handa <handa@m17n.org>
parents: 29233
diff changeset
1162 }
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1163 else
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1164 {
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40028
diff changeset
1165 CHECK_NUMBER (character);
28676
0a677c35ad99 (Fset_fontset_font): Fix docstring. Local variable
Kenichi Handa <handa@m17n.org>
parents: 28511
diff changeset
1166 from = XINT (character);
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1167 to = from;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1168 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1169 if (!char_valid_p (from, 1))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1170 invalid_character (from);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1171 if (SINGLE_BYTE_CHAR_P (from))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1172 error ("Can't change font for a single byte character");
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1173 if (from < to)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1174 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1175 if (!char_valid_p (to, 1))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1176 invalid_character (to);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1177 if (SINGLE_BYTE_CHAR_P (to))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1178 error ("Can't change font for a single byte character");
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1179 }
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1180
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1181 /* 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
1182 the validity. */
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1183 if (!NILP (frame))
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40028
diff changeset
1184 CHECK_LIVE_FRAME (frame);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1185
88155
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1186 elt = Fcons (make_number (from), regularize_fontname (fontname));
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1187 for (; from <= to; from++)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1188 FONTSET_SET (fontset, from, elt);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1189 Foptimize_char_table (fontset);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1190
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1191 /* If there's a realized fontset REALIZED whose parent is FONTSET,
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1192 clear all the elements of REALIZED and free all multibyte faces
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1193 whose fontset is REALIZED. This way, the specified character(s)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1194 are surely redisplayed by a correct font. */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1195 for (id = 0; id < ASIZE (Vfontset_table); id++)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1196 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1197 realized = AREF (Vfontset_table, id);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1198 if (!NILP (realized)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1199 && !BASE_FONTSET_P (realized)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1200 && EQ (FONTSET_BASE (realized), fontset))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1201 {
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1202 FRAME_PTR f = XFRAME (FONTSET_FRAME (realized));
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1203 clear_fontset_elements (realized);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1204 free_realized_multibyte_face (f, id);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1205 }
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1206 }
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1207
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1208 return Qnil;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1209 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1210
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1211 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
1212 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
1213 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
1214 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
1215 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
1216 where
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1217 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
1218 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
1219 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
1220 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
1221 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
1222 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
1223 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
1224 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
1225 (name, frame)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1226 Lisp_Object name, frame;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1227 {
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1228 FRAME_PTR f;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1229 struct font_info *fontp;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1230 Lisp_Object info;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1231
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1232 (*check_window_system_func) ();
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1233
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40028
diff changeset
1234 CHECK_STRING (name);
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1235 name = Fdowncase (name);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1236 if (NILP (frame))
25668
99290b59352d (Ffont_info): Change for Lisp_Object selected_frame.
Gerd Moellmann <gerd@gnu.org>
parents: 24611
diff changeset
1237 frame = selected_frame;
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40028
diff changeset
1238 CHECK_LIVE_FRAME (frame);
25668
99290b59352d (Ffont_info): Change for Lisp_Object selected_frame.
Gerd Moellmann <gerd@gnu.org>
parents: 24611
diff changeset
1239 f = XFRAME (frame);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1240
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1241 if (!query_font_func)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1242 error ("Font query function is not supported");
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1243
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 45848
diff changeset
1244 fontp = (*query_font_func) (f, SDATA (name));
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1245 if (!fontp)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1246 return Qnil;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1247
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1248 info = Fmake_vector (make_number (7), Qnil);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1249
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1250 XVECTOR (info)->contents[0] = build_string (fontp->name);
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1251 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
1252 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
1253 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
1254 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
1255 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
1256 XVECTOR (info)->contents[6] = make_number (fontp->default_ascent);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1257
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1258 return info;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1259 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1260
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1261
88155
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1262 /* Return a cons (FONT-NAME . GLYPH-CODE).
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1263 FONT-NAME is the font name for the character at POSITION in the current
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1264 buffer. This is computed from all the text properties and overlays
88155
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1265 that apply to POSITION. POSTION may be nil, in which case,
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1266 FONT-NAME is the font name for display the character CH with the
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1267 default face.
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1268
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1269 GLYPH-CODE is the glyph code in the font to use for the character.
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1270
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1271 If the 2nd optional arg CH is non-nil, it is a character to check
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1272 the font instead of the character at POSITION.
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1273
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1274 It returns nil in the following cases:
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1275
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1276 (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
1277 it is displayed by an empty box).
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1278
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1279 (2) The character code is invalid.
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1280
88155
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1281 (3) If POSITION is not nil, and the current buffer is not displayed
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1282 in any window.
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1283
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1284 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
1285 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
1286 POSITION is currently not visible. */
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1287
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1288
88155
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1289 DEFUN ("internal-char-font", Finternal_char_font, Sinternal_char_font, 1, 2, 0,
41001
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1290 doc: /* For internal use only. */)
88155
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1291 (position, ch)
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1292 Lisp_Object position, ch;
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1293 {
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1294 int pos, pos_byte, dummy;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1295 int face_id;
88155
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1296 int c, code;
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1297 struct frame *f;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1298 struct face *face;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1299
88155
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1300 if (NILP (position))
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1301 {
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1302 CHECK_NATNUM (ch);
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1303 c = XINT (ch);
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1304 f = XFRAME (selected_frame);
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1305 face_id = DEFAULT_FACE_ID;
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1306 }
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1307 else
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1308 {
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1309 Lisp_Object window;
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1310 struct window *w;
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1311
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1312 CHECK_NUMBER_COERCE_MARKER (position);
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1313 pos = XINT (position);
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1314 if (pos < BEGV || pos >= ZV)
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1315 args_out_of_range_3 (position, make_number (BEGV), make_number (ZV));
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1316 pos_byte = CHAR_TO_BYTE (pos);
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1317 if (NILP (ch))
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1318 c = FETCH_CHAR (pos_byte);
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1319 else
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1320 {
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1321 CHECK_NATNUM (ch);
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1322 c = XINT (ch);
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1323 }
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1324 window = Fget_buffer_window (Fcurrent_buffer (), Qnil);
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1325 if (NILP (window))
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1326 return Qnil;
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1327 w = XWINDOW (window);
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1328 f = XFRAME (w->frame);
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1329 face_id = face_at_buffer_position (w, pos, -1, -1, &dummy, pos + 100, 0);
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1330 }
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1331 if (! CHAR_VALID_P (c, 0))
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1332 return Qnil;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1333 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
1334 face = FACE_FROM_ID (f, face_id);
88155
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1335 if (! face->font || ! face->font_name)
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1336 return Qnil;
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1337
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1338 {
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1339 struct font_info *fontp = (*get_font_info_func) (f, face->font_info_id);
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1340 XChar2b char2b;
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1341 int c1, c2, charset;
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1342
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1343 SPLIT_CHAR (c, charset, c1, c2);
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1344 if (c2 > 0)
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1345 STORE_XCHAR2B (&char2b, c1, c2);
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1346 else
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1347 STORE_XCHAR2B (&char2b, 0, c1);
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1348 rif->encode_char (c, &char2b, fontp, NULL);
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1349 code = (XCHAR2B_BYTE1 (&char2b) << 8) | XCHAR2B_BYTE2 (&char2b);
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1350 }
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1351 return Fcons (build_string (face->font_name), make_number (code));
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1352 }
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1353
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1354
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1355 /* Called from Ffontset_info via map_char_table on each leaf of
88155
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1356 fontset. ARG is a copy of the default fontset. The current leaf
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1357 is indexed by CHARACTER and has value ELT. This function override
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1358 the copy by ELT if ELT is not nil. */
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1359
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1360 static void
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1361 override_font_info (fontset, character, elt)
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1362 Lisp_Object fontset, character, elt;
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1363 {
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1364 if (! NILP (elt))
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1365 Faset (fontset, character, elt);
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1366 }
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1367
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1368 /* Called from Ffontset_info via map_char_table on each leaf of
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1369 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
1370 ARG)' and FONT-INFOs have this form:
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1371 (CHAR FONT-SPEC) or ((FROM . TO) FONT-SPEC)
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1372 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
1373 function add the information of the current leaf to ARG by
88155
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1374 appending a new element or modifying the last element. */
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1375
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1376 static void
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1377 accumulate_font_info (arg, character, elt)
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1378 Lisp_Object arg, character, elt;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1379 {
34975
0d69e2d2724e (fontset_ref): Remove unused variable `i'.
Eli Zaretskii <eliz@gnu.org>
parents: 32978
diff changeset
1380 Lisp_Object last, last_char, last_elt;
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1381
29767
c8e5453dc85d (FONTSET_ASCII): Use the first element of char table
Kenichi Handa <handa@m17n.org>
parents: 29501
diff changeset
1382 if (!CONSP (elt) && !SINGLE_BYTE_CHAR_P (XINT (character)))
c8e5453dc85d (FONTSET_ASCII): Use the first element of char table
Kenichi Handa <handa@m17n.org>
parents: 29501
diff changeset
1383 elt = FONTSET_REF (Vdefault_fontset, XINT (character));
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1384 if (!CONSP (elt))
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1385 return;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1386 last = XCAR (arg);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1387 last_char = XCAR (XCAR (last));
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1388 last_elt = XCAR (XCDR (XCAR (last)));
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1389 elt = XCDR (elt);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1390 if (!NILP (Fequal (elt, last_elt)))
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1391 {
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1392 int this_charset = CHAR_CHARSET (XINT (character));
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1393
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1394 if (CONSP (last_char)) /* LAST_CHAR == (FROM . TO) */
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1395 {
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1396 if (this_charset == CHAR_CHARSET (XINT (XCAR (last_char))))
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1397 {
39973
579177964efa Avoid (most) uses of XCAR/XCDR as lvalues, for flexibility in experimenting
Ken Raeburn <raeburn@raeburn.org>
parents: 37744
diff changeset
1398 XSETCDR (last_char, character);
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1399 return;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1400 }
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1401 }
29767
c8e5453dc85d (FONTSET_ASCII): Use the first element of char table
Kenichi Handa <handa@m17n.org>
parents: 29501
diff changeset
1402 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
1403 return;
c8e5453dc85d (FONTSET_ASCII): Use the first element of char table
Kenichi Handa <handa@m17n.org>
parents: 29501
diff changeset
1404 else if (this_charset == CHAR_CHARSET (XINT (last_char)))
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1405 {
39973
579177964efa Avoid (most) uses of XCAR/XCDR as lvalues, for flexibility in experimenting
Ken Raeburn <raeburn@raeburn.org>
parents: 37744
diff changeset
1406 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
1407 return;
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1408 }
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1409 }
39973
579177964efa Avoid (most) uses of XCAR/XCDR as lvalues, for flexibility in experimenting
Ken Raeburn <raeburn@raeburn.org>
parents: 37744
diff changeset
1410 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
1411 XSETCAR (arg, XCDR (last));
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1412 }
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1413
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1414
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1415 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
1416 doc: /* Return information about a fontset named NAME on frame FRAME.
88155
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1417 If NAME is nil, return information about the default fontset.
41001
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1418 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
1419 [ 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
1420 where,
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1421 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
1422 HEIGHT is the maximum bound height 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
1423 CHARSET-OR-RANGE is a charset, a character (may be a generic character)
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1424 or a cons of two characters specifying the range of characters.
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1425 FONT-SPEC is a fontname pattern string or a cons (FAMILY . REGISTRY),
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1426 where FAMILY is a `FAMILY' field of a XLFD font name,
41987
34952771ae85 Fix typos, remove unnecessary space.
Pavel Janík <Pavel@Janik.cz>
parents: 41052
diff changeset
1427 REGISTRY is a `CHARSET_REGISTRY' field of a XLFD font name.
34952771ae85 Fix typos, remove unnecessary space.
Pavel Janík <Pavel@Janik.cz>
parents: 41052
diff changeset
1428 FAMILY may contain a `FOUNDRY' field at the head.
41001
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1429 REGISTRY may contain a `CHARSET_ENCODING' field at the tail.
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1430 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
1431 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
1432 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
1433 (name, frame)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1434 Lisp_Object name, frame;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1435 {
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1436 Lisp_Object fontset;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1437 FRAME_PTR f;
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1438 Lisp_Object indices[3];
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1439 Lisp_Object val, tail, elt;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1440 Lisp_Object *realized;
30124
26076259e03f (Ffontset_info): Make the return value more compatible
Kenichi Handa <handa@m17n.org>
parents: 29767
diff changeset
1441 struct font_info *fontp = NULL;
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1442 int n_realized = 0;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1443 int i;
41987
34952771ae85 Fix typos, remove unnecessary space.
Pavel Janík <Pavel@Janik.cz>
parents: 41052
diff changeset
1444
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1445 (*check_window_system_func) ();
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1446
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1447 fontset = check_fontset_name (name);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1448
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1449 if (NILP (frame))
25668
99290b59352d (Ffont_info): Change for Lisp_Object selected_frame.
Gerd Moellmann <gerd@gnu.org>
parents: 24611
diff changeset
1450 frame = selected_frame;
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40028
diff changeset
1451 CHECK_LIVE_FRAME (frame);
25668
99290b59352d (Ffont_info): Change for Lisp_Object selected_frame.
Gerd Moellmann <gerd@gnu.org>
parents: 24611
diff changeset
1452 f = XFRAME (frame);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1453
29767
c8e5453dc85d (FONTSET_ASCII): Use the first element of char table
Kenichi Handa <handa@m17n.org>
parents: 29501
diff changeset
1454 /* Recode realized fontsets whose base is FONTSET in the table
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1455 `realized'. */
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1456 realized = (Lisp_Object *) alloca (sizeof (Lisp_Object)
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1457 * ASIZE (Vfontset_table));
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1458 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
1459 {
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1460 elt = FONTSET_FROM_ID (i);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1461 if (!NILP (elt)
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1462 && EQ (FONTSET_BASE (elt), fontset))
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1463 realized[n_realized++] = elt;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1464 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1465
88155
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1466 if (! EQ (fontset, Vdefault_fontset))
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1467 {
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1468 /* Merge FONTSET onto the default fontset. */
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1469 val = Fcopy_sequence (Vdefault_fontset);
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1470 map_char_table (override_font_info, Qnil, fontset, fontset, val, 0, indices);
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1471 fontset = val;
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1472 }
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1473
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1474 /* Accumulate information of the fontset in VAL. The format is
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1475 (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
1476 FONT-SPEC). See the comment for accumulate_font_info for the
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1477 detail. */
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1478 val = Fcons (Fcons (make_number (0),
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1479 Fcons (XCDR (FONTSET_ASCII (fontset)), Qnil)),
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1480 Qnil);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1481 val = Fcons (val, val);
88155
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1482 map_char_table (accumulate_font_info, Qnil, fontset, fontset, val, 0, indices);
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1483 val = XCDR (val);
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1484
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1485 /* For each FONT-INFO, if CHAR_OR_RANGE (car part) is a generic
29767
c8e5453dc85d (FONTSET_ASCII): Use the first element of char table
Kenichi Handa <handa@m17n.org>
parents: 29501
diff changeset
1486 character for a charset, replace it with the charset symbol. If
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1487 fonts are opened for FONT-SPEC, append the names of the fonts to
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1488 FONT-SPEC. */
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1489 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
1490 {
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1491 int c;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1492 elt = XCAR (tail);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1493 if (INTEGERP (XCAR (elt)))
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1494 {
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1495 int charset, c1, c2;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1496 c = XINT (XCAR (elt));
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1497 SPLIT_CHAR (c, charset, c1, c2);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1498 if (c1 == 0)
39973
579177964efa Avoid (most) uses of XCAR/XCDR as lvalues, for flexibility in experimenting
Ken Raeburn <raeburn@raeburn.org>
parents: 37744
diff changeset
1499 XSETCAR (elt, CHARSET_SYMBOL (charset));
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1500 }
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1501 else
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1502 c = XINT (XCAR (XCAR (elt)));
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1503 for (i = 0; i < n_realized; i++)
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1504 {
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1505 Lisp_Object face_id, font;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1506 struct face *face;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1507
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1508 face_id = FONTSET_REF_VIA_BASE (realized[i], c);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1509 if (INTEGERP (face_id))
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1510 {
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1511 face = FACE_FROM_ID (f, XINT (face_id));
37744
7893c43d43c2 (Ffontset_info): Check that face is non-null
Gerd Moellmann <gerd@gnu.org>
parents: 36759
diff changeset
1512 if (face && face->font && face->font_name)
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1513 {
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1514 font = build_string (face->font_name);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1515 if (NILP (Fmember (font, XCDR (XCDR (elt)))))
39973
579177964efa Avoid (most) uses of XCAR/XCDR as lvalues, for flexibility in experimenting
Ken Raeburn <raeburn@raeburn.org>
parents: 37744
diff changeset
1516 XSETCDR (XCDR (elt), Fcons (font, XCDR (XCDR (elt))));
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1517 }
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1518 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1519 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1520 }
30124
26076259e03f (Ffontset_info): Make the return value more compatible
Kenichi Handa <handa@m17n.org>
parents: 29767
diff changeset
1521
26076259e03f (Ffontset_info): Make the return value more compatible
Kenichi Handa <handa@m17n.org>
parents: 29767
diff changeset
1522 elt = Fcdr (Fcdr (Fassq (CHARSET_SYMBOL (CHARSET_ASCII), val)));
26076259e03f (Ffontset_info): Make the return value more compatible
Kenichi Handa <handa@m17n.org>
parents: 29767
diff changeset
1523 if (CONSP (elt))
26076259e03f (Ffontset_info): Make the return value more compatible
Kenichi Handa <handa@m17n.org>
parents: 29767
diff changeset
1524 {
26076259e03f (Ffontset_info): Make the return value more compatible
Kenichi Handa <handa@m17n.org>
parents: 29767
diff changeset
1525 elt = XCAR (elt);
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 45848
diff changeset
1526 fontp = (*query_font_func) (f, SDATA (elt));
30124
26076259e03f (Ffontset_info): Make the return value more compatible
Kenichi Handa <handa@m17n.org>
parents: 29767
diff changeset
1527 }
26076259e03f (Ffontset_info): Make the return value more compatible
Kenichi Handa <handa@m17n.org>
parents: 29767
diff changeset
1528 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
1529 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
1530 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
1531 return val;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1532 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1533
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1534 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
1535 doc: /* Return a font name pattern for character CH in fontset NAME.
88155
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1536 If NAME is nil, find a font name pattern in the default fontset. */)
41001
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1537 (name, ch)
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1538 Lisp_Object name, ch;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1539 {
34975
0d69e2d2724e (fontset_ref): Remove unused variable `i'.
Eli Zaretskii <eliz@gnu.org>
parents: 32978
diff changeset
1540 int c;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1541 Lisp_Object fontset, elt;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1542
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1543 fontset = check_fontset_name (name);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1544
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40028
diff changeset
1545 CHECK_NUMBER (ch);
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1546 c = XINT (ch);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1547 if (!char_valid_p (c, 1))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1548 invalid_character (c);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1549
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1550 elt = FONTSET_REF (fontset, c);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1551 if (CONSP (elt))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1552 elt = XCDR (elt);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1553
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1554 return elt;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1555 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1556
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1557 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
1558 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
1559 ()
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1560 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1561 Lisp_Object fontset, list;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1562 int i;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1563
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1564 list = Qnil;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1565 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
1566 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1567 fontset = FONTSET_FROM_ID (i);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1568 if (!NILP (fontset)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1569 && BASE_FONTSET_P (fontset))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1570 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
1571 }
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1572
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1573 return list;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1574 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1575
88155
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1576 DEFUN ("set-overriding-fontspec-internal", Fset_overriding_fontspec_internal,
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1577 Sset_overriding_fontspec_internal, 1, 1, 0,
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1578 doc: /* Internal use only.
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1579
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1580 FONTLIST is an alist of TARGET vs FONTNAME, where TARGET is a charset
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1581 or a char-table, FONTNAME have the same meanings as in
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1582 `set-fontset-font'.
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1583
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1584 It overrides the font specifications for each TARGET in the default
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1585 fontset by the corresponding FONTNAME.
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1586
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1587 If TARGET is a charset, targets are all characters in the charset. If
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1588 TARGET is a char-table, targets are characters whose value is non-nil
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1589 in the table.
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1590
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1591 It is intended that this function is called only from
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1592 `set-language-environment'. */)
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1593 (fontlist)
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1594 Lisp_Object fontlist;
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1595 {
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1596 Lisp_Object tail;
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1597
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1598 fontlist = Fcopy_sequence (fontlist);
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1599 /* Now FONTLIST is ((TARGET . FONTNAME) ...). Reform it to ((TARGET
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1600 nil nil nil FONTSPEC) ...), where TARGET is a charset-id or a
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1601 char-table. */
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1602 for (tail = fontlist; CONSP (tail); tail = XCDR (tail))
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1603 {
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1604 Lisp_Object elt, target;
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1605
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1606 elt = XCAR (tail);
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1607 target = Fcar (elt);
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1608 elt = Fcons (Qnil, regularize_fontname (Fcdr (elt)));
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1609 if (! CHAR_TABLE_P (target))
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1610 {
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1611 int charset, c;
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1612
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1613 CHECK_SYMBOL (target);
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1614 charset = get_charset_id (target);
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1615 if (charset < 0)
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1616 error ("Invalid charset %s", SDATA (SYMBOL_NAME (target)));
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1617 target = make_number (charset);
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1618 c = MAKE_CHAR (charset, 0, 0);
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1619 XSETCAR (elt, make_number (c));
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1620 }
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1621 elt = Fcons (target, Fcons (Qnil, Fcons (Qnil, elt)));
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1622 XSETCAR (tail, elt);
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1623 }
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1624 Voverriding_fontspec_alist = fontlist;
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1625 clear_face_cache (0);
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1626 ++windows_or_buffers_changed;
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1627 return Qnil;
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1628 }
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1629
21514
fa9ff387d260 Fix -Wimplicit warnings.
Andreas Schwab <schwab@suse.de>
parents: 21127
diff changeset
1630 void
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1631 syms_of_fontset ()
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1632 {
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1633 if (!load_font_func)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1634 /* Window system initializer should have set proper functions. */
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1635 abort ();
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1636
17112
5c48ff325655 (syms_of_fontset): Intern Qfontset. Declare new lisp
Kenichi Handa <handa@m17n.org>
parents: 17071
diff changeset
1637 Qfontset = intern ("fontset");
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1638 staticpro (&Qfontset);
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1639 Fput (Qfontset, Qchar_table_extra_slots, make_number (3));
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1640
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1641 Vcached_fontset_data = Qnil;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1642 staticpro (&Vcached_fontset_data);
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1643
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1644 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
1645 staticpro (&Vfontset_table);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1646
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1647 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
1648 staticpro (&Vdefault_fontset);
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1649 FONTSET_ID (Vdefault_fontset) = make_number (0);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1650 FONTSET_NAME (Vdefault_fontset)
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1651 = build_string ("-*-*-*-*-*-*-*-*-*-*-*-*-fontset-default");
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1652 AREF (Vfontset_table, 0) = Vdefault_fontset;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1653 next_fontset_id = 1;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1654
88155
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1655 Voverriding_fontspec_alist = Qnil;
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1656 staticpro (&Voverriding_fontspec_alist);
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1657
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1658 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
1659 doc: /* Alist of fontname patterns vs corresponding encoding info.
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1660 Each element looks like (REGEXP . ENCODING-INFO),
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1661 where ENCODING-INFO is an alist of CHARSET vs ENCODING.
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1662 ENCODING is one of the following integer values:
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1663 0: code points 0x20..0x7F or 0x2020..0x7F7F are used,
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1664 1: code points 0xA0..0xFF or 0xA0A0..0xFFFF are used,
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1665 2: code points 0x20A0..0x7FFF are used,
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1666 3: code points 0xA020..0xFF7F are used. */);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1667 Vfont_encoding_alist = Qnil;
49286
fc85fba774da (syms_of_fontset): Setup Vfont_encoding_alist here.
Kenichi Handa <handa@m17n.org>
parents: 47277
diff changeset
1668 Vfont_encoding_alist
fc85fba774da (syms_of_fontset): Setup Vfont_encoding_alist here.
Kenichi Handa <handa@m17n.org>
parents: 47277
diff changeset
1669 = Fcons (Fcons (build_string ("JISX0201"),
fc85fba774da (syms_of_fontset): Setup Vfont_encoding_alist here.
Kenichi Handa <handa@m17n.org>
parents: 47277
diff changeset
1670 Fcons (Fcons (intern ("latin-jisx0201"), make_number (0)),
fc85fba774da (syms_of_fontset): Setup Vfont_encoding_alist here.
Kenichi Handa <handa@m17n.org>
parents: 47277
diff changeset
1671 Qnil)),
fc85fba774da (syms_of_fontset): Setup Vfont_encoding_alist here.
Kenichi Handa <handa@m17n.org>
parents: 47277
diff changeset
1672 Vfont_encoding_alist);
fc85fba774da (syms_of_fontset): Setup Vfont_encoding_alist here.
Kenichi Handa <handa@m17n.org>
parents: 47277
diff changeset
1673 Vfont_encoding_alist
fc85fba774da (syms_of_fontset): Setup Vfont_encoding_alist here.
Kenichi Handa <handa@m17n.org>
parents: 47277
diff changeset
1674 = Fcons (Fcons (build_string ("ISO8859-1"),
fc85fba774da (syms_of_fontset): Setup Vfont_encoding_alist here.
Kenichi Handa <handa@m17n.org>
parents: 47277
diff changeset
1675 Fcons (Fcons (intern ("ascii"), make_number (0)),
fc85fba774da (syms_of_fontset): Setup Vfont_encoding_alist here.
Kenichi Handa <handa@m17n.org>
parents: 47277
diff changeset
1676 Qnil)),
fc85fba774da (syms_of_fontset): Setup Vfont_encoding_alist here.
Kenichi Handa <handa@m17n.org>
parents: 47277
diff changeset
1677 Vfont_encoding_alist);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1678
17112
5c48ff325655 (syms_of_fontset): Intern Qfontset. Declare new lisp
Kenichi Handa <handa@m17n.org>
parents: 17071
diff changeset
1679 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
1680 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
1681 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
1682 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
1683
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1684 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
1685 such a character is displayed on screen. */);
19282
09a1536debb4 (Vignore_relative_composition): New variable.
Kenichi Handa <handa@m17n.org>
parents: 19172
diff changeset
1686 Vuse_default_ascent = Qnil;
09a1536debb4 (Vignore_relative_composition): New variable.
Kenichi Handa <handa@m17n.org>
parents: 19172
diff changeset
1687
09a1536debb4 (Vignore_relative_composition): New variable.
Kenichi Handa <handa@m17n.org>
parents: 19172
diff changeset
1688 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
1689 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
1690 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
1691 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
1692 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
1693 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
1694 Vignore_relative_composition = Qnil;
17112
5c48ff325655 (syms_of_fontset): Intern Qfontset. Declare new lisp
Kenichi Handa <handa@m17n.org>
parents: 17071
diff changeset
1695
19450
895dc2520755 (Valternate_fontname_alist): Name changed from
Kenichi Handa <handa@m17n.org>
parents: 19282
diff changeset
1696 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
1697 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
1698 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
1699 alternate fontnames (if any) are tried instead. */);
19450
895dc2520755 (Valternate_fontname_alist): Name changed from
Kenichi Handa <handa@m17n.org>
parents: 19282
diff changeset
1700 Valternate_fontname_alist = Qnil;
17193
dc4562b0152a (Valternative_fontname_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17190
diff changeset
1701
17730
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
1702 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
1703 doc: /* Alist of fontset names vs the aliases. */);
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1704 Vfontset_alias_alist = Fcons (Fcons (FONTSET_NAME (Vdefault_fontset),
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1705 build_string ("fontset-default")),
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1706 Qnil);
17730
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
1707
26858
7cc081b4e084 (Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents: 26164
diff changeset
1708 DEFVAR_LISP ("vertical-centering-font-regexp",
7cc081b4e084 (Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents: 26164
diff changeset
1709 &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
1710 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
1711 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
1712 at the vertical center of lines. */);
26858
7cc081b4e084 (Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents: 26164
diff changeset
1713 Vvertical_centering_font_regexp = Qnil;
7cc081b4e084 (Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents: 26164
diff changeset
1714
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1715 defsubr (&Squery_fontset);
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1716 defsubr (&Snew_fontset);
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1717 defsubr (&Sset_fontset_font);
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1718 defsubr (&Sfont_info);
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1719 defsubr (&Sinternal_char_font);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1720 defsubr (&Sfontset_info);
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1721 defsubr (&Sfontset_font);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1722 defsubr (&Sfontset_list);
88155
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1723 defsubr (&Sset_overriding_fontspec_internal);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1724 }
88155
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1725
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1726 /* arch-tag: ea861585-2f5f-4e5b-9849-d04a9c3a3537
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49286
diff changeset
1727 (do not change this comment) */