annotate src/fontset.c @ 29515:e89a3b5d7c13

(handle_fontified_prop): Don't GCPRO local var `pos'; it's an integer.
author Gerd Moellmann <gerd@gnu.org>
date Thu, 08 Jun 2000 20:58:15 +0000
parents f901ec87b147
children c8e5453dc85d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1 /* Fontset handler.
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
2 Copyright (C) 1995, 1997, 2000 Electrotechnical Laboratory, JAPAN.
18341
33e78cc7f058 Change copyright notices.
Richard M. Stallman <rms@gnu.org>
parents: 18192
diff changeset
3 Licensed to the Free Software Foundation.
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
4
17071
70194012fb3a Fix FSF address in comment.
Karl Heuer <kwzh@gnu.org>
parents: 17052
diff changeset
5 This file is part of GNU Emacs.
70194012fb3a Fix FSF address in comment.
Karl Heuer <kwzh@gnu.org>
parents: 17052
diff changeset
6
70194012fb3a Fix FSF address in comment.
Karl Heuer <kwzh@gnu.org>
parents: 17052
diff changeset
7 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
8 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
9 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
10 any later version.
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
11
17071
70194012fb3a Fix FSF address in comment.
Karl Heuer <kwzh@gnu.org>
parents: 17052
diff changeset
12 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
13 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
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
70194012fb3a Fix FSF address in comment.
Karl Heuer <kwzh@gnu.org>
parents: 17052
diff changeset
15 GNU General Public License for more details.
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
16
17071
70194012fb3a Fix FSF address in comment.
Karl Heuer <kwzh@gnu.org>
parents: 17052
diff changeset
17 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
18 along with GNU Emacs; see the file COPYING. If not, write to
70194012fb3a Fix FSF address in comment.
Karl Heuer <kwzh@gnu.org>
parents: 17052
diff changeset
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
70194012fb3a Fix FSF address in comment.
Karl Heuer <kwzh@gnu.org>
parents: 17052
diff changeset
20 Boston, MA 02111-1307, USA. */
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
21
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
22 /* #define FONTSET_DEBUG */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
23
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
24 #include <config.h>
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
25
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
26 #ifdef FONTSET_DEBUG
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
27 #include <stdio.h>
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
28 #endif
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
29
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
30 #include "lisp.h"
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
31 #include "buffer.h"
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
32 #include "charset.h"
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
33 #include "ccl.h"
23517
73f09e7bc96e Include frame.h before fontset.h.
Kenichi Handa <handa@m17n.org>
parents: 22719
diff changeset
34 #include "frame.h"
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
35 #include "dispextern.h"
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
36 #include "fontset.h"
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
37 #include "window.h"
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
38
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
39 #ifdef FONTSET_DEBUG
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
40 #undef xassert
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
41 #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
42 #undef INLINE
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
43 #define INLINE
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
44 #endif
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
45
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
46
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
47 /* FONTSET
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
48
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
49 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
50 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
51 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
52 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
53 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
54 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
55 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
56 share the same realized fontset.
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
57
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
58 A fontset 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
59
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
60 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
61 (INDEX . FONTNAME) or
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
62 (INDEX . (FOUNDRY . REGISTRY ))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
63 FONTNAME is a font name pattern for the corresponding character.
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
64 FOUNDRY and REGISTRY are respectively foundy and regisry fields of
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
65 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
66 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
67 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
68 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
69 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
70 charset. REGISTRY is the
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 realized fontset is FACE-ID which is a face to use
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
73 for displaying the correspnding character.
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
74
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
75 All single byte charaters (ASCII and 8bit-unibyte) share the same
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
76 element in a fontset. The element is stored in `defalt' slot of
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
77 the fontset. And this slot is never used as a default value of
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
78 multibyte characters. That means that the first 256 elements of a
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
79 fontset are always nil (as this is not efficient, we may implement
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
80 a fontset in a different way in the future).
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
81
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
82 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
83 FONTSET_SET respectively for efficiency.
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
84
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
85 A fontset has 3 extra slots.
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
86
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
87 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
88
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
89 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
90 face.
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
91
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
92 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
93 for a default face.
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
94
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
95 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
96 is a base 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 All fontsets (except for the default fontset described below) are
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
99 recorded in Vfontset_table.
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
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
102 DEFAULT FONTSET
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 There's a special fontset named `default fontset' which defines a
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
105 default fontname that contains only REGISTRY field for each
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
106 character. When a base fontset doesn't specify a font for a
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
107 specific character, the corresponding value in the default fontset
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
108 is used. The format is the same as a base fontset.
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 The parent of realized fontsets created for faces that have no
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
111 fontset is the default fontset.
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
112
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
113
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
114 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
115 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
116 usually use variable name `fontset' for IDs. But, in this file, we
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
117 always use varialbe name `id' for IDs, and name `fontset' for the
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
118 actual fontset objects.
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
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
122 /********** VARIABLES and FUNCTION PROTOTYPES **********/
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
123
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
124 extern Lisp_Object Qfont;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
125 Lisp_Object Qfontset;
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 /* Vector containing all fontsets. */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
128 static Lisp_Object Vfontset_table;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
129
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
130 /* Next possibly free fontset ID. Usually this keeps the mininum
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
131 fontset ID not yet used. */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
132 static int next_fontset_id;
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 /* 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
135 font for each characters. */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
136 static Lisp_Object Vdefault_fontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
137
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
138 Lisp_Object Vfont_encoding_alist;
17112
5c48ff325655 (syms_of_fontset): Intern Qfontset. Declare new lisp
Kenichi Handa <handa@m17n.org>
parents: 17071
diff changeset
139 Lisp_Object Vuse_default_ascent;
19282
09a1536debb4 (Vignore_relative_composition): New variable.
Kenichi Handa <handa@m17n.org>
parents: 19172
diff changeset
140 Lisp_Object Vignore_relative_composition;
19450
895dc2520755 (Valternate_fontname_alist): Name changed from
Kenichi Handa <handa@m17n.org>
parents: 19282
diff changeset
141 Lisp_Object Valternate_fontname_alist;
17730
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
142 Lisp_Object Vfontset_alias_alist;
17331
f91b4d582897 (Vhighlight_wrong_size_font, Vclip_large_size_font):
Kenichi Handa <handa@m17n.org>
parents: 17193
diff changeset
143 Lisp_Object Vhighlight_wrong_size_font;
f91b4d582897 (Vhighlight_wrong_size_font, Vclip_large_size_font):
Kenichi Handa <handa@m17n.org>
parents: 17193
diff changeset
144 Lisp_Object Vclip_large_size_font;
26858
7cc081b4e084 (Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents: 26164
diff changeset
145 Lisp_Object Vvertical_centering_font_regexp;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
146
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
147 /* The following six are declarations of callback functions depending
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
148 on window system. See the comments in src/fontset.h for more
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
149 detail. */
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
150
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
151 /* Return a pointer to struct font_info of font FONT_IDX of frame F. */
20315
931b4ddf7966 Protoize functions declarations.
Andreas Schwab <schwab@suse.de>
parents: 19450
diff changeset
152 struct font_info *(*get_font_info_func) P_ ((FRAME_PTR f, int font_idx));
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
153
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
154 /* Return a list of font names which matches PATTERN. See the document of
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
155 `x-list-fonts' for more detail. */
23517
73f09e7bc96e Include frame.h before fontset.h.
Kenichi Handa <handa@m17n.org>
parents: 22719
diff changeset
156 Lisp_Object (*list_fonts_func) P_ ((struct frame *f,
73f09e7bc96e Include frame.h before fontset.h.
Kenichi Handa <handa@m17n.org>
parents: 22719
diff changeset
157 Lisp_Object pattern,
73f09e7bc96e Include frame.h before fontset.h.
Kenichi Handa <handa@m17n.org>
parents: 22719
diff changeset
158 int size,
73f09e7bc96e Include frame.h before fontset.h.
Kenichi Handa <handa@m17n.org>
parents: 22719
diff changeset
159 int maxnames));
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
160
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
161 /* Load a font named NAME for frame F and return a pointer to the
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
162 information of the loaded font. If loading is failed, return 0. */
20315
931b4ddf7966 Protoize functions declarations.
Andreas Schwab <schwab@suse.de>
parents: 19450
diff changeset
163 struct font_info *(*load_font_func) P_ ((FRAME_PTR f, char *name, int));
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
164
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
165 /* Return a pointer to struct font_info of a font named NAME for frame F. */
20315
931b4ddf7966 Protoize functions declarations.
Andreas Schwab <schwab@suse.de>
parents: 19450
diff changeset
166 struct font_info *(*query_font_func) P_ ((FRAME_PTR f, char *name));
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
167
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
168 /* Additional function for setting fontset or changing fontset
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
169 contents of frame F. */
20315
931b4ddf7966 Protoize functions declarations.
Andreas Schwab <schwab@suse.de>
parents: 19450
diff changeset
170 void (*set_frame_fontset_func) P_ ((FRAME_PTR f, Lisp_Object arg,
931b4ddf7966 Protoize functions declarations.
Andreas Schwab <schwab@suse.de>
parents: 19450
diff changeset
171 Lisp_Object oldval));
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
172
21553
2d7afcd11b72 (find_ccl_program_func): New variable.
Kenichi Handa <handa@m17n.org>
parents: 21514
diff changeset
173 /* To find a CCL program, fs_load_font calls this function.
2d7afcd11b72 (find_ccl_program_func): New variable.
Kenichi Handa <handa@m17n.org>
parents: 21514
diff changeset
174 The argument is a pointer to the struct font_info.
2d7afcd11b72 (find_ccl_program_func): New variable.
Kenichi Handa <handa@m17n.org>
parents: 21514
diff changeset
175 This function set the memer `encoder' of the structure. */
2d7afcd11b72 (find_ccl_program_func): New variable.
Kenichi Handa <handa@m17n.org>
parents: 21514
diff changeset
176 void (*find_ccl_program_func) P_ ((struct font_info *));
2d7afcd11b72 (find_ccl_program_func): New variable.
Kenichi Handa <handa@m17n.org>
parents: 21514
diff changeset
177
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
178 /* Check if any window system is used now. */
20315
931b4ddf7966 Protoize functions declarations.
Andreas Schwab <schwab@suse.de>
parents: 19450
diff changeset
179 void (*check_window_system_func) P_ ((void));
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
180
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
181
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
182 /* Prototype declarations for static functions. */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
183 static Lisp_Object fontset_ref P_ ((Lisp_Object, int));
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
184 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
185 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
186 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
187 static Lisp_Object fontset_pattern_regexp P_ ((Lisp_Object));
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
188 static Lisp_Object font_family_registry P_ ((Lisp_Object));
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
189
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
190
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
191 /********** 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
192
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
193 /* Macros for Lisp vector. */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
194 #define AREF(V, IDX) XVECTOR (V)->contents[IDX]
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
195 #define ASIZE(V) XVECTOR (V)->size
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
196
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
197 /* 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
198 #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
199
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
200 /* Macros to access extra, default, and parent slots, of fontset. */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
201 #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
202 #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
203 #define FONTSET_FRAME(fontset) XCHAR_TABLE (fontset)->extras[2]
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
204 #define FONTSET_ASCII(fontset) XCHAR_TABLE (fontset)->defalt
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
205 #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
206
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
207 #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
208
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
209
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
210 /* Return the element of FONTSET (char-table) at index C (character). */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
211
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
212 #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
213
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
214 static INLINE Lisp_Object
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
215 fontset_ref (fontset, c)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
216 Lisp_Object fontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
217 int c;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
218 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
219 int charset, c1, c2;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
220 Lisp_Object elt, defalt;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
221 int i;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
222
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
223 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
224 return FONTSET_ASCII (fontset);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
225
29011
b60861d6c1e0 (fontset_ref): Use SPLIT_CHAR instead of
Kenichi Handa <handa@m17n.org>
parents: 28971
diff changeset
226 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
227 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
228 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
229 return elt;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
230 defalt = XCHAR_TABLE (elt)->defalt;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
231 if (c1 < 32
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
232 || (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
233 NILP (elt)))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
234 return defalt;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
235 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
236 return elt;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
237 defalt = XCHAR_TABLE (elt)->defalt;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
238 if (c2 < 32
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
239 || (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
240 NILP (elt)))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
241 return defalt;
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 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
244
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
245
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
246 #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
247
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
248 static INLINE Lisp_Object
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
249 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
250 Lisp_Object fontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
251 int *c;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
252 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
253 int charset, c1, c2;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
254 Lisp_Object elt;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
255
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
256 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
257 return FONTSET_ASCII (fontset);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
258
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
259 elt = FONTSET_REF (FONTSET_BASE (fontset), *c);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
260 if (NILP (elt))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
261 return Qnil;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
262
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
263 *c = XINT (XCAR (elt));
29011
b60861d6c1e0 (fontset_ref): Use SPLIT_CHAR instead of
Kenichi Handa <handa@m17n.org>
parents: 28971
diff changeset
264 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
265 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
266 if (c1 < 32)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
267 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
268 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
269 return Qnil;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
270 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
271 if (c2 < 32)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
272 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
273 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
274 return Qnil;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
275 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
276 return elt;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
277 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
278
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
279
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
280 /* Store into the element of FONTSET at index C the value NEWETL. */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
281 #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
282
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
283 static void
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
284 fontset_set (fontset, c, newelt)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
285 Lisp_Object fontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
286 int c;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
287 Lisp_Object newelt;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
288 {
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
289 int charset, code[3];
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
290 Lisp_Object *elt, tmp;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
291 int i, j;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
292
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
293 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
294 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
295 FONTSET_ASCII (fontset) = newelt;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
296 return;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
297 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
298
29011
b60861d6c1e0 (fontset_ref): Use SPLIT_CHAR instead of
Kenichi Handa <handa@m17n.org>
parents: 28971
diff changeset
299 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
300 code[2] = 0; /* anchor */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
301 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
302 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
303 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
304 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
305 *elt = make_sub_char_table (*elt);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
306 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
307 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
308 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
309 XCHAR_TABLE (*elt)->defalt = newelt;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
310 else
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
311 *elt = newelt;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
312 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
313
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 /* 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
316 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
317 BASE. */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
318
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
319 static Lisp_Object
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
320 make_fontset (frame, name, base)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
321 Lisp_Object frame, name, base;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
322 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
323 Lisp_Object fontset, elt, base_elt;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
324 int size = ASIZE (Vfontset_table);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
325 int id = next_fontset_id;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
326 int i, j;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
327
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
328 /* 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
329 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
330 terminates quickly. In addition, as the last element of
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
331 Vfotnset_table is always nil, we don't have to check the range of
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
332 id. */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
333 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
334
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
335 if (id + 1 == size)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
336 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
337 Lisp_Object tem;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
338 int i;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
339
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
340 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
341 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
342 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
343 Vfontset_table = tem;
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
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
346 if (NILP (base))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
347 fontset = Fcopy_sequence (Vdefault_fontset);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
348 else
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
349 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
350
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
351 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
352 FONTSET_NAME (fontset) = name;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
353 FONTSET_FRAME (fontset) = frame;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
354 FONTSET_BASE (fontset) = base;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
355
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
356 AREF (Vfontset_table, id) = fontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
357 next_fontset_id = id + 1;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
358 return fontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
359 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
360
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
361
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
362 /* 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
363
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
364 static INLINE int
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
365 fontset_id_valid_p (id)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
366 int id;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
367 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
368 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
369 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
370
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
371
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
372 /* Extract `family' and `registry' string from FONTNAME and set in
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
373 *FAMILY and *REGISTRY respectively. Actually, `family' may also
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
374 contain `foundry', `registry' may also contain `encoding' of
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
375 FONTNAME. */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
376
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
377 static Lisp_Object
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
378 font_family_registry (fontname)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
379 Lisp_Object fontname;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
380 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
381 Lisp_Object family, registry;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
382 char *p = XSTRING (fontname)->data;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
383 char *sep[15];
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
384 int i = 0;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
385
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
386 while (*p && i < 15) if (*p++ == '-') sep[i++] = p;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
387 if (i != 14)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
388 return fontname;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
389
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
390 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
391 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
392 return Fcons (family, registry);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
393 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
394
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
395
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
396 /********** INTERFACES TO xfaces.c and dispextern.h **********/
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
397
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
398 /* 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
399
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
400 Lisp_Object
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
401 fontset_name (id)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
402 int id;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
403 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
404 Lisp_Object fontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
405 fontset = FONTSET_FROM_ID (id);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
406 return FONTSET_NAME (fontset);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
407 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
408
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
409
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
410 /* 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
411
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
412 Lisp_Object
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
413 fontset_ascii (id)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
414 int id;
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 Lisp_Object fontset, elt;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
417 fontset= FONTSET_FROM_ID (id);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
418 elt = FONTSET_ASCII (fontset);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
419 return XCDR (elt);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
420 }
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 /* 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
424
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
425 void
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
426 free_face_fontset (f, face)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
427 FRAME_PTR f;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
428 struct face *face;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
429 {
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
430 if (fontset_id_valid_p (face->fontset))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
431 {
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
432 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
433 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
434 next_fontset_id = face->fontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
435 }
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
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
438
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
439 /* 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
440 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
441 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
442
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
443 int
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
444 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
445 struct face *face;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
446 int c;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
447 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
448 Lisp_Object fontset, elt;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
449
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
450 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
451 return (face == face->ascii_face);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
452
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
453 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
454 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
455 xassert (!BASE_FONTSET_P (fontset));
17052
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 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
458 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
459 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
460
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 /* 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
463 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
464 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
465 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
466
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
467 int
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
468 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
469 FRAME_PTR f;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
470 struct face *face;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
471 int c;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
472 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
473 Lisp_Object fontset, elt;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
474 int face_id;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
475
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
476 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
477 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
478 xassert (!BASE_FONTSET_P (fontset));
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
479
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
480 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
481 if (!NILP (elt))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
482 return XINT (elt);
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 /* 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
485 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
486 face_id = lookup_face (f, face->lface, c, face);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
487
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
488 /* 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
489 information in the base fontset. */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
490 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
491 return face_id;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
492 }
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
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
495 /* 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
496 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
497 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
498 Called from realize_x_face. */
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 int
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
501 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
502 FRAME_PTR f;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
503 int base_fontset_id;
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 Lisp_Object base_fontset, fontset, name, frame;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
506
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
507 XSETFRAME (frame, f);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
508 if (base_fontset_id >= 0)
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 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
511 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
512 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
513 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
514 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
515 else
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
516 base_fontset = Vdefault_fontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
517
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
518 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
519 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
520 }
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 /* Return the font name pattern for C that is recorded in the fontset
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
524 with ID. A font is opened by that pattern to get the fullname. If
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
525 the fullname conform to XLFD, extract foundry-family field and
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
526 registry-encoding field, and return the cons of them. Otherwise
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
527 return the fullname. If ID is -1, or the fontset doesn't contain
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
528 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
529 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
530
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
531 Lisp_Object
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
532 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
533 FRAME_PTR f;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
534 int id, c;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
535 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
536 Lisp_Object fontset, elt;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
537 struct font_info *fontp;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
538 Lisp_Object family_registry;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
539
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
540 elt = Qnil;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
541 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
542 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
543 fontset = FONTSET_FROM_ID (id);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
544 xassert (!BASE_FONTSET_P (fontset));
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
545 fontset = FONTSET_BASE (fontset);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
546 elt = FONTSET_REF (fontset, c);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
547 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
548 else
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
549 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
550
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
551 if (!CONSP (elt))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
552 return Qnil;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
553 if (CONSP (XCDR (elt)))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
554 return XCDR (elt);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
555
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
556 /* The fontset specifies only a font name pattern (not cons of
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
557 family and registry). Try to open a font by that pattern and get
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
558 a registry from the full name of the opened font. We ignore
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
559 family name here because it should be wild card in the fontset
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
560 specification. */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
561 elt = XCDR (elt);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
562 xassert (STRINGP (elt));
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
563 fontp = FS_LOAD_FONT (f, c, XSTRING (elt)->data, -1);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
564 if (!fontp)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
565 return Qnil;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
566
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
567 family_registry = font_family_registry (build_string (fontp->full_name));
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
568 if (!CONSP (family_registry))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
569 return family_registry;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
570 XCAR (family_registry) = Qnil;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
571 return family_registry;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
572 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
573
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
574
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
575 /* 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
576 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
577 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
578 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
579 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
580 specified by ID. */
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
581
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
582 struct font_info *
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
583 fs_load_font (f, c, fontname, id, face)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
584 FRAME_PTR f;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
585 int c;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
586 char *fontname;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
587 int id;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
588 struct face *face;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
589 {
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
590 Lisp_Object fontset;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
591 Lisp_Object list, elt;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
592 int font_idx;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
593 int size = 0;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
594 struct font_info *fontp;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
595 int charset = CHAR_CHARSET (c);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
596
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
597 if (face)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
598 id = face->fontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
599 if (id < 0)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
600 fontset = Qnil;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
601 else
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
602 fontset = FONTSET_FROM_ID (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 if (!NILP (fontset)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
605 && !BASE_FONTSET_P (fontset))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
606 {
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
607 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
608 if (!NILP (elt))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
609 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
610 /* 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
611 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
612 int face_id = XINT (elt);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
613
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
614 xassert (face_id == face->id);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
615 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
616 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
617 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
618
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
619 if (!fontname && charset == CHARSET_ASCII)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
620 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
621 elt = FONTSET_ASCII (fontset);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
622 fontname = XSTRING (XCDR (elt))->data;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
623 }
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
624 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
625
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
626 if (!fontname)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
627 /* No way to get fontname. */
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
628 return 0;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
629
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
630 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
631 if (!fontp)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
632 return 0;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
633
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
634 /* 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
635 font_info structure that are not set by (*load_font_func). */
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
636 fontp->charset = charset;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
637
26858
7cc081b4e084 (Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents: 26164
diff changeset
638 fontp->vertical_centering
7cc081b4e084 (Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents: 26164
diff changeset
639 = (STRINGP (Vvertical_centering_font_regexp)
7cc081b4e084 (Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents: 26164
diff changeset
640 && (fast_c_string_match_ignore_case
7cc081b4e084 (Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents: 26164
diff changeset
641 (Vvertical_centering_font_regexp, fontp->full_name) >= 0));
7cc081b4e084 (Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents: 26164
diff changeset
642
17999
5e325c8057c8 (fs_load_font): Before using a fontset, be sure to
Kenichi Handa <handa@m17n.org>
parents: 17882
diff changeset
643 if (fontp->encoding[1] != FONT_ENCODING_NOT_DECIDED)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
644 {
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
645 /* The font itself tells which code points to be used. Use this
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
646 encoding for all other charsets. */
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
647 int i;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
648
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
649 fontp->encoding[0] = fontp->encoding[1];
17190
6637001cdb4b Adjusted for the change of MAX_CHARSET.
Kenichi Handa <handa@m17n.org>
parents: 17112
diff changeset
650 for (i = MIN_CHARSET_OFFICIAL_DIMENSION1; i <= MAX_CHARSET; i++)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
651 fontp->encoding[i] = fontp->encoding[1];
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
652 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
653 else
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
654 {
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
655 /* The font itself doesn't have information about encoding. */
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
656 int i;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
657
28766
da7e00e4eaa6 (fs_load_font): By default, use 0x00..0x7f for ASCII.
Kenichi Handa <handa@m17n.org>
parents: 28676
diff changeset
658 fontname = fontp->full_name;
da7e00e4eaa6 (fs_load_font): By default, use 0x00..0x7f for ASCII.
Kenichi Handa <handa@m17n.org>
parents: 28676
diff changeset
659 /* 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
660 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
661 fontp->encoding[0] = 0;
17190
6637001cdb4b Adjusted for the change of MAX_CHARSET.
Kenichi Handa <handa@m17n.org>
parents: 17112
diff changeset
662 for (i = MIN_CHARSET_OFFICIAL_DIMENSION1; i <= MAX_CHARSET; i++)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
663 fontp->encoding[i] = 1;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
664 /* 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
665 for (list = Vfont_encoding_alist; CONSP (list); list = XCDR (list))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
666 {
26164
d39ec0a27081 more XCAR/XCDR/XFLOAT_DATA uses, to help isolete lisp engine
Ken Raeburn <raeburn@raeburn.org>
parents: 25668
diff changeset
667 elt = XCAR (list);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
668 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
669 && STRINGP (XCAR (elt)) && CONSP (XCDR (elt))
d39ec0a27081 more XCAR/XCDR/XFLOAT_DATA uses, to help isolete lisp engine
Ken Raeburn <raeburn@raeburn.org>
parents: 25668
diff changeset
670 && (fast_c_string_match_ignore_case (XCAR (elt), fontname)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
671 >= 0))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
672 {
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
673 Lisp_Object tmp;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
674
26164
d39ec0a27081 more XCAR/XCDR/XFLOAT_DATA uses, to help isolete lisp engine
Ken Raeburn <raeburn@raeburn.org>
parents: 25668
diff changeset
675 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
676 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
677 && ((i = get_charset_id (XCAR (XCAR (tmp))))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
678 >= 0)
26164
d39ec0a27081 more XCAR/XCDR/XFLOAT_DATA uses, to help isolete lisp engine
Ken Raeburn <raeburn@raeburn.org>
parents: 25668
diff changeset
679 && 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
680 && XFASTINT (XCDR (XCAR (tmp))) < 4)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
681 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
682 = XFASTINT (XCDR (XCAR (tmp)));
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
683 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
684 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
685 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
686
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
687 fontp->font_encoder = (struct ccl_program *) 0;
21553
2d7afcd11b72 (find_ccl_program_func): New variable.
Kenichi Handa <handa@m17n.org>
parents: 21514
diff changeset
688
2d7afcd11b72 (find_ccl_program_func): New variable.
Kenichi Handa <handa@m17n.org>
parents: 21514
diff changeset
689 if (find_ccl_program_func)
2d7afcd11b72 (find_ccl_program_func): New variable.
Kenichi Handa <handa@m17n.org>
parents: 21514
diff changeset
690 (*find_ccl_program_func) (fontp);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
691
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
692 /* 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
693 ID in the fontset for C. */
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
694 if (face
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
695 && !NILP (fontset)
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
696 && !BASE_FONTSET_P (fontset))
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
697 FONTSET_SET (fontset, c, make_number (face->id));
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
698 return fontp;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
699 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
700
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
701
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
702 /* Cache data used by fontset_pattern_regexp. The car part is a
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
703 pattern string containing at least one wild card, the cdr part is
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
704 the corresponding regular expression. */
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
705 static Lisp_Object Vcached_fontset_data;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
706
26164
d39ec0a27081 more XCAR/XCDR/XFLOAT_DATA uses, to help isolete lisp engine
Ken Raeburn <raeburn@raeburn.org>
parents: 25668
diff changeset
707 #define CACHED_FONTSET_NAME (XSTRING (XCAR (Vcached_fontset_data))->data)
d39ec0a27081 more XCAR/XCDR/XFLOAT_DATA uses, to help isolete lisp engine
Ken Raeburn <raeburn@raeburn.org>
parents: 25668
diff changeset
708 #define CACHED_FONTSET_REGEX (XCDR (Vcached_fontset_data))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
709
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
710 /* If fontset name PATTERN contains any wild card, return regular
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
711 expression corresponding to PATTERN. */
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
712
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
713 static Lisp_Object
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
714 fontset_pattern_regexp (pattern)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
715 Lisp_Object pattern;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
716 {
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
717 if (!index (XSTRING (pattern)->data, '*')
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
718 && !index (XSTRING (pattern)->data, '?'))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
719 /* PATTERN does not contain any wild cards. */
17730
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
720 return Qnil;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
721
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
722 if (!CONSP (Vcached_fontset_data)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
723 || strcmp (XSTRING (pattern)->data, CACHED_FONTSET_NAME))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
724 {
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
725 /* We must at first update the cached data. */
17730
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
726 char *regex = (char *) alloca (XSTRING (pattern)->size * 2);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
727 char *p0, *p1 = regex;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
728
17730
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
729 /* Convert "*" to ".*", "?" to ".". */
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
730 *p1++ = '^';
17827
95010205f916 (fontset_pattern_regexp): Cast to (char *) before
Kenichi Handa <handa@m17n.org>
parents: 17730
diff changeset
731 for (p0 = (char *) XSTRING (pattern)->data; *p0; p0++)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
732 {
17730
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
733 if (*p0 == '*')
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
734 {
17730
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
735 *p1++ = '.';
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
736 *p1++ = '*';
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
737 }
17730
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
738 else if (*p0 == '?')
21127
577865651099 (fontset_pattern_regexp): `==' was used instead of `='.
Richard M. Stallman <rms@gnu.org>
parents: 20346
diff changeset
739 *p1++ = '.';
17730
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
740 else
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
741 *p1++ = *p0;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
742 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
743 *p1++ = '$';
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
744 *p1++ = 0;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
745
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
746 Vcached_fontset_data = Fcons (build_string (XSTRING (pattern)->data),
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
747 build_string (regex));
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
748 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
749
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
750 return CACHED_FONTSET_REGEX;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
751 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
752
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
753 /* Return ID of the base fontset named NAME. If there's no such
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
754 fontset, return -1. */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
755
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
756 int
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
757 fs_query_fontset (name, regexpp)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
758 Lisp_Object name;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
759 int regexpp;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
760 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
761 Lisp_Object fontset, tem;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
762 int i;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
763
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
764 name = Fdowncase (name);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
765 if (!regexpp)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
766 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
767 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
768 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
769 name = XCAR (tem);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
770 else
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
771 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
772 tem = fontset_pattern_regexp (name);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
773 if (STRINGP (tem))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
774 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
775 name = tem;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
776 regexpp = 1;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
777 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
778 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
779 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
780
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
781 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
782 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
783 Lisp_Object fontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
784 unsigned char *this_name;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
785
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
786 fontset = FONTSET_FROM_ID (i);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
787 if (NILP (fontset)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
788 || !BASE_FONTSET_P (fontset))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
789 continue;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
790
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
791 this_name = XSTRING (FONTSET_NAME (fontset))->data;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
792 if (regexpp
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
793 ? fast_c_string_match_ignore_case (name, this_name) >= 0
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
794 : !strcmp (XSTRING (name)->data, this_name))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
795 return i;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
796 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
797 return -1;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
798 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
799
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
800
21553
2d7afcd11b72 (find_ccl_program_func): New variable.
Kenichi Handa <handa@m17n.org>
parents: 21514
diff changeset
801 DEFUN ("query-fontset", Fquery_fontset, Squery_fontset, 1, 2, 0,
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
802 "Return the name of a fontset that matches PATTERN.\n\
24585
6810d6fb639f (Fquery_fontset): Don't check for fontset aliases here.
Richard M. Stallman <rms@gnu.org>
parents: 23517
diff changeset
803 The value is nil if there is no matching fontset.\n\
6810d6fb639f (Fquery_fontset): Don't check for fontset aliases here.
Richard M. Stallman <rms@gnu.org>
parents: 23517
diff changeset
804 PATTERN can contain `*' or `?' as a wildcard\n\
6810d6fb639f (Fquery_fontset): Don't check for fontset aliases here.
Richard M. Stallman <rms@gnu.org>
parents: 23517
diff changeset
805 just as X font name matching algorithm allows.\n\
6810d6fb639f (Fquery_fontset): Don't check for fontset aliases here.
Richard M. Stallman <rms@gnu.org>
parents: 23517
diff changeset
806 If REGEXPP is non-nil, PATTERN is a regular expression.")
21553
2d7afcd11b72 (find_ccl_program_func): New variable.
Kenichi Handa <handa@m17n.org>
parents: 21514
diff changeset
807 (pattern, regexpp)
2d7afcd11b72 (find_ccl_program_func): New variable.
Kenichi Handa <handa@m17n.org>
parents: 21514
diff changeset
808 Lisp_Object pattern, regexpp;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
809 {
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
810 Lisp_Object fontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
811 int id;
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 (*check_window_system_func) ();
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
814
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
815 CHECK_STRING (pattern, 0);
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
816
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
817 if (XSTRING (pattern)->size == 0)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
818 return Qnil;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
819
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
820 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
821 if (id < 0)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
822 return Qnil;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
823
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
824 fontset = FONTSET_FROM_ID (id);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
825 return FONTSET_NAME (fontset);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
826 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
827
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
828 /* 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
829 If SIZE is not 0, it is the size (maximum bound width) of fontsets
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
830 to be listed. */
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
831
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
832 Lisp_Object
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
833 list_fontsets (f, pattern, size)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
834 FRAME_PTR f;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
835 Lisp_Object pattern;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
836 int size;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
837 {
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
838 Lisp_Object frame, regexp, val, tail;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
839 int id;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
840
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
841 XSETFRAME (frame, f);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
842
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
843 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
844 val = Qnil;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
845
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
846 for (id = 0; id < ASIZE (Vfontset_table); id++)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
847 {
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
848 Lisp_Object fontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
849 unsigned char *name;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
850
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
851 fontset = FONTSET_FROM_ID (id);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
852 if (NILP (fontset)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
853 || !BASE_FONTSET_P (fontset)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
854 || !EQ (frame, FONTSET_FRAME (fontset)))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
855 continue;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
856 name = XSTRING (FONTSET_NAME (fontset))->data;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
857
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
858 if (!NILP (regexp)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
859 ? (fast_c_string_match_ignore_case (regexp, name) < 0)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
860 : strcmp (XSTRING (pattern)->data, name))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
861 continue;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
862
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
863 if (size)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
864 {
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
865 struct font_info *fontp;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
866 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
867 if (!fontp || size != fontp->size)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
868 continue;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
869 }
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
870 val = Fcons (Fcopy_sequence (FONTSET_NAME (fontset)), val);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
871 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
872
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
873 return val;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
874 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
875
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
876 DEFUN ("new-fontset", Fnew_fontset, Snew_fontset, 2, 2, 0,
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
877 "Create a new fontset NAME that contains font information in FONTLIST.\n\
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
878 FONTLIST is an alist of charsets vs corresponding font name patterns.")
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
879 (name, fontlist)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
880 Lisp_Object name, fontlist;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
881 {
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
882 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
883 Lisp_Object tem, tail, elt;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
884
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
885 (*check_window_system_func) ();
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
886
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
887 CHECK_STRING (name, 0);
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
888 CHECK_LIST (fontlist, 1);
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
889
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
890 name = Fdowncase (name);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
891 tem = Fquery_fontset (name, Qnil);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
892 if (!NILP (tem))
24585
6810d6fb639f (Fquery_fontset): Don't check for fontset aliases here.
Richard M. Stallman <rms@gnu.org>
parents: 23517
diff changeset
893 error ("Fontset `%s' matches the existing fontset `%s'",
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
894 XSTRING (name)->data, XSTRING (tem)->data);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
895
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
896 /* 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
897 fontset elements. */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
898 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
899 for (tail = fontlist; CONSP (tail); tail = XCDR (tail))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
900 {
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
901 Lisp_Object family, registry;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
902 int c, charset;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
903
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
904 tem = XCAR (tail);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
905 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
906 || (charset = get_charset_id (XCAR (tem))) < 0
d39ec0a27081 more XCAR/XCDR/XFLOAT_DATA uses, to help isolete lisp engine
Ken Raeburn <raeburn@raeburn.org>
parents: 25668
diff changeset
907 || !STRINGP (XCDR (tem)))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
908 error ("Elements of fontlist must be a cons of charset and font name");
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
909
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
910 tem = Fdowncase (XCDR (tem));
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
911 if (charset == CHARSET_ASCII)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
912 ascii_font = tem;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
913 else
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
914 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
915 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
916 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
917 }
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
918 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
919
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
920 if (NILP (ascii_font))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
921 error ("No ASCII font in the fontlist");
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
922
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
923 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
924 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
925 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
926 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
927 elt = XCAR (elements);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
928 tem = Fcons (XCAR (elt), font_family_registry (XCDR (elt)));
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
929 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
930 }
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
931
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
932 return Qnil;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
933 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
934
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
935
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
936 /* 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
937
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
938 static void
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
939 clear_fontset_elements (fontset)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
940 Lisp_Object fontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
941 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
942 int i;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
943
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
944 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
945 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
946 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
947
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
948
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
949 /* 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
950 corresponding fontset. If not valid, signal an error.
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
951 If NAME is t, return Vdefault_fontset. */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
952
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
953 static Lisp_Object
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
954 check_fontset_name (name)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
955 Lisp_Object name;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
956 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
957 int id;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
958
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
959 if (EQ (name, Qt))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
960 return Vdefault_fontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
961
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
962 CHECK_STRING (name, 0);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
963 id = fs_query_fontset (name, 0);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
964 if (id < 0)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
965 error ("Fontset `%s' does not exist", XSTRING (name)->data);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
966 return FONTSET_FROM_ID (id);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
967 }
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
968
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
969 DEFUN ("set-fontset-font", Fset_fontset_font, Sset_fontset_font, 3, 4, 0,
28676
0a677c35ad99 (Fset_fontset_font): Fix docstring. Local variable
Kenichi Handa <handa@m17n.org>
parents: 28511
diff changeset
970 "Modify fontset NAME to use FONTNAME for CHARACTER.\n\
28241
df61a12bd266 (Fset_fontset_font, Ffontset_font): Fix newlines in doc string.
Dave Love <fx@gnu.org>
parents: 28223
diff changeset
971 \n\
28676
0a677c35ad99 (Fset_fontset_font): Fix docstring. Local variable
Kenichi Handa <handa@m17n.org>
parents: 28511
diff changeset
972 CHARACTER may be a cons; (FROM . TO), where FROM and TO are\n\
28241
df61a12bd266 (Fset_fontset_font, Ffontset_font): Fix newlines in doc string.
Dave Love <fx@gnu.org>
parents: 28223
diff changeset
973 non-generic characters. In that case, use FONTNAME\n\
df61a12bd266 (Fset_fontset_font, Ffontset_font): Fix newlines in doc string.
Dave Love <fx@gnu.org>
parents: 28223
diff changeset
974 for all characters in the range FROM and TO (inclusive).\n\
29501
f901ec87b147 (Fset_fontset_font): The arg CHARACTER may be a charset.
Kenichi Handa <handa@m17n.org>
parents: 29233
diff changeset
975 CHARACTER may be a charset. In that case, use FONTNAME\n\
f901ec87b147 (Fset_fontset_font): The arg CHARACTER may be a charset.
Kenichi Handa <handa@m17n.org>
parents: 29233
diff changeset
976 for all character in the charsets.\n\
28241
df61a12bd266 (Fset_fontset_font, Ffontset_font): Fix newlines in doc string.
Dave Love <fx@gnu.org>
parents: 28223
diff changeset
977 \n\
29233
a09ee5c15dcb (check_registry_encoding): This function deleted.
Kenichi Handa <handa@m17n.org>
parents: 29231
diff changeset
978 FONTNAME may be a cons; (FAMILY . REGISTRY), where FAMILY is a family\n\
a09ee5c15dcb (check_registry_encoding): This function deleted.
Kenichi Handa <handa@m17n.org>
parents: 29231
diff changeset
979 name of a font, REGSITRY is a registry name of a font.")
28676
0a677c35ad99 (Fset_fontset_font): Fix docstring. Local variable
Kenichi Handa <handa@m17n.org>
parents: 28511
diff changeset
980 (name, character, fontname, frame)
0a677c35ad99 (Fset_fontset_font): Fix docstring. Local variable
Kenichi Handa <handa@m17n.org>
parents: 28511
diff changeset
981 Lisp_Object name, character, fontname, frame;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
982 {
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
983 Lisp_Object fontset, elt;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
984 Lisp_Object realized;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
985 int from, to;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
986 int id;
29233
a09ee5c15dcb (check_registry_encoding): This function deleted.
Kenichi Handa <handa@m17n.org>
parents: 29231
diff changeset
987 Lisp_Object family, registry;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
988
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
989 fontset = check_fontset_name (name);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
990
28676
0a677c35ad99 (Fset_fontset_font): Fix docstring. Local variable
Kenichi Handa <handa@m17n.org>
parents: 28511
diff changeset
991 if (CONSP (character))
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
992 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
993 /* 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
994 characters. */
28676
0a677c35ad99 (Fset_fontset_font): Fix docstring. Local variable
Kenichi Handa <handa@m17n.org>
parents: 28511
diff changeset
995 CHECK_NUMBER (XCAR (character), 1);
0a677c35ad99 (Fset_fontset_font): Fix docstring. Local variable
Kenichi Handa <handa@m17n.org>
parents: 28511
diff changeset
996 CHECK_NUMBER (XCDR (character), 1);
0a677c35ad99 (Fset_fontset_font): Fix docstring. Local variable
Kenichi Handa <handa@m17n.org>
parents: 28511
diff changeset
997 from = XINT (XCAR (character));
0a677c35ad99 (Fset_fontset_font): Fix docstring. Local variable
Kenichi Handa <handa@m17n.org>
parents: 28511
diff changeset
998 to = XINT (XCDR (character));
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
999 if (!char_valid_p (from, 0) || !char_valid_p (to, 0))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1000 error ("Character range should be by non-generic characters.");
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1001 if (!NILP (name)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1002 && (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
1003 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
1004 }
29501
f901ec87b147 (Fset_fontset_font): The arg CHARACTER may be a charset.
Kenichi Handa <handa@m17n.org>
parents: 29233
diff changeset
1005 else if (SYMBOLP (character))
f901ec87b147 (Fset_fontset_font): The arg CHARACTER may be a charset.
Kenichi Handa <handa@m17n.org>
parents: 29233
diff changeset
1006 {
f901ec87b147 (Fset_fontset_font): The arg CHARACTER may be a charset.
Kenichi Handa <handa@m17n.org>
parents: 29233
diff changeset
1007 elt = Fget (character, Qcharset);
f901ec87b147 (Fset_fontset_font): The arg CHARACTER may be a charset.
Kenichi Handa <handa@m17n.org>
parents: 29233
diff changeset
1008 if (!VECTORP (elt) || ASIZE (elt) < 1 || !NATNUMP (AREF (elt, 0)))
f901ec87b147 (Fset_fontset_font): The arg CHARACTER may be a charset.
Kenichi Handa <handa@m17n.org>
parents: 29233
diff changeset
1009 error ("Invalid charset: %s", (XSYMBOL (character)->name)->data);
f901ec87b147 (Fset_fontset_font): The arg CHARACTER may be a charset.
Kenichi Handa <handa@m17n.org>
parents: 29233
diff changeset
1010 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
1011 to = from;
f901ec87b147 (Fset_fontset_font): The arg CHARACTER may be a charset.
Kenichi Handa <handa@m17n.org>
parents: 29233
diff changeset
1012 }
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1013 else
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1014 {
28676
0a677c35ad99 (Fset_fontset_font): Fix docstring. Local variable
Kenichi Handa <handa@m17n.org>
parents: 28511
diff changeset
1015 CHECK_NUMBER (character, 1);
0a677c35ad99 (Fset_fontset_font): Fix docstring. Local variable
Kenichi Handa <handa@m17n.org>
parents: 28511
diff changeset
1016 from = XINT (character);
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1017 to = from;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1018 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1019 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
1020 invalid_character (from);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1021 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
1022 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
1023 if (from < to)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1024 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1025 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
1026 invalid_character (to);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1027 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
1028 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
1029 }
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1030
29233
a09ee5c15dcb (check_registry_encoding): This function deleted.
Kenichi Handa <handa@m17n.org>
parents: 29231
diff changeset
1031 if (STRINGP (fontname))
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1032 {
29233
a09ee5c15dcb (check_registry_encoding): This function deleted.
Kenichi Handa <handa@m17n.org>
parents: 29231
diff changeset
1033 fontname = Fdowncase (fontname);
a09ee5c15dcb (check_registry_encoding): This function deleted.
Kenichi Handa <handa@m17n.org>
parents: 29231
diff changeset
1034 elt = Fcons (make_number (from), font_family_registry (fontname));
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1035 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1036 else
29233
a09ee5c15dcb (check_registry_encoding): This function deleted.
Kenichi Handa <handa@m17n.org>
parents: 29231
diff changeset
1037 {
a09ee5c15dcb (check_registry_encoding): This function deleted.
Kenichi Handa <handa@m17n.org>
parents: 29231
diff changeset
1038 CHECK_CONS (fontname, 2);
a09ee5c15dcb (check_registry_encoding): This function deleted.
Kenichi Handa <handa@m17n.org>
parents: 29231
diff changeset
1039 family = XCAR (fontname);
a09ee5c15dcb (check_registry_encoding): This function deleted.
Kenichi Handa <handa@m17n.org>
parents: 29231
diff changeset
1040 registry = XCDR (fontname);
a09ee5c15dcb (check_registry_encoding): This function deleted.
Kenichi Handa <handa@m17n.org>
parents: 29231
diff changeset
1041 if (!NILP (family))
a09ee5c15dcb (check_registry_encoding): This function deleted.
Kenichi Handa <handa@m17n.org>
parents: 29231
diff changeset
1042 CHECK_STRING (family, 2);
a09ee5c15dcb (check_registry_encoding): This function deleted.
Kenichi Handa <handa@m17n.org>
parents: 29231
diff changeset
1043 if (!NILP (registry))
a09ee5c15dcb (check_registry_encoding): This function deleted.
Kenichi Handa <handa@m17n.org>
parents: 29231
diff changeset
1044 CHECK_STRING (registry, 2);
a09ee5c15dcb (check_registry_encoding): This function deleted.
Kenichi Handa <handa@m17n.org>
parents: 29231
diff changeset
1045 elt = Fcons (make_number (from), Fcons (family, registry));
a09ee5c15dcb (check_registry_encoding): This function deleted.
Kenichi Handa <handa@m17n.org>
parents: 29231
diff changeset
1046 }
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1047
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1048 /* 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
1049 the validity. */
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1050 if (!NILP (frame))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1051 CHECK_LIVE_FRAME (frame, 3);
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1052
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1053 for (; from <= to; from++)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1054 FONTSET_SET (fontset, from, elt);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1055 Foptimize_char_table (fontset);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1056
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1057 /* 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
1058 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
1059 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
1060 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
1061 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
1062 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1063 realized = AREF (Vfontset_table, id);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1064 if (!NILP (realized)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1065 && !BASE_FONTSET_P (realized)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1066 && EQ (FONTSET_BASE (realized), fontset))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1067 {
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1068 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
1069 clear_fontset_elements (realized);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1070 free_realized_multibyte_face (f, id);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1071 }
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1072 }
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1073
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1074 return Qnil;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1075 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1076
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1077 DEFUN ("font-info", Ffont_info, Sfont_info, 1, 2, 0,
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1078 "Return information about a font named NAME on frame FRAME.\n\
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1079 If FRAME is omitted or nil, use the selected frame.\n\
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1080 The returned value is a vector of OPENED-NAME, FULL-NAME, CHARSET, SIZE,\n\
17112
5c48ff325655 (syms_of_fontset): Intern Qfontset. Declare new lisp
Kenichi Handa <handa@m17n.org>
parents: 17071
diff changeset
1081 HEIGHT, BASELINE-OFFSET, RELATIVE-COMPOSE, and DEFAULT-ASCENT,\n\
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1082 where\n\
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1083 OPENED-NAME is the name used for opening the font,\n\
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1084 FULL-NAME is the full name of the font,\n\
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1085 SIZE is the maximum bound width of the font,\n\
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1086 HEIGHT is the height of the font,\n\
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1087 BASELINE-OFFSET is the upward offset pixels from ASCII baseline,\n\
17112
5c48ff325655 (syms_of_fontset): Intern Qfontset. Declare new lisp
Kenichi Handa <handa@m17n.org>
parents: 17071
diff changeset
1088 RELATIVE-COMPOSE and DEFAULT-ASCENT are the numbers controlling\n\
5c48ff325655 (syms_of_fontset): Intern Qfontset. Declare new lisp
Kenichi Handa <handa@m17n.org>
parents: 17071
diff changeset
1089 how to compose characters.\n\
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1090 If the named font is not yet loaded, return nil.")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1091 (name, frame)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1092 Lisp_Object name, frame;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1093 {
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1094 FRAME_PTR f;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1095 struct font_info *fontp;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1096 Lisp_Object info;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1097
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1098 (*check_window_system_func) ();
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1099
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1100 CHECK_STRING (name, 0);
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1101 name = Fdowncase (name);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1102 if (NILP (frame))
25668
99290b59352d (Ffont_info): Change for Lisp_Object selected_frame.
Gerd Moellmann <gerd@gnu.org>
parents: 24611
diff changeset
1103 frame = selected_frame;
99290b59352d (Ffont_info): Change for Lisp_Object selected_frame.
Gerd Moellmann <gerd@gnu.org>
parents: 24611
diff changeset
1104 CHECK_LIVE_FRAME (frame, 1);
99290b59352d (Ffont_info): Change for Lisp_Object selected_frame.
Gerd Moellmann <gerd@gnu.org>
parents: 24611
diff changeset
1105 f = XFRAME (frame);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1106
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1107 if (!query_font_func)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1108 error ("Font query function is not supported");
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1109
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1110 fontp = (*query_font_func) (f, XSTRING (name)->data);
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1111 if (!fontp)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1112 return Qnil;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1113
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1114 info = Fmake_vector (make_number (7), Qnil);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1115
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1116 XVECTOR (info)->contents[0] = build_string (fontp->name);
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1117 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
1118 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
1119 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
1120 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
1121 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
1122 XVECTOR (info)->contents[6] = make_number (fontp->default_ascent);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1123
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1124 return info;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1125 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1126
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1127
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1128 /* Return the font name for the character at POSITION in the current
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1129 buffer. This is computed from all the text properties and overlays
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1130 that apply to POSITION. It returns nil in the following cases:
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1131
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1132 (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
1133 it is displayed by an empty box).
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1134
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1135 (2) The character code is invalid.
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1136
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1137 (3) The current buffer is not displayed in any window.
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1138
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1139 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
1140 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
1141 POSITION is currently not visible. */
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1142
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1143
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1144 DEFUN ("internal-char-font", Finternal_char_font, Sinternal_char_font, 1, 1, 0,
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1145 "For internal use only.")
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1146 (position)
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1147 Lisp_Object position;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1148 {
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1149 int pos, pos_byte, dummy;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1150 int face_id;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1151 int c;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1152 Lisp_Object window;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1153 struct window *w;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1154 struct frame *f;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1155 struct face *face;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1156
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1157 CHECK_NUMBER_COERCE_MARKER (position, 0);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1158 pos = XINT (position);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1159 if (pos < BEGV || pos >= ZV)
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1160 args_out_of_range_3 (position, make_number (BEGV), make_number (ZV));
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1161 pos_byte = CHAR_TO_BYTE (pos);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1162 c = FETCH_CHAR (pos_byte);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1163 if (! CHAR_VALID_P (c, 0))
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1164 return Qnil;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1165 window = Fget_buffer_window (Fcurrent_buffer (), Qt);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1166 if (NILP (window))
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1167 return Qnil;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1168 w = XWINDOW (window);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1169 f = XFRAME (w->frame);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1170 face_id = face_at_buffer_position (w, pos, -1, -1, &dummy, pos + 100, 0);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1171 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
1172 face = FACE_FROM_ID (f, face_id);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1173 return (face->font && face->font_name
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1174 ? build_string (face->font_name)
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1175 : Qnil);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1176 }
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1177
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1178
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1179 /* Called from Ffontset_info via map_char_table on each leaf of
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1180 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
1181 ARG)' and FONT-INFOs have this form:
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1182 (CHAR FONT-SPEC) or ((FROM . TO) FONT-SPEC)
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1183 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
1184 function add the information of the current leaf to ARG by
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1185 appending a new element or modifying the last element.. */
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1186
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1187 static void
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1188 accumulate_font_info (arg, character, elt)
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1189 Lisp_Object arg, character, elt;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1190 {
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1191 Lisp_Object last, last_char, last_elt, tmp;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1192
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1193 if (!CONSP (elt))
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1194 return;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1195 last = XCAR (arg);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1196 last_char = XCAR (XCAR (last));
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1197 last_elt = XCAR (XCDR (XCAR (last)));
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1198 elt = XCDR (elt);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1199 if (!NILP (Fequal (elt, last_elt)))
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1200 {
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1201 int this_charset = CHAR_CHARSET (XINT (character));
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1202
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1203 if (CONSP (last_char)) /* LAST_CHAR == (FROM . TO) */
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1204 {
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1205 if (this_charset == CHAR_CHARSET (XINT (XCAR (last_char))))
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1206 {
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1207 XCDR (last_char) = character;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1208 return;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1209 }
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1210 }
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1211 else
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1212 {
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1213 if (this_charset == CHAR_CHARSET (XINT (last_char)))
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1214 {
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1215 XCAR (XCAR (last)) = Fcons (last_char, character);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1216 return;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1217 }
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1218 }
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1219 }
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1220 XCDR (last) = Fcons (Fcons (character, Fcons (elt, Qnil)), Qnil);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1221 XCAR (arg) = XCDR (last);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1222 }
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1223
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1224
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1225 DEFUN ("fontset-info", Ffontset_info, Sfontset_info, 1, 2, 0,
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1226 "Return information about a fontset named NAME on frame FRAME.\n\
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1227 The value is a list:\n\
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1228 \(FONTSET-NAME (CHARSET-OR-RANGE FONT-SPEC OPENED ...) ...),\n\
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1229 where,\n\
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1230 FONTSET-NAME is a full name of the fontset.\n\
28971
a7bbac783196 (Ffontset_info): ...and another.
Dave Love <fx@gnu.org>
parents: 28970
diff changeset
1231 CHARSET-OR-RANGE is a charset, a character (may be a generic character)\n\
28970
0585095ab3e1 (Ffontset_info): Fix newline in doc.
Dave Love <fx@gnu.org>
parents: 28963
diff changeset
1232 or a cons of two characters specifying the range of characters.\n\
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1233 FONT-SPEC is a fontname pattern string or a cons (FAMILY . REGISTRY),\n\
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1234 where FAMILY is a `FAMILY' field of a XLFD font name,\n\
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1235 REGISTRY is a `CHARSET_REGISTRY' field of a XLDF font name.\n\
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1236 FAMILY may contain a `FOUNDARY' field at the head.\n\
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1237 REGISTRY may contain a `CHARSET_ENCODING' field at the tail.\n\
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1238 OPENEDs are names of fonts actually opened.\n\
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1239 If FRAME is omitted, it defaults to the currently selected frame.")
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1240 (name, frame)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1241 Lisp_Object name, frame;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1242 {
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1243 Lisp_Object fontset;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1244 FRAME_PTR f;
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1245 Lisp_Object indices[3];
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1246 Lisp_Object val, tail, elt;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1247 Lisp_Object *realized;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1248 int n_realized = 0;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1249 int i;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1250
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1251 (*check_window_system_func) ();
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1252
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1253 fontset = check_fontset_name (name);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1254
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1255 if (NILP (frame))
25668
99290b59352d (Ffont_info): Change for Lisp_Object selected_frame.
Gerd Moellmann <gerd@gnu.org>
parents: 24611
diff changeset
1256 frame = selected_frame;
99290b59352d (Ffont_info): Change for Lisp_Object selected_frame.
Gerd Moellmann <gerd@gnu.org>
parents: 24611
diff changeset
1257 CHECK_LIVE_FRAME (frame, 1);
99290b59352d (Ffont_info): Change for Lisp_Object selected_frame.
Gerd Moellmann <gerd@gnu.org>
parents: 24611
diff changeset
1258 f = XFRAME (frame);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1259
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1260 /* Recodeq realized fontsets whose base is FONTSET in the table
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1261 `realized'. */
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1262 realized = (Lisp_Object *) alloca (sizeof (Lisp_Object)
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1263 * ASIZE (Vfontset_table));
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1264 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
1265 {
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1266 elt = FONTSET_FROM_ID (i);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1267 if (!NILP (elt)
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1268 && EQ (FONTSET_BASE (elt), fontset))
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1269 realized[n_realized++] = elt;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1270 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1271
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1272 /* Accumulate information of the fontset in VAL. The format is
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1273 (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
1274 FONT-SPEC). See the comment for accumulate_font_info for the
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1275 detail. */
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1276 val = Fcons (Fcons (make_number (0),
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1277 Fcons (XCDR (FONTSET_ASCII (fontset)), Qnil)),
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1278 Qnil);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1279 val = Fcons (val, val);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1280 map_char_table (accumulate_font_info, Qnil, fontset, val, 0, indices);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1281 val = XCDR (val);
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1282
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1283 /* For each FONT-INFO, if CHAR_OR_RANGE (car part) is a generic
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1284 character for a charset, replace it wiht the charset symbol. If
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1285 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
1286 FONT-SPEC. */
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1287 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
1288 {
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1289 int c;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1290 elt = XCAR (tail);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1291 if (INTEGERP (XCAR (elt)))
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1292 {
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1293 int charset, c1, c2;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1294 c = XINT (XCAR (elt));
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1295 SPLIT_CHAR (c, charset, c1, c2);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1296 if (c1 == 0)
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1297 XCAR (elt) = CHARSET_SYMBOL (charset);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1298 }
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1299 else
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1300 c = XINT (XCAR (XCAR (elt)));
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1301 for (i = 0; i < n_realized; i++)
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1302 {
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1303 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
1304 struct face *face;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1305
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1306 face_id = FONTSET_REF_VIA_BASE (realized[i], c);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1307 if (INTEGERP (face_id))
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1308 {
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1309 face = FACE_FROM_ID (f, XINT (face_id));
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1310 if (face->font && face->font_name)
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1311 {
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1312 font = build_string (face->font_name);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1313 if (NILP (Fmember (font, XCDR (XCDR (elt)))))
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1314 XCDR (XCDR (elt)) = Fcons (font, XCDR (XCDR (elt)));
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1315 }
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1316 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1317 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1318 }
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1319 return Fcons (FONTSET_NAME (fontset), val);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1320 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1321
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1322 DEFUN ("fontset-font", Ffontset_font, Sfontset_font, 2, 2, 0,
28241
df61a12bd266 (Fset_fontset_font, Ffontset_font): Fix newlines in doc string.
Dave Love <fx@gnu.org>
parents: 28223
diff changeset
1323 "Return a font name pattern for character CH in fontset NAME.\n\
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1324 If NAME is t, find a font name pattern in the default fontset.")
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1325 (name, ch)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1326 Lisp_Object name, ch;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1327 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1328 int c, id;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1329 Lisp_Object fontset, elt;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1330
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1331 fontset = check_fontset_name (name);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1332
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1333 CHECK_NUMBER (ch, 1);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1334 c = XINT (ch);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1335 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
1336 invalid_character (c);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1337
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1338 elt = FONTSET_REF (fontset, c);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1339 if (CONSP (elt))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1340 elt = XCDR (elt);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1341
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1342 return elt;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1343 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1344
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1345
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1346 DEFUN ("fontset-list", Ffontset_list, Sfontset_list, 0, 0, 0,
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1347 "Return a list of all defined fontset names.")
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1348 ()
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1349 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1350 Lisp_Object fontset, list;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1351 int i;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1352
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1353 list = Qnil;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1354 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
1355 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1356 fontset = FONTSET_FROM_ID (i);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1357 if (!NILP (fontset)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1358 && BASE_FONTSET_P (fontset))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1359 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
1360 }
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1361
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1362 return list;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1363 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1364
21514
fa9ff387d260 Fix -Wimplicit warnings.
Andreas Schwab <schwab@suse.de>
parents: 21127
diff changeset
1365 void
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1366 syms_of_fontset ()
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1367 {
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1368 int i;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1369
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1370 if (!load_font_func)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1371 /* Window system initializer should have set proper functions. */
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1372 abort ();
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1373
17112
5c48ff325655 (syms_of_fontset): Intern Qfontset. Declare new lisp
Kenichi Handa <handa@m17n.org>
parents: 17071
diff changeset
1374 Qfontset = intern ("fontset");
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1375 staticpro (&Qfontset);
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1376 Fput (Qfontset, Qchar_table_extra_slots, make_number (3));
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1377
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1378 Vcached_fontset_data = Qnil;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1379 staticpro (&Vcached_fontset_data);
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1380
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1381 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
1382 staticpro (&Vfontset_table);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1383
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1384 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
1385 staticpro (&Vdefault_fontset);
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1386 FONTSET_ID (Vdefault_fontset) = make_number (0);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1387 FONTSET_NAME (Vdefault_fontset)
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1388 = build_string ("-*-*-*-*-*-*-*-*-*-*-*-*-fontset-default");
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1389 FONTSET_ASCII (Vdefault_fontset)
29231
3c444d185d31 (syms_of_fontset): Adjust the font name for ascii of
Kenichi Handa <handa@m17n.org>
parents: 29011
diff changeset
1390 = Fcons (make_number (0),
3c444d185d31 (syms_of_fontset): Adjust the font name for ascii of
Kenichi Handa <handa@m17n.org>
parents: 29011
diff changeset
1391 build_string ("-adobe-courier-medium-r-*-*-*-120-*-*-*-*-iso8859-1"));
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1392 AREF (Vfontset_table, 0) = Vdefault_fontset;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1393 next_fontset_id = 1;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1394
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1395 DEFVAR_LISP ("font-encoding-alist", &Vfont_encoding_alist,
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1396 "Alist of fontname patterns vs corresponding encoding info.\n\
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1397 Each element looks like (REGEXP . ENCODING-INFO),\n\
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1398 where ENCODING-INFO is an alist of CHARSET vs ENCODING.\n\
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1399 ENCODING is one of the following integer values:\n\
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1400 0: code points 0x20..0x7F or 0x2020..0x7F7F are used,\n\
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1401 1: code points 0xA0..0xFF or 0xA0A0..0xFFFF are used,\n\
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1402 2: code points 0x20A0..0x7FFF are used,\n\
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1403 3: code points 0xA020..0xFF7F are used.");
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1404 Vfont_encoding_alist = Qnil;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1405
17112
5c48ff325655 (syms_of_fontset): Intern Qfontset. Declare new lisp
Kenichi Handa <handa@m17n.org>
parents: 17071
diff changeset
1406 DEFVAR_LISP ("use-default-ascent", &Vuse_default_ascent,
19172
f3580f4e3587 (syms_of_fontset): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18976
diff changeset
1407 "Char table of characters whose ascent values should be ignored.\n\
17112
5c48ff325655 (syms_of_fontset): Intern Qfontset. Declare new lisp
Kenichi Handa <handa@m17n.org>
parents: 17071
diff changeset
1408 If an entry for a character is non-nil, the ascent value of the glyph\n\
19282
09a1536debb4 (Vignore_relative_composition): New variable.
Kenichi Handa <handa@m17n.org>
parents: 19172
diff changeset
1409 is assumed to be what specified by _MULE_DEFAULT_ASCENT property of a font.\n\
09a1536debb4 (Vignore_relative_composition): New variable.
Kenichi Handa <handa@m17n.org>
parents: 19172
diff changeset
1410 \n\
09a1536debb4 (Vignore_relative_composition): New variable.
Kenichi Handa <handa@m17n.org>
parents: 19172
diff changeset
1411 This affects how a composite character which contains\n\
09a1536debb4 (Vignore_relative_composition): New variable.
Kenichi Handa <handa@m17n.org>
parents: 19172
diff changeset
1412 such a character is displayed on screen.");
09a1536debb4 (Vignore_relative_composition): New variable.
Kenichi Handa <handa@m17n.org>
parents: 19172
diff changeset
1413 Vuse_default_ascent = Qnil;
09a1536debb4 (Vignore_relative_composition): New variable.
Kenichi Handa <handa@m17n.org>
parents: 19172
diff changeset
1414
09a1536debb4 (Vignore_relative_composition): New variable.
Kenichi Handa <handa@m17n.org>
parents: 19172
diff changeset
1415 DEFVAR_LISP ("ignore-relative-composition", &Vignore_relative_composition,
09a1536debb4 (Vignore_relative_composition): New variable.
Kenichi Handa <handa@m17n.org>
parents: 19172
diff changeset
1416 "Char table of characters which is not composed relatively.\n\
26858
7cc081b4e084 (Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents: 26164
diff changeset
1417 If an entry for a character is non-nil, a composition sequence\n\
19282
09a1536debb4 (Vignore_relative_composition): New variable.
Kenichi Handa <handa@m17n.org>
parents: 19172
diff changeset
1418 which contains that character is displayed so that\n\
09a1536debb4 (Vignore_relative_composition): New variable.
Kenichi Handa <handa@m17n.org>
parents: 19172
diff changeset
1419 the glyph of that character is put without considering\n\
09a1536debb4 (Vignore_relative_composition): New variable.
Kenichi Handa <handa@m17n.org>
parents: 19172
diff changeset
1420 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
1421 Vignore_relative_composition = Qnil;
17112
5c48ff325655 (syms_of_fontset): Intern Qfontset. Declare new lisp
Kenichi Handa <handa@m17n.org>
parents: 17071
diff changeset
1422
19450
895dc2520755 (Valternate_fontname_alist): Name changed from
Kenichi Handa <handa@m17n.org>
parents: 19282
diff changeset
1423 DEFVAR_LISP ("alternate-fontname-alist", &Valternate_fontname_alist,
895dc2520755 (Valternate_fontname_alist): Name changed from
Kenichi Handa <handa@m17n.org>
parents: 19282
diff changeset
1424 "Alist of fontname vs list of the alternate fontnames.\n\
19172
f3580f4e3587 (syms_of_fontset): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18976
diff changeset
1425 When a specified font name is not found, the corresponding\n\
19450
895dc2520755 (Valternate_fontname_alist): Name changed from
Kenichi Handa <handa@m17n.org>
parents: 19282
diff changeset
1426 alternate fontnames (if any) are tried instead.");
895dc2520755 (Valternate_fontname_alist): Name changed from
Kenichi Handa <handa@m17n.org>
parents: 19282
diff changeset
1427 Valternate_fontname_alist = Qnil;
17193
dc4562b0152a (Valternative_fontname_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17190
diff changeset
1428
17730
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
1429 DEFVAR_LISP ("fontset-alias-alist", &Vfontset_alias_alist,
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
1430 "Alist of fontset names vs the aliases.");
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1431 Vfontset_alias_alist = Fcons (Fcons (FONTSET_NAME (Vdefault_fontset),
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1432 build_string ("fontset-default")),
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1433 Qnil);
17730
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
1434
17331
f91b4d582897 (Vhighlight_wrong_size_font, Vclip_large_size_font):
Kenichi Handa <handa@m17n.org>
parents: 17193
diff changeset
1435 DEFVAR_LISP ("highlight-wrong-size-font", &Vhighlight_wrong_size_font,
f91b4d582897 (Vhighlight_wrong_size_font, Vclip_large_size_font):
Kenichi Handa <handa@m17n.org>
parents: 17193
diff changeset
1436 "*Non-nil means highlight characters shown in wrong size fonts somehow.\n\
f91b4d582897 (Vhighlight_wrong_size_font, Vclip_large_size_font):
Kenichi Handa <handa@m17n.org>
parents: 17193
diff changeset
1437 The way to highlight them depends on window system on which Emacs runs.\n\
19172
f3580f4e3587 (syms_of_fontset): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18976
diff changeset
1438 On X11, a rectangle is shown around each such character.");
18976
ebb3e71c6dfd (syms_of_fontset): Set Vhighlight_wrong_size_font to Qnil.
Kenichi Handa <handa@m17n.org>
parents: 18694
diff changeset
1439 Vhighlight_wrong_size_font = Qnil;
17331
f91b4d582897 (Vhighlight_wrong_size_font, Vclip_large_size_font):
Kenichi Handa <handa@m17n.org>
parents: 17193
diff changeset
1440
f91b4d582897 (Vhighlight_wrong_size_font, Vclip_large_size_font):
Kenichi Handa <handa@m17n.org>
parents: 17193
diff changeset
1441 DEFVAR_LISP ("clip-large-size-font", &Vclip_large_size_font,
19172
f3580f4e3587 (syms_of_fontset): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18976
diff changeset
1442 "*Non-nil means characters shown in overlarge fonts are clipped.\n\
17730
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
1443 The height of clipping area is the same as that of an ASCII character.\n\
19172
f3580f4e3587 (syms_of_fontset): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18976
diff changeset
1444 The width of the area is the same as that of an ASCII character,\n\
f3580f4e3587 (syms_of_fontset): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18976
diff changeset
1445 or twice as wide, depending on the character set's column-width.\n\
17730
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
1446 \n\
19172
f3580f4e3587 (syms_of_fontset): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18976
diff changeset
1447 If the only font you have for a specific character set is too large,\n\
f3580f4e3587 (syms_of_fontset): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18976
diff changeset
1448 and clipping these characters makes them hard to read,\n\
f3580f4e3587 (syms_of_fontset): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18976
diff changeset
1449 you can set this variable to nil to display the characters without clipping.\n\
f3580f4e3587 (syms_of_fontset): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18976
diff changeset
1450 The drawback is that you will get some garbage left on your screen.");
17331
f91b4d582897 (Vhighlight_wrong_size_font, Vclip_large_size_font):
Kenichi Handa <handa@m17n.org>
parents: 17193
diff changeset
1451 Vclip_large_size_font = Qt;
f91b4d582897 (Vhighlight_wrong_size_font, Vclip_large_size_font):
Kenichi Handa <handa@m17n.org>
parents: 17193
diff changeset
1452
26858
7cc081b4e084 (Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents: 26164
diff changeset
1453 DEFVAR_LISP ("vertical-centering-font-regexp",
7cc081b4e084 (Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents: 26164
diff changeset
1454 &Vvertical_centering_font_regexp,
7cc081b4e084 (Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents: 26164
diff changeset
1455 "*Regexp matching font names that require vertical centering on display.\n\
7cc081b4e084 (Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents: 26164
diff changeset
1456 When a character is displayed with such fonts, the character is displayed\n\
7cc081b4e084 (Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents: 26164
diff changeset
1457 at the vertival center of lines.");
7cc081b4e084 (Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents: 26164
diff changeset
1458 Vvertical_centering_font_regexp = Qnil;
7cc081b4e084 (Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents: 26164
diff changeset
1459
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1460 defsubr (&Squery_fontset);
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1461 defsubr (&Snew_fontset);
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1462 defsubr (&Sset_fontset_font);
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1463 defsubr (&Sfont_info);
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1464 defsubr (&Sinternal_char_font);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1465 defsubr (&Sfontset_info);
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1466 defsubr (&Sfontset_font);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1467 defsubr (&Sfontset_list);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1468 }