annotate src/fontset.c @ 30273:dad74ad87ac2

(eshell-smart): Replace links to eshell.info with links to eshell, to avoid problems on systems where the manual is installed as `eshell'.
author Eli Zaretskii <eliz@gnu.org>
date Tue, 18 Jul 2000 11:50:42 +0000
parents 5a375a2cdd3a
children dde5ab185aad
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
29767
c8e5453dc85d (FONTSET_ASCII): Use the first element of char table
Kenichi Handa <handa@m17n.org>
parents: 29501
diff changeset
76 element in a fontset. The element is stored in the first element
c8e5453dc85d (FONTSET_ASCII): Use the first element of char table
Kenichi Handa <handa@m17n.org>
parents: 29501
diff changeset
77 of the fontset.
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
78
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
79 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
80 FONTSET_SET respectively for efficiency.
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 A fontset has 3 extra slots.
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
83
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
84 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
85
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
86 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
87 face.
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 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
90 for a default 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 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
93 is a base fontset.
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 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
96 recorded in Vfontset_table.
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
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
99 DEFAULT FONTSET
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 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
102 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
103 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
104 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
105 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
106
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
107 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
108 fontset is the default 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
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
111 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
112 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
113 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
114 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
115 actual fontset objects.
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
116
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
117 */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
118
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
119 /********** VARIABLES and FUNCTION PROTOTYPES **********/
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 extern Lisp_Object Qfont;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
122 Lisp_Object Qfontset;
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 /* Vector containing all fontsets. */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
125 static Lisp_Object Vfontset_table;
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 /* 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
128 fontset ID not yet used. */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
129 static int next_fontset_id;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
130
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
131 /* 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
132 font for each characters. */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
133 static Lisp_Object Vdefault_fontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
134
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
135 Lisp_Object Vfont_encoding_alist;
17112
5c48ff325655 (syms_of_fontset): Intern Qfontset. Declare new lisp
Kenichi Handa <handa@m17n.org>
parents: 17071
diff changeset
136 Lisp_Object Vuse_default_ascent;
19282
09a1536debb4 (Vignore_relative_composition): New variable.
Kenichi Handa <handa@m17n.org>
parents: 19172
diff changeset
137 Lisp_Object Vignore_relative_composition;
19450
895dc2520755 (Valternate_fontname_alist): Name changed from
Kenichi Handa <handa@m17n.org>
parents: 19282
diff changeset
138 Lisp_Object Valternate_fontname_alist;
17730
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
139 Lisp_Object Vfontset_alias_alist;
17331
f91b4d582897 (Vhighlight_wrong_size_font, Vclip_large_size_font):
Kenichi Handa <handa@m17n.org>
parents: 17193
diff changeset
140 Lisp_Object Vhighlight_wrong_size_font;
f91b4d582897 (Vhighlight_wrong_size_font, Vclip_large_size_font):
Kenichi Handa <handa@m17n.org>
parents: 17193
diff changeset
141 Lisp_Object Vclip_large_size_font;
26858
7cc081b4e084 (Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents: 26164
diff changeset
142 Lisp_Object Vvertical_centering_font_regexp;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
143
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
144 /* 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
145 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
146 detail. */
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
147
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
148 /* 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
149 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
150
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
151 /* Return a list of font names which matches PATTERN. See the document of
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
152 `x-list-fonts' for more detail. */
23517
73f09e7bc96e Include frame.h before fontset.h.
Kenichi Handa <handa@m17n.org>
parents: 22719
diff changeset
153 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
154 Lisp_Object pattern,
73f09e7bc96e Include frame.h before fontset.h.
Kenichi Handa <handa@m17n.org>
parents: 22719
diff changeset
155 int size,
73f09e7bc96e Include frame.h before fontset.h.
Kenichi Handa <handa@m17n.org>
parents: 22719
diff changeset
156 int maxnames));
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
157
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
158 /* 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
159 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
160 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
161
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
162 /* 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
163 struct font_info *(*query_font_func) P_ ((FRAME_PTR f, char *name));
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 /* Additional function for setting fontset or changing fontset
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
166 contents of frame F. */
20315
931b4ddf7966 Protoize functions declarations.
Andreas Schwab <schwab@suse.de>
parents: 19450
diff changeset
167 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
168 Lisp_Object oldval));
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
169
21553
2d7afcd11b72 (find_ccl_program_func): New variable.
Kenichi Handa <handa@m17n.org>
parents: 21514
diff changeset
170 /* 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
171 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
172 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
173 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
174
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
175 /* Check if any window system is used now. */
20315
931b4ddf7966 Protoize functions declarations.
Andreas Schwab <schwab@suse.de>
parents: 19450
diff changeset
176 void (*check_window_system_func) P_ ((void));
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
177
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
178
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
179 /* Prototype declarations for static functions. */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
180 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
181 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
182 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
183 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
184 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
185 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
186
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
187
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
188 /********** MACROS AND FUNCTIONS TO HANDLE FONTSET **********/
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
189
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
190 /* Return the fontset with ID. No check of ID's validness. */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
191 #define FONTSET_FROM_ID(id) AREF (Vfontset_table, id)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
192
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
193 /* 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
194 #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
195 #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
196 #define FONTSET_FRAME(fontset) XCHAR_TABLE (fontset)->extras[2]
29767
c8e5453dc85d (FONTSET_ASCII): Use the first element of char table
Kenichi Handa <handa@m17n.org>
parents: 29501
diff changeset
197 #define FONTSET_ASCII(fontset) XCHAR_TABLE (fontset)->contents[0]
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
198 #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
199
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
200 #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
201
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
202
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
203 /* 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
204
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
205 #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
206
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
207 static INLINE Lisp_Object
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
208 fontset_ref (fontset, c)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
209 Lisp_Object fontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
210 int c;
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 int charset, c1, c2;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
213 Lisp_Object elt, defalt;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
214 int i;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
215
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
216 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
217 return FONTSET_ASCII (fontset);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
218
29011
b60861d6c1e0 (fontset_ref): Use SPLIT_CHAR instead of
Kenichi Handa <handa@m17n.org>
parents: 28971
diff changeset
219 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
220 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
221 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
222 return elt;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
223 defalt = XCHAR_TABLE (elt)->defalt;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
224 if (c1 < 32
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
225 || (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
226 NILP (elt)))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
227 return defalt;
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 (c2 < 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[c2],
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 return elt;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
236 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
237
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
238
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
239 #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
240
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
241 static INLINE Lisp_Object
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
242 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
243 Lisp_Object fontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
244 int *c;
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 int charset, c1, c2;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
247 Lisp_Object elt;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
248
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
249 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
250 return FONTSET_ASCII (fontset);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
251
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
252 elt = FONTSET_REF (FONTSET_BASE (fontset), *c);
29767
c8e5453dc85d (FONTSET_ASCII): Use the first element of char table
Kenichi Handa <handa@m17n.org>
parents: 29501
diff changeset
253 if (NILP (elt) && ! EQ (fontset, Vdefault_fontset))
c8e5453dc85d (FONTSET_ASCII): Use the first element of char table
Kenichi Handa <handa@m17n.org>
parents: 29501
diff changeset
254 elt = FONTSET_REF (Vdefault_fontset, *c);
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
255 if (NILP (elt))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
256 return Qnil;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
257
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
258 *c = XINT (XCAR (elt));
29011
b60861d6c1e0 (fontset_ref): Use SPLIT_CHAR instead of
Kenichi Handa <handa@m17n.org>
parents: 28971
diff changeset
259 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
260 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
261 if (c1 < 32)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
262 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
263 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
264 return Qnil;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
265 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
266 if (c2 < 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[c2];
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
271 return elt;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
272 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
273
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
274
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
275 /* 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
276 #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
277
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
278 static void
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
279 fontset_set (fontset, c, newelt)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
280 Lisp_Object fontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
281 int c;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
282 Lisp_Object newelt;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
283 {
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
284 int charset, code[3];
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
285 Lisp_Object *elt, tmp;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
286 int i, j;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
287
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
288 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
289 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
290 FONTSET_ASCII (fontset) = newelt;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
291 return;
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
29011
b60861d6c1e0 (fontset_ref): Use SPLIT_CHAR instead of
Kenichi Handa <handa@m17n.org>
parents: 28971
diff changeset
294 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
295 code[2] = 0; /* anchor */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
296 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
297 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
298 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
299 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
300 *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
301 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
302 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
303 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
304 XCHAR_TABLE (*elt)->defalt = newelt;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
305 else
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
306 *elt = newelt;
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
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
309
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
310 /* 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
311 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
312 BASE. */
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 static Lisp_Object
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
315 make_fontset (frame, name, base)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
316 Lisp_Object frame, name, base;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
317 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
318 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
319 int size = ASIZE (Vfontset_table);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
320 int id = next_fontset_id;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
321 int i, j;
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 /* 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
324 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
325 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
326 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
327 id. */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
328 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
329
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
330 if (id + 1 == size)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
331 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
332 Lisp_Object tem;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
333 int i;
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 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
336 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
337 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
338 Vfontset_table = tem;
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
29767
c8e5453dc85d (FONTSET_ASCII): Use the first element of char table
Kenichi Handa <handa@m17n.org>
parents: 29501
diff changeset
341 fontset = Fmake_char_table (Qfontset, Qnil);
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
342
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
343 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
344 FONTSET_NAME (fontset) = name;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
345 FONTSET_FRAME (fontset) = frame;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
346 FONTSET_BASE (fontset) = base;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
347
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
348 AREF (Vfontset_table, id) = fontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
349 next_fontset_id = id + 1;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
350 return fontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
351 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
352
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
353
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
354 /* 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
355
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
356 static INLINE int
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
357 fontset_id_valid_p (id)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
358 int id;
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 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
361 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
362
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 /* 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
365 *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
366 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
367 FONTNAME. */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
368
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
369 static Lisp_Object
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
370 font_family_registry (fontname)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
371 Lisp_Object fontname;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
372 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
373 Lisp_Object family, registry;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
374 char *p = XSTRING (fontname)->data;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
375 char *sep[15];
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
376 int i = 0;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
377
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
378 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
379 if (i != 14)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
380 return fontname;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
381
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
382 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
383 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
384 return Fcons (family, registry);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
385 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
386
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
387
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
388 /********** 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
389
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
390 /* 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
391
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
392 Lisp_Object
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
393 fontset_name (id)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
394 int id;
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 Lisp_Object fontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
397 fontset = FONTSET_FROM_ID (id);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
398 return FONTSET_NAME (fontset);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
399 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
400
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
401
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
402 /* 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
403
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
404 Lisp_Object
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
405 fontset_ascii (id)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
406 int id;
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 Lisp_Object fontset, elt;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
409 fontset= FONTSET_FROM_ID (id);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
410 elt = FONTSET_ASCII (fontset);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
411 return XCDR (elt);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
412 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
413
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
414
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
415 /* 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
416
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
417 void
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
418 free_face_fontset (f, face)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
419 FRAME_PTR f;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
420 struct face *face;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
421 {
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
422 if (fontset_id_valid_p (face->fontset))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
423 {
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
424 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
425 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
426 next_fontset_id = face->fontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
427 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
428 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
429
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
430
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
431 /* Return 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
432 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
433 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
434
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
435 int
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
436 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
437 struct face *face;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
438 int c;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
439 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
440 Lisp_Object fontset, elt;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
441
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
442 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
443 return (face == face->ascii_face);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
444
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
445 xassert (fontset_id_valid_p (face->fontset));
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
446 fontset = FONTSET_FROM_ID (face->fontset);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
447 xassert (!BASE_FONTSET_P (fontset));
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
448
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
449 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
450 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
451 }
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
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
454 /* 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
455 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
456 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
457 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
458
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
459 int
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
460 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
461 FRAME_PTR f;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
462 struct face *face;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
463 int c;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
464 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
465 Lisp_Object fontset, elt;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
466 int face_id;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
467
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
468 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
469 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
470 xassert (!BASE_FONTSET_P (fontset));
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
471
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
472 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
473 if (!NILP (elt))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
474 return XINT (elt);
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 /* 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
477 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
478 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
479
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
480 /* 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
481 information in the base fontset. */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
482 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
483 return face_id;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
484 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
485
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
486
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
487 /* 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
488 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
489 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
490 Called from realize_x_face. */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
491
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
492 int
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
493 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
494 FRAME_PTR f;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
495 int base_fontset_id;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
496 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
497 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
498
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
499 XSETFRAME (frame, f);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
500 if (base_fontset_id >= 0)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
501 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
502 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
503 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
504 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
505 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
506 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
507 else
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
508 base_fontset = Vdefault_fontset;
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 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
511 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
512 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
513
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 /* 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
516 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
517 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
518 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
519 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
520 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
521 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
522
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
523 Lisp_Object
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
524 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
525 FRAME_PTR f;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
526 int id, c;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
527 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
528 Lisp_Object fontset, elt;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
529 struct font_info *fontp;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
530 Lisp_Object family_registry;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
531
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
532 elt = Qnil;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
533 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
534 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
535 fontset = FONTSET_FROM_ID (id);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
536 xassert (!BASE_FONTSET_P (fontset));
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
537 fontset = FONTSET_BASE (fontset);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
538 elt = FONTSET_REF (fontset, c);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
539 }
29767
c8e5453dc85d (FONTSET_ASCII): Use the first element of char table
Kenichi Handa <handa@m17n.org>
parents: 29501
diff changeset
540 if (NILP (elt))
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
541 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
542
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
543 if (!CONSP (elt))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
544 return Qnil;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
545 if (CONSP (XCDR (elt)))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
546 return XCDR (elt);
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 /* 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
549 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
550 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
551 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
552 specification. */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
553 elt = XCDR (elt);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
554 xassert (STRINGP (elt));
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
555 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
556 if (!fontp)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
557 return Qnil;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
558
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
559 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
560 if (!CONSP (family_registry))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
561 return family_registry;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
562 XCAR (family_registry) = Qnil;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
563 return family_registry;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
564 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
565
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 /* 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
568 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
569 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
570 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
571 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
572 specified by ID. */
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
573
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
574 struct font_info *
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
575 fs_load_font (f, c, fontname, id, face)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
576 FRAME_PTR f;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
577 int c;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
578 char *fontname;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
579 int id;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
580 struct face *face;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
581 {
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
582 Lisp_Object fontset;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
583 Lisp_Object list, elt;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
584 int font_idx;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
585 int size = 0;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
586 struct font_info *fontp;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
587 int charset = CHAR_CHARSET (c);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
588
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
589 if (face)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
590 id = face->fontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
591 if (id < 0)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
592 fontset = Qnil;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
593 else
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
594 fontset = FONTSET_FROM_ID (id);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
595
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
596 if (!NILP (fontset)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
597 && !BASE_FONTSET_P (fontset))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
598 {
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
599 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
600 if (!NILP (elt))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
601 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
602 /* 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
603 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
604 int face_id = XINT (elt);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
605
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
606 xassert (face_id == face->id);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
607 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
608 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
609 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
610
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
611 if (!fontname && charset == CHARSET_ASCII)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
612 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
613 elt = FONTSET_ASCII (fontset);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
614 fontname = XSTRING (XCDR (elt))->data;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
615 }
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
616 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
617
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
618 if (!fontname)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
619 /* No way to get fontname. */
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
620 return 0;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
621
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
622 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
623 if (!fontp)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
624 return 0;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
625
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
626 /* 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
627 font_info structure that are not set by (*load_font_func). */
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
628 fontp->charset = charset;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
629
26858
7cc081b4e084 (Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents: 26164
diff changeset
630 fontp->vertical_centering
7cc081b4e084 (Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents: 26164
diff changeset
631 = (STRINGP (Vvertical_centering_font_regexp)
7cc081b4e084 (Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents: 26164
diff changeset
632 && (fast_c_string_match_ignore_case
7cc081b4e084 (Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents: 26164
diff changeset
633 (Vvertical_centering_font_regexp, fontp->full_name) >= 0));
7cc081b4e084 (Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents: 26164
diff changeset
634
17999
5e325c8057c8 (fs_load_font): Before using a fontset, be sure to
Kenichi Handa <handa@m17n.org>
parents: 17882
diff changeset
635 if (fontp->encoding[1] != FONT_ENCODING_NOT_DECIDED)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
636 {
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
637 /* The font itself tells which code points to be used. Use this
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
638 encoding for all other charsets. */
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
639 int i;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
640
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
641 fontp->encoding[0] = fontp->encoding[1];
17190
6637001cdb4b Adjusted for the change of MAX_CHARSET.
Kenichi Handa <handa@m17n.org>
parents: 17112
diff changeset
642 for (i = MIN_CHARSET_OFFICIAL_DIMENSION1; i <= MAX_CHARSET; i++)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
643 fontp->encoding[i] = fontp->encoding[1];
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
644 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
645 else
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
646 {
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
647 /* The font itself doesn't have information about encoding. */
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
648 int i;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
649
28766
da7e00e4eaa6 (fs_load_font): By default, use 0x00..0x7f for ASCII.
Kenichi Handa <handa@m17n.org>
parents: 28676
diff changeset
650 fontname = fontp->full_name;
da7e00e4eaa6 (fs_load_font): By default, use 0x00..0x7f for ASCII.
Kenichi Handa <handa@m17n.org>
parents: 28676
diff changeset
651 /* 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
652 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
653 fontp->encoding[0] = 0;
17190
6637001cdb4b Adjusted for the change of MAX_CHARSET.
Kenichi Handa <handa@m17n.org>
parents: 17112
diff changeset
654 for (i = MIN_CHARSET_OFFICIAL_DIMENSION1; i <= MAX_CHARSET; i++)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
655 fontp->encoding[i] = 1;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
656 /* 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
657 for (list = Vfont_encoding_alist; CONSP (list); list = XCDR (list))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
658 {
26164
d39ec0a27081 more XCAR/XCDR/XFLOAT_DATA uses, to help isolete lisp engine
Ken Raeburn <raeburn@raeburn.org>
parents: 25668
diff changeset
659 elt = XCAR (list);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
660 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
661 && 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
662 && (fast_c_string_match_ignore_case (XCAR (elt), fontname)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
663 >= 0))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
664 {
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
665 Lisp_Object tmp;
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 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
668 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
669 && ((i = get_charset_id (XCAR (XCAR (tmp))))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
670 >= 0)
26164
d39ec0a27081 more XCAR/XCDR/XFLOAT_DATA uses, to help isolete lisp engine
Ken Raeburn <raeburn@raeburn.org>
parents: 25668
diff changeset
671 && 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
672 && XFASTINT (XCDR (XCAR (tmp))) < 4)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
673 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
674 = XFASTINT (XCDR (XCAR (tmp)));
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
675 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
676 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
677 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
678
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
679 fontp->font_encoder = (struct ccl_program *) 0;
21553
2d7afcd11b72 (find_ccl_program_func): New variable.
Kenichi Handa <handa@m17n.org>
parents: 21514
diff changeset
680
2d7afcd11b72 (find_ccl_program_func): New variable.
Kenichi Handa <handa@m17n.org>
parents: 21514
diff changeset
681 if (find_ccl_program_func)
2d7afcd11b72 (find_ccl_program_func): New variable.
Kenichi Handa <handa@m17n.org>
parents: 21514
diff changeset
682 (*find_ccl_program_func) (fontp);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
683
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
684 /* 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
685 ID in the fontset for C. */
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
686 if (face
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
687 && !NILP (fontset)
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
688 && !BASE_FONTSET_P (fontset))
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
689 FONTSET_SET (fontset, c, make_number (face->id));
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
690 return fontp;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
691 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
692
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
693
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
694 /* Cache data used by fontset_pattern_regexp. The car part is a
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
695 pattern string containing at least one wild card, the cdr part is
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
696 the corresponding regular expression. */
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
697 static Lisp_Object Vcached_fontset_data;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
698
26164
d39ec0a27081 more XCAR/XCDR/XFLOAT_DATA uses, to help isolete lisp engine
Ken Raeburn <raeburn@raeburn.org>
parents: 25668
diff changeset
699 #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
700 #define CACHED_FONTSET_REGEX (XCDR (Vcached_fontset_data))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
701
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
702 /* If fontset name PATTERN contains any wild card, return regular
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
703 expression corresponding to PATTERN. */
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
704
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
705 static Lisp_Object
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
706 fontset_pattern_regexp (pattern)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
707 Lisp_Object pattern;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
708 {
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
709 if (!index (XSTRING (pattern)->data, '*')
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
710 && !index (XSTRING (pattern)->data, '?'))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
711 /* PATTERN does not contain any wild cards. */
17730
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
712 return Qnil;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
713
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
714 if (!CONSP (Vcached_fontset_data)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
715 || strcmp (XSTRING (pattern)->data, CACHED_FONTSET_NAME))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
716 {
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
717 /* We must at first update the cached data. */
17730
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
718 char *regex = (char *) alloca (XSTRING (pattern)->size * 2);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
719 char *p0, *p1 = regex;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
720
17730
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
721 /* Convert "*" to ".*", "?" to ".". */
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
722 *p1++ = '^';
17827
95010205f916 (fontset_pattern_regexp): Cast to (char *) before
Kenichi Handa <handa@m17n.org>
parents: 17730
diff changeset
723 for (p0 = (char *) XSTRING (pattern)->data; *p0; p0++)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
724 {
17730
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
725 if (*p0 == '*')
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
726 {
17730
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
727 *p1++ = '.';
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
728 *p1++ = '*';
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
729 }
17730
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
730 else if (*p0 == '?')
21127
577865651099 (fontset_pattern_regexp): `==' was used instead of `='.
Richard M. Stallman <rms@gnu.org>
parents: 20346
diff changeset
731 *p1++ = '.';
17730
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
732 else
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
733 *p1++ = *p0;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
734 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
735 *p1++ = '$';
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
736 *p1++ = 0;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
737
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
738 Vcached_fontset_data = Fcons (build_string (XSTRING (pattern)->data),
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
739 build_string (regex));
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
740 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
741
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
742 return CACHED_FONTSET_REGEX;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
743 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
744
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
745 /* 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
746 fontset, return -1. */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
747
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
748 int
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
749 fs_query_fontset (name, regexpp)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
750 Lisp_Object name;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
751 int regexpp;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
752 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
753 Lisp_Object fontset, tem;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
754 int i;
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 name = Fdowncase (name);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
757 if (!regexpp)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
758 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
759 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
760 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
761 name = XCAR (tem);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
762 else
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 tem = fontset_pattern_regexp (name);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
765 if (STRINGP (tem))
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 name = tem;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
768 regexpp = 1;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
769 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
770 }
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
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
773 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
774 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
775 Lisp_Object fontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
776 unsigned char *this_name;
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 fontset = FONTSET_FROM_ID (i);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
779 if (NILP (fontset)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
780 || !BASE_FONTSET_P (fontset))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
781 continue;
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 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
784 if (regexpp
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
785 ? 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
786 : !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
787 return i;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
788 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
789 return -1;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
790 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
791
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
792
21553
2d7afcd11b72 (find_ccl_program_func): New variable.
Kenichi Handa <handa@m17n.org>
parents: 21514
diff changeset
793 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
794 "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
795 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
796 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
797 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
798 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
799 (pattern, regexpp)
2d7afcd11b72 (find_ccl_program_func): New variable.
Kenichi Handa <handa@m17n.org>
parents: 21514
diff changeset
800 Lisp_Object pattern, regexpp;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
801 {
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
802 Lisp_Object fontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
803 int id;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
804
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
805 (*check_window_system_func) ();
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
806
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
807 CHECK_STRING (pattern, 0);
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
808
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
809 if (XSTRING (pattern)->size == 0)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
810 return Qnil;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
811
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
812 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
813 if (id < 0)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
814 return Qnil;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
815
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
816 fontset = FONTSET_FROM_ID (id);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
817 return FONTSET_NAME (fontset);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
818 }
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 /* 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
821 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
822 to be listed. */
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
823
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
824 Lisp_Object
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
825 list_fontsets (f, pattern, size)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
826 FRAME_PTR f;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
827 Lisp_Object pattern;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
828 int size;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
829 {
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
830 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
831 int id;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
832
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
833 XSETFRAME (frame, f);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
834
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
835 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
836 val = Qnil;
17052
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 for (id = 0; id < ASIZE (Vfontset_table); id++)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
839 {
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
840 Lisp_Object fontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
841 unsigned char *name;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
842
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
843 fontset = FONTSET_FROM_ID (id);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
844 if (NILP (fontset)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
845 || !BASE_FONTSET_P (fontset)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
846 || !EQ (frame, FONTSET_FRAME (fontset)))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
847 continue;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
848 name = XSTRING (FONTSET_NAME (fontset))->data;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
849
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
850 if (!NILP (regexp)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
851 ? (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
852 : strcmp (XSTRING (pattern)->data, name))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
853 continue;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
854
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
855 if (size)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
856 {
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
857 struct font_info *fontp;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
858 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
859 if (!fontp || size != fontp->size)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
860 continue;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
861 }
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
862 val = Fcons (Fcopy_sequence (FONTSET_NAME (fontset)), val);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
863 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
864
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
865 return val;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
866 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
867
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
868 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
869 "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
870 FONTLIST is an alist of charsets vs corresponding font name patterns.")
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
871 (name, fontlist)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
872 Lisp_Object name, fontlist;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
873 {
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
874 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
875 Lisp_Object tem, tail, elt;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
876
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
877 (*check_window_system_func) ();
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
878
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
879 CHECK_STRING (name, 0);
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
880 CHECK_LIST (fontlist, 1);
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 name = Fdowncase (name);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
883 tem = Fquery_fontset (name, Qnil);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
884 if (!NILP (tem))
24585
6810d6fb639f (Fquery_fontset): Don't check for fontset aliases here.
Richard M. Stallman <rms@gnu.org>
parents: 23517
diff changeset
885 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
886 XSTRING (name)->data, XSTRING (tem)->data);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
887
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
888 /* 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
889 fontset elements. */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
890 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
891 for (tail = fontlist; CONSP (tail); tail = XCDR (tail))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
892 {
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
893 Lisp_Object family, registry;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
894 int c, charset;
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 tem = XCAR (tail);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
897 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
898 || (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
899 || !STRINGP (XCDR (tem)))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
900 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
901
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
902 tem = Fdowncase (XCDR (tem));
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
903 if (charset == CHARSET_ASCII)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
904 ascii_font = tem;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
905 else
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
906 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
907 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
908 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
909 }
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
910 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
911
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
912 if (NILP (ascii_font))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
913 error ("No ASCII font in the fontlist");
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
914
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
915 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
916 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
917 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
918 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
919 elt = XCAR (elements);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
920 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
921 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
922 }
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
923
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
924 return Qnil;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
925 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
926
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
927
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
928 /* 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
929
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
930 static void
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
931 clear_fontset_elements (fontset)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
932 Lisp_Object fontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
933 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
934 int i;
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 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
937 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
938 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
939
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
940
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
941 /* 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
942 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
943 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
944
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
945 static Lisp_Object
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
946 check_fontset_name (name)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
947 Lisp_Object name;
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 int id;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
950
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
951 if (EQ (name, Qt))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
952 return Vdefault_fontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
953
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
954 CHECK_STRING (name, 0);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
955 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
956 if (id < 0)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
957 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
958 return FONTSET_FROM_ID (id);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
959 }
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
960
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
961 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
962 "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
963 \n\
28676
0a677c35ad99 (Fset_fontset_font): Fix docstring. Local variable
Kenichi Handa <handa@m17n.org>
parents: 28511
diff changeset
964 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
965 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
966 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
967 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
968 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
969 \n\
29233
a09ee5c15dcb (check_registry_encoding): This function deleted.
Kenichi Handa <handa@m17n.org>
parents: 29231
diff changeset
970 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
971 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
972 (name, character, fontname, frame)
0a677c35ad99 (Fset_fontset_font): Fix docstring. Local variable
Kenichi Handa <handa@m17n.org>
parents: 28511
diff changeset
973 Lisp_Object name, character, fontname, frame;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
974 {
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
975 Lisp_Object fontset, elt;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
976 Lisp_Object realized;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
977 int from, to;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
978 int id;
29233
a09ee5c15dcb (check_registry_encoding): This function deleted.
Kenichi Handa <handa@m17n.org>
parents: 29231
diff changeset
979 Lisp_Object family, registry;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
980
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
981 fontset = check_fontset_name (name);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
982
28676
0a677c35ad99 (Fset_fontset_font): Fix docstring. Local variable
Kenichi Handa <handa@m17n.org>
parents: 28511
diff changeset
983 if (CONSP (character))
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
984 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
985 /* 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
986 characters. */
28676
0a677c35ad99 (Fset_fontset_font): Fix docstring. Local variable
Kenichi Handa <handa@m17n.org>
parents: 28511
diff changeset
987 CHECK_NUMBER (XCAR (character), 1);
0a677c35ad99 (Fset_fontset_font): Fix docstring. Local variable
Kenichi Handa <handa@m17n.org>
parents: 28511
diff changeset
988 CHECK_NUMBER (XCDR (character), 1);
0a677c35ad99 (Fset_fontset_font): Fix docstring. Local variable
Kenichi Handa <handa@m17n.org>
parents: 28511
diff changeset
989 from = XINT (XCAR (character));
0a677c35ad99 (Fset_fontset_font): Fix docstring. Local variable
Kenichi Handa <handa@m17n.org>
parents: 28511
diff changeset
990 to = XINT (XCDR (character));
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
991 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
992 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
993 if (!NILP (name)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
994 && (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
995 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
996 }
29501
f901ec87b147 (Fset_fontset_font): The arg CHARACTER may be a charset.
Kenichi Handa <handa@m17n.org>
parents: 29233
diff changeset
997 else if (SYMBOLP (character))
f901ec87b147 (Fset_fontset_font): The arg CHARACTER may be a charset.
Kenichi Handa <handa@m17n.org>
parents: 29233
diff changeset
998 {
f901ec87b147 (Fset_fontset_font): The arg CHARACTER may be a charset.
Kenichi Handa <handa@m17n.org>
parents: 29233
diff changeset
999 elt = Fget (character, Qcharset);
f901ec87b147 (Fset_fontset_font): The arg CHARACTER may be a charset.
Kenichi Handa <handa@m17n.org>
parents: 29233
diff changeset
1000 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
1001 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
1002 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
1003 to = from;
f901ec87b147 (Fset_fontset_font): The arg CHARACTER may be a charset.
Kenichi Handa <handa@m17n.org>
parents: 29233
diff changeset
1004 }
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1005 else
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1006 {
28676
0a677c35ad99 (Fset_fontset_font): Fix docstring. Local variable
Kenichi Handa <handa@m17n.org>
parents: 28511
diff changeset
1007 CHECK_NUMBER (character, 1);
0a677c35ad99 (Fset_fontset_font): Fix docstring. Local variable
Kenichi Handa <handa@m17n.org>
parents: 28511
diff changeset
1008 from = XINT (character);
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1009 to = from;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1010 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1011 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
1012 invalid_character (from);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1013 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
1014 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
1015 if (from < to)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1016 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1017 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
1018 invalid_character (to);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1019 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
1020 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
1021 }
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1022
29233
a09ee5c15dcb (check_registry_encoding): This function deleted.
Kenichi Handa <handa@m17n.org>
parents: 29231
diff changeset
1023 if (STRINGP (fontname))
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1024 {
29233
a09ee5c15dcb (check_registry_encoding): This function deleted.
Kenichi Handa <handa@m17n.org>
parents: 29231
diff changeset
1025 fontname = Fdowncase (fontname);
a09ee5c15dcb (check_registry_encoding): This function deleted.
Kenichi Handa <handa@m17n.org>
parents: 29231
diff changeset
1026 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
1027 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1028 else
29233
a09ee5c15dcb (check_registry_encoding): This function deleted.
Kenichi Handa <handa@m17n.org>
parents: 29231
diff changeset
1029 {
a09ee5c15dcb (check_registry_encoding): This function deleted.
Kenichi Handa <handa@m17n.org>
parents: 29231
diff changeset
1030 CHECK_CONS (fontname, 2);
a09ee5c15dcb (check_registry_encoding): This function deleted.
Kenichi Handa <handa@m17n.org>
parents: 29231
diff changeset
1031 family = XCAR (fontname);
a09ee5c15dcb (check_registry_encoding): This function deleted.
Kenichi Handa <handa@m17n.org>
parents: 29231
diff changeset
1032 registry = XCDR (fontname);
a09ee5c15dcb (check_registry_encoding): This function deleted.
Kenichi Handa <handa@m17n.org>
parents: 29231
diff changeset
1033 if (!NILP (family))
a09ee5c15dcb (check_registry_encoding): This function deleted.
Kenichi Handa <handa@m17n.org>
parents: 29231
diff changeset
1034 CHECK_STRING (family, 2);
a09ee5c15dcb (check_registry_encoding): This function deleted.
Kenichi Handa <handa@m17n.org>
parents: 29231
diff changeset
1035 if (!NILP (registry))
a09ee5c15dcb (check_registry_encoding): This function deleted.
Kenichi Handa <handa@m17n.org>
parents: 29231
diff changeset
1036 CHECK_STRING (registry, 2);
a09ee5c15dcb (check_registry_encoding): This function deleted.
Kenichi Handa <handa@m17n.org>
parents: 29231
diff changeset
1037 elt = Fcons (make_number (from), Fcons (family, registry));
a09ee5c15dcb (check_registry_encoding): This function deleted.
Kenichi Handa <handa@m17n.org>
parents: 29231
diff changeset
1038 }
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1039
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1040 /* 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
1041 the validity. */
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1042 if (!NILP (frame))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1043 CHECK_LIVE_FRAME (frame, 3);
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1044
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1045 for (; from <= to; from++)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1046 FONTSET_SET (fontset, from, elt);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1047 Foptimize_char_table (fontset);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1048
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1049 /* 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
1050 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
1051 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
1052 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
1053 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
1054 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1055 realized = AREF (Vfontset_table, id);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1056 if (!NILP (realized)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1057 && !BASE_FONTSET_P (realized)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1058 && EQ (FONTSET_BASE (realized), fontset))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1059 {
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1060 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
1061 clear_fontset_elements (realized);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1062 free_realized_multibyte_face (f, id);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1063 }
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1064 }
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1065
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1066 return Qnil;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1067 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1068
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1069 DEFUN ("font-info", Ffont_info, Sfont_info, 1, 2, 0,
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1070 "Return information about a font named NAME on frame FRAME.\n\
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1071 If FRAME is omitted or nil, use the selected frame.\n\
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1072 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
1073 HEIGHT, BASELINE-OFFSET, RELATIVE-COMPOSE, and DEFAULT-ASCENT,\n\
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1074 where\n\
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1075 OPENED-NAME is the name used for opening the font,\n\
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1076 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
1077 SIZE is the maximum bound width of the font,\n\
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1078 HEIGHT is the height of the font,\n\
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1079 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
1080 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
1081 how to compose characters.\n\
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1082 If the named font is not yet loaded, return nil.")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1083 (name, frame)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1084 Lisp_Object name, frame;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1085 {
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1086 FRAME_PTR f;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1087 struct font_info *fontp;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1088 Lisp_Object info;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1089
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1090 (*check_window_system_func) ();
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1091
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1092 CHECK_STRING (name, 0);
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1093 name = Fdowncase (name);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1094 if (NILP (frame))
25668
99290b59352d (Ffont_info): Change for Lisp_Object selected_frame.
Gerd Moellmann <gerd@gnu.org>
parents: 24611
diff changeset
1095 frame = selected_frame;
99290b59352d (Ffont_info): Change for Lisp_Object selected_frame.
Gerd Moellmann <gerd@gnu.org>
parents: 24611
diff changeset
1096 CHECK_LIVE_FRAME (frame, 1);
99290b59352d (Ffont_info): Change for Lisp_Object selected_frame.
Gerd Moellmann <gerd@gnu.org>
parents: 24611
diff changeset
1097 f = XFRAME (frame);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1098
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1099 if (!query_font_func)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1100 error ("Font query function is not supported");
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1101
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1102 fontp = (*query_font_func) (f, XSTRING (name)->data);
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1103 if (!fontp)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1104 return Qnil;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1105
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1106 info = Fmake_vector (make_number (7), Qnil);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1107
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1108 XVECTOR (info)->contents[0] = build_string (fontp->name);
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1109 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
1110 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
1111 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
1112 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
1113 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
1114 XVECTOR (info)->contents[6] = make_number (fontp->default_ascent);
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 return info;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1117 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1118
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1119
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1120 /* 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
1121 buffer. This is computed from all the text properties and overlays
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1122 that apply to POSITION. It returns nil in the following cases:
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1123
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1124 (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
1125 it is displayed by an empty box).
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1126
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1127 (2) The character code is invalid.
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1128
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1129 (3) The current buffer is not displayed in any window.
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1130
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1131 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
1132 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
1133 POSITION is currently not visible. */
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
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1136 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
1137 "For internal use only.")
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1138 (position)
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1139 Lisp_Object position;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1140 {
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1141 int pos, pos_byte, dummy;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1142 int face_id;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1143 int c;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1144 Lisp_Object window;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1145 struct window *w;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1146 struct frame *f;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1147 struct face *face;
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 CHECK_NUMBER_COERCE_MARKER (position, 0);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1150 pos = XINT (position);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1151 if (pos < BEGV || pos >= ZV)
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1152 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
1153 pos_byte = CHAR_TO_BYTE (pos);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1154 c = FETCH_CHAR (pos_byte);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1155 if (! CHAR_VALID_P (c, 0))
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1156 return Qnil;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1157 window = Fget_buffer_window (Fcurrent_buffer (), Qt);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1158 if (NILP (window))
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1159 return Qnil;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1160 w = XWINDOW (window);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1161 f = XFRAME (w->frame);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1162 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
1163 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
1164 face = FACE_FROM_ID (f, face_id);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1165 return (face->font && face->font_name
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1166 ? build_string (face->font_name)
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1167 : Qnil);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1168 }
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1169
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1170
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1171 /* 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
1172 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
1173 ARG)' and FONT-INFOs have this form:
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1174 (CHAR FONT-SPEC) or ((FROM . TO) FONT-SPEC)
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1175 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
1176 function add the information of the current leaf to ARG by
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1177 appending a new element or modifying the last element.. */
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 static void
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1180 accumulate_font_info (arg, character, elt)
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1181 Lisp_Object arg, character, elt;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1182 {
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1183 Lisp_Object last, last_char, last_elt, tmp;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1184
29767
c8e5453dc85d (FONTSET_ASCII): Use the first element of char table
Kenichi Handa <handa@m17n.org>
parents: 29501
diff changeset
1185 if (!CONSP (elt) && !SINGLE_BYTE_CHAR_P (XINT (character)))
c8e5453dc85d (FONTSET_ASCII): Use the first element of char table
Kenichi Handa <handa@m17n.org>
parents: 29501
diff changeset
1186 elt = FONTSET_REF (Vdefault_fontset, XINT (character));
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1187 if (!CONSP (elt))
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1188 return;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1189 last = XCAR (arg);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1190 last_char = XCAR (XCAR (last));
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1191 last_elt = XCAR (XCDR (XCAR (last)));
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1192 elt = XCDR (elt);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1193 if (!NILP (Fequal (elt, last_elt)))
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1194 {
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1195 int this_charset = CHAR_CHARSET (XINT (character));
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1196
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1197 if (CONSP (last_char)) /* LAST_CHAR == (FROM . TO) */
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1198 {
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1199 if (this_charset == CHAR_CHARSET (XINT (XCAR (last_char))))
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 XCDR (last_char) = character;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1202 return;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1203 }
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1204 }
29767
c8e5453dc85d (FONTSET_ASCII): Use the first element of char table
Kenichi Handa <handa@m17n.org>
parents: 29501
diff changeset
1205 else if (XINT (last_char) == XINT (character))
c8e5453dc85d (FONTSET_ASCII): Use the first element of char table
Kenichi Handa <handa@m17n.org>
parents: 29501
diff changeset
1206 return;
c8e5453dc85d (FONTSET_ASCII): Use the first element of char table
Kenichi Handa <handa@m17n.org>
parents: 29501
diff changeset
1207 else if (this_charset == CHAR_CHARSET (XINT (last_char)))
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1208 {
29767
c8e5453dc85d (FONTSET_ASCII): Use the first element of char table
Kenichi Handa <handa@m17n.org>
parents: 29501
diff changeset
1209 XCAR (XCAR (last)) = Fcons (last_char, character);
c8e5453dc85d (FONTSET_ASCII): Use the first element of char table
Kenichi Handa <handa@m17n.org>
parents: 29501
diff changeset
1210 return;
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1211 }
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 XCDR (last) = Fcons (Fcons (character, Fcons (elt, Qnil)), Qnil);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1214 XCAR (arg) = XCDR (last);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1215 }
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1216
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1217
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1218 DEFUN ("fontset-info", Ffontset_info, Sfontset_info, 1, 2, 0,
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1219 "Return information about a fontset named NAME on frame FRAME.\n\
30124
26076259e03f (Ffontset_info): Make the return value more compatible
Kenichi Handa <handa@m17n.org>
parents: 29767
diff changeset
1220 The value is a vector:\n\
26076259e03f (Ffontset_info): Make the return value more compatible
Kenichi Handa <handa@m17n.org>
parents: 29767
diff changeset
1221 [ SIZE HEIGHT ((CHARSET-OR-RANGE FONT-SPEC OPENED ...) ...) ],\n\
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1222 where,\n\
30124
26076259e03f (Ffontset_info): Make the return value more compatible
Kenichi Handa <handa@m17n.org>
parents: 29767
diff changeset
1223 SIZE is the maximum bound width of ASCII font in the fontset,\n\
26076259e03f (Ffontset_info): Make the return value more compatible
Kenichi Handa <handa@m17n.org>
parents: 29767
diff changeset
1224 HEIGHT is the maximum bound height of ASCII font in the fontset,\n\
28971
a7bbac783196 (Ffontset_info): ...and another.
Dave Love <fx@gnu.org>
parents: 28970
diff changeset
1225 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
1226 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
1227 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
1228 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
1229 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
1230 FAMILY may contain a `FOUNDARY' field at the head.\n\
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1231 REGISTRY may contain a `CHARSET_ENCODING' field at the tail.\n\
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1232 OPENEDs are names of fonts actually opened.\n\
30124
26076259e03f (Ffontset_info): Make the return value more compatible
Kenichi Handa <handa@m17n.org>
parents: 29767
diff changeset
1233 If the ASCII font is not yet opened, SIZE and HEIGHT are 0.\n\
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1234 If FRAME is omitted, it defaults to the currently selected frame.")
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1235 (name, frame)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1236 Lisp_Object name, frame;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1237 {
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1238 Lisp_Object fontset;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1239 FRAME_PTR f;
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1240 Lisp_Object indices[3];
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1241 Lisp_Object val, tail, elt;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1242 Lisp_Object *realized;
30124
26076259e03f (Ffontset_info): Make the return value more compatible
Kenichi Handa <handa@m17n.org>
parents: 29767
diff changeset
1243 struct font_info *fontp = NULL;
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1244 int n_realized = 0;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1245 int i;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1246
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1247 (*check_window_system_func) ();
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1248
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1249 fontset = check_fontset_name (name);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1250
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1251 if (NILP (frame))
25668
99290b59352d (Ffont_info): Change for Lisp_Object selected_frame.
Gerd Moellmann <gerd@gnu.org>
parents: 24611
diff changeset
1252 frame = selected_frame;
99290b59352d (Ffont_info): Change for Lisp_Object selected_frame.
Gerd Moellmann <gerd@gnu.org>
parents: 24611
diff changeset
1253 CHECK_LIVE_FRAME (frame, 1);
99290b59352d (Ffont_info): Change for Lisp_Object selected_frame.
Gerd Moellmann <gerd@gnu.org>
parents: 24611
diff changeset
1254 f = XFRAME (frame);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1255
29767
c8e5453dc85d (FONTSET_ASCII): Use the first element of char table
Kenichi Handa <handa@m17n.org>
parents: 29501
diff changeset
1256 /* Recode realized fontsets whose base is FONTSET in the table
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1257 `realized'. */
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1258 realized = (Lisp_Object *) alloca (sizeof (Lisp_Object)
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1259 * ASIZE (Vfontset_table));
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1260 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
1261 {
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1262 elt = FONTSET_FROM_ID (i);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1263 if (!NILP (elt)
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1264 && EQ (FONTSET_BASE (elt), fontset))
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1265 realized[n_realized++] = elt;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1266 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1267
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1268 /* Accumulate information of the fontset in VAL. The format is
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1269 (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
1270 FONT-SPEC). See the comment for accumulate_font_info for the
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1271 detail. */
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1272 val = Fcons (Fcons (make_number (0),
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1273 Fcons (XCDR (FONTSET_ASCII (fontset)), Qnil)),
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1274 Qnil);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1275 val = Fcons (val, val);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1276 map_char_table (accumulate_font_info, Qnil, fontset, val, 0, indices);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1277 val = XCDR (val);
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1278
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1279 /* For each FONT-INFO, if CHAR_OR_RANGE (car part) is a generic
29767
c8e5453dc85d (FONTSET_ASCII): Use the first element of char table
Kenichi Handa <handa@m17n.org>
parents: 29501
diff changeset
1280 character for a charset, replace it with the charset symbol. If
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1281 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
1282 FONT-SPEC. */
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1283 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
1284 {
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1285 int c;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1286 elt = XCAR (tail);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1287 if (INTEGERP (XCAR (elt)))
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 charset, c1, c2;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1290 c = XINT (XCAR (elt));
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1291 SPLIT_CHAR (c, charset, c1, c2);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1292 if (c1 == 0)
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1293 XCAR (elt) = CHARSET_SYMBOL (charset);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1294 }
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1295 else
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1296 c = XINT (XCAR (XCAR (elt)));
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1297 for (i = 0; i < n_realized; i++)
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 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
1300 struct face *face;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1301
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1302 face_id = FONTSET_REF_VIA_BASE (realized[i], c);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1303 if (INTEGERP (face_id))
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1304 {
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1305 face = FACE_FROM_ID (f, XINT (face_id));
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1306 if (face->font && face->font_name)
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1307 {
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1308 font = build_string (face->font_name);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1309 if (NILP (Fmember (font, XCDR (XCDR (elt)))))
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1310 XCDR (XCDR (elt)) = Fcons (font, XCDR (XCDR (elt)));
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1311 }
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1312 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1313 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1314 }
30124
26076259e03f (Ffontset_info): Make the return value more compatible
Kenichi Handa <handa@m17n.org>
parents: 29767
diff changeset
1315
26076259e03f (Ffontset_info): Make the return value more compatible
Kenichi Handa <handa@m17n.org>
parents: 29767
diff changeset
1316 elt = Fcdr (Fcdr (Fassq (CHARSET_SYMBOL (CHARSET_ASCII), val)));
26076259e03f (Ffontset_info): Make the return value more compatible
Kenichi Handa <handa@m17n.org>
parents: 29767
diff changeset
1317 if (CONSP (elt))
26076259e03f (Ffontset_info): Make the return value more compatible
Kenichi Handa <handa@m17n.org>
parents: 29767
diff changeset
1318 {
26076259e03f (Ffontset_info): Make the return value more compatible
Kenichi Handa <handa@m17n.org>
parents: 29767
diff changeset
1319 elt = XCAR (elt);
26076259e03f (Ffontset_info): Make the return value more compatible
Kenichi Handa <handa@m17n.org>
parents: 29767
diff changeset
1320 fontp = (*query_font_func) (f, XSTRING (elt)->data);
26076259e03f (Ffontset_info): Make the return value more compatible
Kenichi Handa <handa@m17n.org>
parents: 29767
diff changeset
1321 }
26076259e03f (Ffontset_info): Make the return value more compatible
Kenichi Handa <handa@m17n.org>
parents: 29767
diff changeset
1322 val = Fmake_vector (make_number (3), val);
26076259e03f (Ffontset_info): Make the return value more compatible
Kenichi Handa <handa@m17n.org>
parents: 29767
diff changeset
1323 AREF (val, 0) = fontp ? make_number (fontp->size) : make_number (0);
26076259e03f (Ffontset_info): Make the return value more compatible
Kenichi Handa <handa@m17n.org>
parents: 29767
diff changeset
1324 AREF (val, 1) = fontp ? make_number (fontp->height) : make_number (0);
26076259e03f (Ffontset_info): Make the return value more compatible
Kenichi Handa <handa@m17n.org>
parents: 29767
diff changeset
1325 return val;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1326 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1327
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1328 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
1329 "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
1330 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
1331 (name, ch)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1332 Lisp_Object name, ch;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1333 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1334 int c, id;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1335 Lisp_Object fontset, elt;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1336
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1337 fontset = check_fontset_name (name);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1338
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1339 CHECK_NUMBER (ch, 1);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1340 c = XINT (ch);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1341 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
1342 invalid_character (c);
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 elt = FONTSET_REF (fontset, c);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1345 if (CONSP (elt))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1346 elt = XCDR (elt);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1347
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1348 return elt;
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
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1351
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1352 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
1353 "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
1354 ()
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 Lisp_Object fontset, list;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1357 int i;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1358
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1359 list = Qnil;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1360 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
1361 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1362 fontset = FONTSET_FROM_ID (i);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1363 if (!NILP (fontset)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1364 && BASE_FONTSET_P (fontset))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1365 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
1366 }
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1367
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1368 return list;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1369 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1370
21514
fa9ff387d260 Fix -Wimplicit warnings.
Andreas Schwab <schwab@suse.de>
parents: 21127
diff changeset
1371 void
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1372 syms_of_fontset ()
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1373 {
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1374 int i;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1375
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1376 if (!load_font_func)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1377 /* Window system initializer should have set proper functions. */
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1378 abort ();
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1379
17112
5c48ff325655 (syms_of_fontset): Intern Qfontset. Declare new lisp
Kenichi Handa <handa@m17n.org>
parents: 17071
diff changeset
1380 Qfontset = intern ("fontset");
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1381 staticpro (&Qfontset);
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1382 Fput (Qfontset, Qchar_table_extra_slots, make_number (3));
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1383
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1384 Vcached_fontset_data = Qnil;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1385 staticpro (&Vcached_fontset_data);
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1386
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1387 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
1388 staticpro (&Vfontset_table);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1389
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1390 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
1391 staticpro (&Vdefault_fontset);
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1392 FONTSET_ID (Vdefault_fontset) = make_number (0);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1393 FONTSET_NAME (Vdefault_fontset)
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1394 = build_string ("-*-*-*-*-*-*-*-*-*-*-*-*-fontset-default");
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1395 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
1396 = Fcons (make_number (0),
3c444d185d31 (syms_of_fontset): Adjust the font name for ascii of
Kenichi Handa <handa@m17n.org>
parents: 29011
diff changeset
1397 build_string ("-adobe-courier-medium-r-*-*-*-120-*-*-*-*-iso8859-1"));
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1398 AREF (Vfontset_table, 0) = Vdefault_fontset;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1399 next_fontset_id = 1;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1400
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1401 DEFVAR_LISP ("font-encoding-alist", &Vfont_encoding_alist,
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1402 "Alist of fontname patterns vs corresponding encoding info.\n\
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1403 Each element looks like (REGEXP . ENCODING-INFO),\n\
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1404 where ENCODING-INFO is an alist of CHARSET vs ENCODING.\n\
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1405 ENCODING is one of the following integer values:\n\
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1406 0: code points 0x20..0x7F or 0x2020..0x7F7F are used,\n\
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1407 1: code points 0xA0..0xFF or 0xA0A0..0xFFFF are used,\n\
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1408 2: code points 0x20A0..0x7FFF are used,\n\
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1409 3: code points 0xA020..0xFF7F are used.");
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1410 Vfont_encoding_alist = Qnil;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1411
17112
5c48ff325655 (syms_of_fontset): Intern Qfontset. Declare new lisp
Kenichi Handa <handa@m17n.org>
parents: 17071
diff changeset
1412 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
1413 "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
1414 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
1415 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
1416 \n\
09a1536debb4 (Vignore_relative_composition): New variable.
Kenichi Handa <handa@m17n.org>
parents: 19172
diff changeset
1417 This affects how a composite character which contains\n\
09a1536debb4 (Vignore_relative_composition): New variable.
Kenichi Handa <handa@m17n.org>
parents: 19172
diff changeset
1418 such a character is displayed on screen.");
09a1536debb4 (Vignore_relative_composition): New variable.
Kenichi Handa <handa@m17n.org>
parents: 19172
diff changeset
1419 Vuse_default_ascent = Qnil;
09a1536debb4 (Vignore_relative_composition): New variable.
Kenichi Handa <handa@m17n.org>
parents: 19172
diff changeset
1420
09a1536debb4 (Vignore_relative_composition): New variable.
Kenichi Handa <handa@m17n.org>
parents: 19172
diff changeset
1421 DEFVAR_LISP ("ignore-relative-composition", &Vignore_relative_composition,
09a1536debb4 (Vignore_relative_composition): New variable.
Kenichi Handa <handa@m17n.org>
parents: 19172
diff changeset
1422 "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
1423 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
1424 which contains that character is displayed so that\n\
09a1536debb4 (Vignore_relative_composition): New variable.
Kenichi Handa <handa@m17n.org>
parents: 19172
diff changeset
1425 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
1426 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
1427 Vignore_relative_composition = Qnil;
17112
5c48ff325655 (syms_of_fontset): Intern Qfontset. Declare new lisp
Kenichi Handa <handa@m17n.org>
parents: 17071
diff changeset
1428
19450
895dc2520755 (Valternate_fontname_alist): Name changed from
Kenichi Handa <handa@m17n.org>
parents: 19282
diff changeset
1429 DEFVAR_LISP ("alternate-fontname-alist", &Valternate_fontname_alist,
895dc2520755 (Valternate_fontname_alist): Name changed from
Kenichi Handa <handa@m17n.org>
parents: 19282
diff changeset
1430 "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
1431 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
1432 alternate fontnames (if any) are tried instead.");
895dc2520755 (Valternate_fontname_alist): Name changed from
Kenichi Handa <handa@m17n.org>
parents: 19282
diff changeset
1433 Valternate_fontname_alist = Qnil;
17193
dc4562b0152a (Valternative_fontname_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17190
diff changeset
1434
17730
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
1435 DEFVAR_LISP ("fontset-alias-alist", &Vfontset_alias_alist,
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
1436 "Alist of fontset names vs the aliases.");
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1437 Vfontset_alias_alist = Fcons (Fcons (FONTSET_NAME (Vdefault_fontset),
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1438 build_string ("fontset-default")),
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1439 Qnil);
17730
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
1440
17331
f91b4d582897 (Vhighlight_wrong_size_font, Vclip_large_size_font):
Kenichi Handa <handa@m17n.org>
parents: 17193
diff changeset
1441 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
1442 "*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
1443 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
1444 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
1445 Vhighlight_wrong_size_font = Qnil;
17331
f91b4d582897 (Vhighlight_wrong_size_font, Vclip_large_size_font):
Kenichi Handa <handa@m17n.org>
parents: 17193
diff changeset
1446
f91b4d582897 (Vhighlight_wrong_size_font, Vclip_large_size_font):
Kenichi Handa <handa@m17n.org>
parents: 17193
diff changeset
1447 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
1448 "*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
1449 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
1450 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
1451 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
1452 \n\
19172
f3580f4e3587 (syms_of_fontset): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 18976
diff changeset
1453 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
1454 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
1455 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
1456 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
1457 Vclip_large_size_font = Qt;
f91b4d582897 (Vhighlight_wrong_size_font, Vclip_large_size_font):
Kenichi Handa <handa@m17n.org>
parents: 17193
diff changeset
1458
26858
7cc081b4e084 (Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents: 26164
diff changeset
1459 DEFVAR_LISP ("vertical-centering-font-regexp",
7cc081b4e084 (Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents: 26164
diff changeset
1460 &Vvertical_centering_font_regexp,
7cc081b4e084 (Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents: 26164
diff changeset
1461 "*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
1462 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
1463 at the vertival center of lines.");
7cc081b4e084 (Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents: 26164
diff changeset
1464 Vvertical_centering_font_regexp = Qnil;
7cc081b4e084 (Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents: 26164
diff changeset
1465
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1466 defsubr (&Squery_fontset);
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1467 defsubr (&Snew_fontset);
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1468 defsubr (&Sset_fontset_font);
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1469 defsubr (&Sfont_info);
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1470 defsubr (&Sinternal_char_font);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1471 defsubr (&Sfontset_info);
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1472 defsubr (&Sfontset_font);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1473 defsubr (&Sfontset_list);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1474 }