annotate src/fontset.c @ 93326:e430e106fa7b

(emacs-lisp-mode-map): Fix predicate.
author Dan Nicolaescu <dann@ics.uci.edu>
date Thu, 27 Mar 2008 22:15:54 +0000
parents e9a2a0f6094f
children a9ee82808208
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.
79759
fc2bcd2a8aad Add 2008 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 78501
diff changeset
2 Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
75227
e90d04cd455a Update copyright for years from Emacs 21 to present (mainly adding
Glenn Morris <rgm@gnu.org>
parents: 74605
diff changeset
3 Free Software Foundation, Inc.
74605
6ee41fdd69ff Update AIST copyright years.
Kenichi Handa <handa@m17n.org>
parents: 71605
diff changeset
4 Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
79759
fc2bcd2a8aad Add 2008 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 78501
diff changeset
5 2005, 2006, 2007, 2008
67658
547f2b420666 Copyright fixed
Kenichi Handa <handa@m17n.org>
parents: 64770
diff changeset
6 National Institute of Advanced Industrial Science and Technology (AIST)
547f2b420666 Copyright fixed
Kenichi Handa <handa@m17n.org>
parents: 64770
diff changeset
7 Registration Number H14PRO021
90410
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
8 Copyright (C) 2003, 2006
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
9 National Institute of Advanced Industrial Science and Technology (AIST)
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
10 Registration Number H13PRO009
90261
7beb78bc1f8e Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-97
Miles Bader <miles@gnu.org>
parents: 90224 67658
diff changeset
11
17071
70194012fb3a Fix FSF address in comment.
Karl Heuer <kwzh@gnu.org>
parents: 17052
diff changeset
12 This file is part of GNU Emacs.
70194012fb3a Fix FSF address in comment.
Karl Heuer <kwzh@gnu.org>
parents: 17052
diff changeset
13
70194012fb3a Fix FSF address in comment.
Karl Heuer <kwzh@gnu.org>
parents: 17052
diff changeset
14 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
15 it under the terms of the GNU General Public License as published by
78313
2b9404c2f01f Remove license from trivial file.
Glenn Morris <rgm@gnu.org>
parents: 75364
diff changeset
16 the Free Software Foundation; either version 3, or (at your option)
17071
70194012fb3a Fix FSF address in comment.
Karl Heuer <kwzh@gnu.org>
parents: 17052
diff changeset
17 any later version.
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
18
17071
70194012fb3a Fix FSF address in comment.
Karl Heuer <kwzh@gnu.org>
parents: 17052
diff changeset
19 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
20 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
21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
70194012fb3a Fix FSF address in comment.
Karl Heuer <kwzh@gnu.org>
parents: 17052
diff changeset
22 GNU General Public License for more details.
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
23
17071
70194012fb3a Fix FSF address in comment.
Karl Heuer <kwzh@gnu.org>
parents: 17052
diff changeset
24 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
25 along with GNU Emacs; see the file COPYING. If not, write to
64084
a8fa7c632ee4 Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 61823
diff changeset
26 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
a8fa7c632ee4 Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 61823
diff changeset
27 Boston, MA 02110-1301, USA. */
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
28
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
29 /* #define FONTSET_DEBUG */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
30
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
31 #include <config.h>
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
32
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
33 #ifdef FONTSET_DEBUG
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
34 #include <stdio.h>
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
35 #endif
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
36
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
37 #include "lisp.h"
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
38 #include "blockinput.h"
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
39 #include "buffer.h"
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
40 #include "character.h"
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
41 #include "charset.h"
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
42 #include "ccl.h"
31102
6a0caa788013 Include keyboard.h before frame.h.
Andrew Innes <andrewi@gnu.org>
parents: 30941
diff changeset
43 #include "keyboard.h"
23517
73f09e7bc96e Include frame.h before fontset.h.
Kenichi Handa <handa@m17n.org>
parents: 22719
diff changeset
44 #include "frame.h"
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
45 #include "dispextern.h"
89865
d2b1cc2ef7f1 Include "intervals.h".
Kenichi Handa <handa@m17n.org>
parents: 89826
diff changeset
46 #include "intervals.h"
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
47 #include "fontset.h"
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
48 #include "window.h"
52654
2e5944e29aa0 (Finternal_char_font): Change return value to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
49 #ifdef HAVE_X_WINDOWS
2e5944e29aa0 (Finternal_char_font): Change return value to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
50 #include "xterm.h"
2e5944e29aa0 (Finternal_char_font): Change return value to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
51 #endif
2e5944e29aa0 (Finternal_char_font): Change return value to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
52 #ifdef WINDOWSNT
2e5944e29aa0 (Finternal_char_font): Change return value to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
53 #include "w32term.h"
2e5944e29aa0 (Finternal_char_font): Change return value to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
54 #endif
2e5944e29aa0 (Finternal_char_font): Change return value to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
55 #ifdef MAC_OS
2e5944e29aa0 (Finternal_char_font): Change return value to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
56 #include "macterm.h"
2e5944e29aa0 (Finternal_char_font): Change return value to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
57 #endif
82992
5de4189e659d Got rid of the rif (window-based redisplay interface) global variable.
Karoly Lorentey <lorentey@elte.hu>
parents: 53353
diff changeset
58 #include "termhooks.h"
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
59
90410
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
60 #include "font.h"
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
61
89483
2f877ed80fa6 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88123 89428
diff changeset
62 #undef xassert
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
63 #ifdef FONTSET_DEBUG
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
64 #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
65 #undef INLINE
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
66 #define INLINE
89483
2f877ed80fa6 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88123 89428
diff changeset
67 #else /* not FONTSET_DEBUG */
2f877ed80fa6 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88123 89428
diff changeset
68 #define xassert(X) (void) 0
2f877ed80fa6 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88123 89428
diff changeset
69 #endif /* not FONTSET_DEBUG */
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
70
88546
7471723e43b0 (Fclear_face_cache): Declare.
Dave Love <fx@gnu.org>
parents: 88500
diff changeset
71 EXFUN (Fclear_face_cache, 1);
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
72
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
73 /* FONTSET
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 A fontset is a collection of font related information to give
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
76 similar appearance (style, etc) of characters. A fontset has two
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
77 roles. One is to use for the frame parameter `font' as if it is an
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
78 ASCII font. In that case, Emacs uses the font specified for
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
79 `ascii' script for the frame's default font.
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
80
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
81 Another role, the more important one, is to provide information
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
82 about which font to use for each non-ASCII character.
41987
34952771ae85 Fix typos, remove unnecessary space.
Pavel Janík <Pavel@Janik.cz>
parents: 41052
diff changeset
83
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
84 There are two kinds of fontsets; base and realized. A base fontset
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
85 is created by `new-fontset' from Emacs Lisp explicitly. A realized
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
86 fontset is created implicitly when a face is realized for ASCII
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
87 characters. A face is also realized for non-ASCII characters based
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
88 on an ASCII face. All of non-ASCII faces based on the same ASCII
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
89 face share the same realized fontset.
89483
2f877ed80fa6 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88123 89428
diff changeset
90
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
91 A fontset object is implemented by a char-table whose default value
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
92 and parent are always nil.
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
93
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
94 An element of a base fontset is a vector of FONT-DEFs which itself
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
95 is a vector [ FONT-SPEC ENCODING REPERTORY ].
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
96
91169
8eb408860621 Include "font.h" unconditionally.
Kenichi Handa <handa@m17n.org>
parents: 91136
diff changeset
97 FONT-SPEC is a font-spec created by `font-spec' or
8eb408860621 Include "font.h" unconditionally.
Kenichi Handa <handa@m17n.org>
parents: 91136
diff changeset
98 ( FAMILY . REGISTRY )
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
99 or
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
100 FONT-NAME
91169
8eb408860621 Include "font.h" unconditionally.
Kenichi Handa <handa@m17n.org>
parents: 91136
diff changeset
101 where FAMILY, REGISTRY, and FONT-NAME are strings.
89898
0167306cb580 (fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents: 89865
diff changeset
102
89826
b17725d55ba2 (Fset_fontset_font): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents: 89811
diff changeset
103 ENCODING is a charset ID that can convert characters to glyph codes
b17725d55ba2 (Fset_fontset_font): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents: 89811
diff changeset
104 of the corresponding font.
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
105
89826
b17725d55ba2 (Fset_fontset_font): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents: 89811
diff changeset
106 REPERTORY is a charset ID, a char-table, or nil. If REPERTORY is a
b17725d55ba2 (Fset_fontset_font): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents: 89811
diff changeset
107 charset ID, the repertory of the charset exactly matches with that
b17725d55ba2 (Fset_fontset_font): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents: 89811
diff changeset
108 of the font. If REPERTORY is a char-table, all characters who have
b17725d55ba2 (Fset_fontset_font): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents: 89811
diff changeset
109 a non-nil value in the table are supported. If REPERTORY is nil,
b17725d55ba2 (Fset_fontset_font): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents: 89811
diff changeset
110 we consult with the font itself to get the repertory.
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
111
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
112 ENCODING and REPERTORY are extracted from the variable
89826
b17725d55ba2 (Fset_fontset_font): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents: 89811
diff changeset
113 Vfont_encoding_alist by using a font name generated from FONT-SPEC
89898
0167306cb580 (fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents: 89865
diff changeset
114 (if it is a vector) or FONT-NAME as a matching target.
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
115
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
116
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
117 An element of a realized fontset is nil or t, or has this form:
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
118
91231
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
119 [CHARSET-ORDERED-LIST-TICK PREFERRED-CHARSET-ID PREFERRED-FAMILY
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
120 RFONT-DEF0 RFONT-DEF1 ...].
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
121
89898
0167306cb580 (fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents: 89865
diff changeset
122 RFONT-DEFn (i.e. Realized FONT-DEF) has this form:
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
123
89898
0167306cb580 (fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents: 89865
diff changeset
124 [ FACE-ID FONT-INDEX FONT-DEF OPENED-FONT-NAME ]
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
125
89898
0167306cb580 (fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents: 89865
diff changeset
126 RFONT-DEFn is automatically reordered by the current charset
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
127 priority list.
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
128
89898
0167306cb580 (fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents: 89865
diff changeset
129 The value nil means that we have not yet generated the above vector
0167306cb580 (fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents: 89865
diff changeset
130 from the base of the fontset.
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
131
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
132 The value t means that no font is available for the corresponding
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
133 range of characters.
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
134
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
135
89805
35a0a24752d3 (FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents: 89711
diff changeset
136 A fontset has 9 extra slots.
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
137
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
138 The 1st slot: the ID number of the fontset
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
139
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
140 The 2nd slot:
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
141 base: the name of the fontset
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
142 realized: nil
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
143
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
144 The 3rd slot:
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
145 base: nil
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
146 realized: the base fontset
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
147
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
148 The 4th slot:
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
149 base: nil
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
150 realized: the frame that the fontset belongs to
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
151
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
152 The 5th slot:
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
153 base: the font name for ASCII characters
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
154 realized: nil
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
155
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
156 The 6th slot:
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
157 base: nil
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
158 realized: the ID number of a face to use for characters that
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
159 has no font in a realized fontset.
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
160
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
161 The 7th slot:
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
162 base: nil
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
163 realized: Alist of font index vs the corresponding repertory
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
164 char-table.
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
165
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
166 The 8th slot:
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
167 base: nil
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
168 realized: If the base is not the default fontset, a fontset
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
169 realized from the default fontset, else nil.
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
170
89805
35a0a24752d3 (FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents: 89711
diff changeset
171 The 9th slot:
89811
d13626b05df3 (fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents: 89805
diff changeset
172 base: Same as element value (but for fallback fonts).
d13626b05df3 (fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents: 89805
diff changeset
173 realized: Likewise.
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
174
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
175 All fontsets are recorded in the vector Vfontset_table.
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
176
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
177
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
178 DEFAULT FONTSET
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
179
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
180 There's a special base fontset named `default fontset' which
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
181 defines the default font specifications. When a base fontset
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
182 doesn't specify a font for a specific character, the corresponding
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
183 value in the default fontset is used.
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
184
30398
dde5ab185aad (fontset_ref): Remove INLINE declaration.
Kenichi Handa <handa@m17n.org>
parents: 30172
diff changeset
185 The parent of a realized fontset created for such a face that has
dde5ab185aad (fontset_ref): Remove INLINE declaration.
Kenichi Handa <handa@m17n.org>
parents: 30172
diff changeset
186 no fontset is the default fontset.
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
187
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
188
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
189 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
190 The other codes handle fontsets only by their ID numbers. They
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
191 usually use the variable name `fontset' for IDs. But, in this
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
192 file, we always use varialbe name `id' for IDs, and name `fontset'
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
193 for an actual fontset object, i.e., char-table.
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
194
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
195 */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
196
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
197 /********** VARIABLES and FUNCTION PROTOTYPES **********/
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
198
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
199 extern Lisp_Object Qfont;
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
200 static Lisp_Object Qfontset;
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
201 static Lisp_Object Qfontset_info;
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
202 static Lisp_Object Qprepend, Qappend;
90642
92baf98563e4 (Qlatin): New variable.
Kenichi Handa <handa@m17n.org>
parents: 90509
diff changeset
203 static Lisp_Object Qlatin;
28223
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 /* Vector containing all fontsets. */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
206 static Lisp_Object Vfontset_table;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
207
41987
34952771ae85 Fix typos, remove unnecessary space.
Pavel Janík <Pavel@Janik.cz>
parents: 41052
diff changeset
208 /* Next possibly free fontset ID. Usually this keeps the minimum
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
209 fontset ID not yet used. */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
210 static int next_fontset_id;
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 /* The default fontset. This gives default FAMILY and REGISTRY of
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
213 font for each character. */
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
214 static Lisp_Object Vdefault_fontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
215
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
216 Lisp_Object Vfont_encoding_alist;
91266
3cd59392b3ec (Vfont_encoding_charset_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 91250
diff changeset
217 Lisp_Object Vfont_encoding_charset_alist;
17112
5c48ff325655 (syms_of_fontset): Intern Qfontset. Declare new lisp
Kenichi Handa <handa@m17n.org>
parents: 17071
diff changeset
218 Lisp_Object Vuse_default_ascent;
19282
09a1536debb4 (Vignore_relative_composition): New variable.
Kenichi Handa <handa@m17n.org>
parents: 19172
diff changeset
219 Lisp_Object Vignore_relative_composition;
19450
895dc2520755 (Valternate_fontname_alist): Name changed from
Kenichi Handa <handa@m17n.org>
parents: 19282
diff changeset
220 Lisp_Object Valternate_fontname_alist;
17730
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
221 Lisp_Object Vfontset_alias_alist;
26858
7cc081b4e084 (Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents: 26164
diff changeset
222 Lisp_Object Vvertical_centering_font_regexp;
90509
c1ec6b950928 (Votf_script_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 90475
diff changeset
223 Lisp_Object Votf_script_alist;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
224
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
225 /* 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
226 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
227 detail. */
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
228
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
229 /* 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
230 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
231
41987
34952771ae85 Fix typos, remove unnecessary space.
Pavel Janík <Pavel@Janik.cz>
parents: 41052
diff changeset
232 /* Return a list of font names which matches PATTERN. See the documentation
34952771ae85 Fix typos, remove unnecessary space.
Pavel Janík <Pavel@Janik.cz>
parents: 41052
diff changeset
233 of `x-list-fonts' for more details. */
23517
73f09e7bc96e Include frame.h before fontset.h.
Kenichi Handa <handa@m17n.org>
parents: 22719
diff changeset
234 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
235 Lisp_Object pattern,
73f09e7bc96e Include frame.h before fontset.h.
Kenichi Handa <handa@m17n.org>
parents: 22719
diff changeset
236 int size,
73f09e7bc96e Include frame.h before fontset.h.
Kenichi Handa <handa@m17n.org>
parents: 22719
diff changeset
237 int maxnames));
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
238
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
239 /* 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
240 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
241 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
242
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
243 /* 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
244 struct font_info *(*query_font_func) P_ ((FRAME_PTR f, char *name));
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
245
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
246 /* Additional function for setting fontset or changing fontset
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
247 contents of frame F. */
20315
931b4ddf7966 Protoize functions declarations.
Andreas Schwab <schwab@suse.de>
parents: 19450
diff changeset
248 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
249 Lisp_Object oldval));
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
250
21553
2d7afcd11b72 (find_ccl_program_func): New variable.
Kenichi Handa <handa@m17n.org>
parents: 21514
diff changeset
251 /* 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
252 The argument is a pointer to the struct font_info.
41987
34952771ae85 Fix typos, remove unnecessary space.
Pavel Janík <Pavel@Janik.cz>
parents: 41052
diff changeset
253 This function set the member `encoder' of the structure. */
21553
2d7afcd11b72 (find_ccl_program_func): New variable.
Kenichi Handa <handa@m17n.org>
parents: 21514
diff changeset
254 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
255
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
256 Lisp_Object (*get_font_repertory_func) P_ ((struct frame *,
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
257 struct font_info *));
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
258
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
259 /* Check if any window system is used now. */
20315
931b4ddf7966 Protoize functions declarations.
Andreas Schwab <schwab@suse.de>
parents: 19450
diff changeset
260 void (*check_window_system_func) P_ ((void));
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
261
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
262
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
263 /* Prototype declarations for static functions. */
89069
c2201502f37e (fontset_add): Return Lisp_Object.
Dave Love <fx@gnu.org>
parents: 89006
diff changeset
264 static Lisp_Object fontset_add P_ ((Lisp_Object, Lisp_Object, Lisp_Object,
c2201502f37e (fontset_add): Return Lisp_Object.
Dave Love <fx@gnu.org>
parents: 89006
diff changeset
265 Lisp_Object));
91231
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
266 static void reorder_font_vector P_ ((Lisp_Object, int, Lisp_Object));
89898
0167306cb580 (fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents: 89865
diff changeset
267 static Lisp_Object fontset_font P_ ((Lisp_Object, int, struct face *, int));
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
268 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
269 static Lisp_Object fontset_pattern_regexp P_ ((Lisp_Object));
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
270 static void accumulate_script_ranges P_ ((Lisp_Object, Lisp_Object,
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
271 Lisp_Object));
90410
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
272 Lisp_Object find_font_encoding P_ ((Lisp_Object));
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
273
89614
355fc0282e50 (set_fontset_font): New function.
Kenichi Handa <handa@m17n.org>
parents: 89610
diff changeset
274 static void set_fontset_font P_ ((Lisp_Object, Lisp_Object));
355fc0282e50 (set_fontset_font): New function.
Kenichi Handa <handa@m17n.org>
parents: 89610
diff changeset
275
88982
d50b0a9ea97a (fontset_add): Make the type `int'.
Kenichi Handa <handa@m17n.org>
parents: 88968
diff changeset
276 #ifdef FONTSET_DEBUG
d50b0a9ea97a (fontset_add): Make the type `int'.
Kenichi Handa <handa@m17n.org>
parents: 88968
diff changeset
277
d50b0a9ea97a (fontset_add): Make the type `int'.
Kenichi Handa <handa@m17n.org>
parents: 88968
diff changeset
278 /* Return 1 if ID is a valid fontset id, else return 0. */
d50b0a9ea97a (fontset_add): Make the type `int'.
Kenichi Handa <handa@m17n.org>
parents: 88968
diff changeset
279
d50b0a9ea97a (fontset_add): Make the type `int'.
Kenichi Handa <handa@m17n.org>
parents: 88968
diff changeset
280 static int
d50b0a9ea97a (fontset_add): Make the type `int'.
Kenichi Handa <handa@m17n.org>
parents: 88968
diff changeset
281 fontset_id_valid_p (id)
d50b0a9ea97a (fontset_add): Make the type `int'.
Kenichi Handa <handa@m17n.org>
parents: 88968
diff changeset
282 int id;
d50b0a9ea97a (fontset_add): Make the type `int'.
Kenichi Handa <handa@m17n.org>
parents: 88968
diff changeset
283 {
d50b0a9ea97a (fontset_add): Make the type `int'.
Kenichi Handa <handa@m17n.org>
parents: 88968
diff changeset
284 return (id >= 0 && id < ASIZE (Vfontset_table) - 1);
d50b0a9ea97a (fontset_add): Make the type `int'.
Kenichi Handa <handa@m17n.org>
parents: 88968
diff changeset
285 }
d50b0a9ea97a (fontset_add): Make the type `int'.
Kenichi Handa <handa@m17n.org>
parents: 88968
diff changeset
286
d50b0a9ea97a (fontset_add): Make the type `int'.
Kenichi Handa <handa@m17n.org>
parents: 88968
diff changeset
287 #endif
d50b0a9ea97a (fontset_add): Make the type `int'.
Kenichi Handa <handa@m17n.org>
parents: 88968
diff changeset
288
28223
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
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
291 /********** 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
292
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
293 /* 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
294 #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
295
30398
dde5ab185aad (fontset_ref): Remove INLINE declaration.
Kenichi Handa <handa@m17n.org>
parents: 30172
diff changeset
296 /* Macros to access special values of FONTSET. */
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
297 #define FONTSET_ID(fontset) XCHAR_TABLE (fontset)->extras[0]
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
298
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
299 /* Macros to access special values of (base) FONTSET. */
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
300 #define FONTSET_NAME(fontset) XCHAR_TABLE (fontset)->extras[1]
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
301 #define FONTSET_ASCII(fontset) XCHAR_TABLE (fontset)->extras[4]
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
302
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
303 /* Macros to access special values of (realized) FONTSET. */
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
304 #define FONTSET_BASE(fontset) XCHAR_TABLE (fontset)->extras[2]
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
305 #define FONTSET_FRAME(fontset) XCHAR_TABLE (fontset)->extras[3]
91908
6916adc8df33 (FONTSET_OBJLIST): New macro.
Kenichi Handa <handa@m17n.org>
parents: 91887
diff changeset
306 #define FONTSET_OBJLIST(fontset) XCHAR_TABLE (fontset)->extras[4]
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
307 #define FONTSET_NOFONT_FACE(fontset) XCHAR_TABLE (fontset)->extras[5]
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
308 #define FONTSET_REPERTORY(fontset) XCHAR_TABLE (fontset)->extras[6]
89805
35a0a24752d3 (FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents: 89711
diff changeset
309 #define FONTSET_DEFAULT(fontset) XCHAR_TABLE (fontset)->extras[7]
35a0a24752d3 (FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents: 89711
diff changeset
310
89811
d13626b05df3 (fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents: 89805
diff changeset
311 /* For both base and realized fontset. */
89805
35a0a24752d3 (FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents: 89711
diff changeset
312 #define FONTSET_FALLBACK(fontset) XCHAR_TABLE (fontset)->extras[8]
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
313
89428
eed327e0bad3 (BASE_FONTSET_P): Check FONTSET_BASE, not
Kenichi Handa <handa@m17n.org>
parents: 89349
diff changeset
314 #define BASE_FONTSET_P(fontset) (NILP (FONTSET_BASE (fontset)))
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
315
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
316
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
317 /* Return the element of FONTSET for the character C. If FONTSET is a
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
318 base fontset other then the default fontset and FONTSET doesn't
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
319 contain information for C, return the information in the default
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
320 fontset. */
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
321
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
322 #define FONTSET_REF(fontset, c) \
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
323 (EQ (fontset, Vdefault_fontset) \
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
324 ? CHAR_TABLE_REF (fontset, c) \
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
325 : fontset_ref ((fontset), (c)))
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
326
30398
dde5ab185aad (fontset_ref): Remove INLINE declaration.
Kenichi Handa <handa@m17n.org>
parents: 30172
diff changeset
327 static Lisp_Object
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
328 fontset_ref (fontset, c)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
329 Lisp_Object fontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
330 int c;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
331 {
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
332 Lisp_Object elt;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
333
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
334 elt = CHAR_TABLE_REF (fontset, c);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
335 if (NILP (elt) && ! EQ (fontset, Vdefault_fontset)
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
336 /* Don't check Vdefault_fontset for a realized fontset. */
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
337 && NILP (FONTSET_BASE (fontset)))
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
338 elt = CHAR_TABLE_REF (Vdefault_fontset, c);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
339 return elt;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
340 }
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
341
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
342 /* Set elements of FONTSET for characters in RANGE to the value ELT.
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
343 RANGE is a cons (FROM . TO), where FROM and TO are character codes
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
344 specifying a range. */
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
345
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
346 #define FONTSET_SET(fontset, range, elt) \
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
347 Fset_char_table_range ((fontset), (range), (elt))
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
348
53353
b085f18ebcf0 (Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 53072
diff changeset
349
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
350 /* Modify the elements of FONTSET for characters in RANGE by replacing
89699
cda6f41a592e (reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 89687
diff changeset
351 with ELT or adding ELT. RANGE is a cons (FROM . TO), where FROM
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
352 and TO are character codes specifying a range. If ADD is nil,
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
353 replace with ELT, if ADD is `prepend', prepend ELT, otherwise,
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
354 append ELT. */
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
355
89811
d13626b05df3 (fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents: 89805
diff changeset
356 #define FONTSET_ADD(fontset, range, elt, add) \
d13626b05df3 (fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents: 89805
diff changeset
357 (NILP (add) \
d13626b05df3 (fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents: 89805
diff changeset
358 ? (NILP (range) \
d13626b05df3 (fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents: 89805
diff changeset
359 ? (FONTSET_FALLBACK (fontset) = Fmake_vector (make_number (1), (elt))) \
d13626b05df3 (fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents: 89805
diff changeset
360 : Fset_char_table_range ((fontset), (range), \
d13626b05df3 (fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents: 89805
diff changeset
361 Fmake_vector (make_number (1), (elt)))) \
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
362 : fontset_add ((fontset), (range), (elt), (add)))
53353
b085f18ebcf0 (Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 53072
diff changeset
363
89069
c2201502f37e (fontset_add): Return Lisp_Object.
Dave Love <fx@gnu.org>
parents: 89006
diff changeset
364 static Lisp_Object
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
365 fontset_add (fontset, range, elt, add)
88931
74d18470865c (fontset_add): Declare args. Call make_number
Dave Love <fx@gnu.org>
parents: 88903
diff changeset
366 Lisp_Object fontset, range, elt, add;
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
367 {
89805
35a0a24752d3 (FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents: 89711
diff changeset
368 Lisp_Object args[2];
35a0a24752d3 (FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents: 89711
diff changeset
369 int idx = (EQ (add, Qappend) ? 0 : 1);
35a0a24752d3 (FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents: 89711
diff changeset
370
35a0a24752d3 (FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents: 89711
diff changeset
371 args[1 - idx] = Fmake_vector (make_number (1), elt);
35a0a24752d3 (FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents: 89711
diff changeset
372
35a0a24752d3 (FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents: 89711
diff changeset
373 if (CONSP (range))
35a0a24752d3 (FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents: 89711
diff changeset
374 {
35a0a24752d3 (FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents: 89711
diff changeset
375 int from = XINT (XCAR (range));
35a0a24752d3 (FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents: 89711
diff changeset
376 int to = XINT (XCDR (range));
35a0a24752d3 (FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents: 89711
diff changeset
377 int from1, to1;
89483
2f877ed80fa6 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88123 89428
diff changeset
378
89805
35a0a24752d3 (FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents: 89711
diff changeset
379 do {
35a0a24752d3 (FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents: 89711
diff changeset
380 args[idx] = char_table_ref_and_range (fontset, from, &from1, &to1);
35a0a24752d3 (FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents: 89711
diff changeset
381 if (to < to1)
35a0a24752d3 (FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents: 89711
diff changeset
382 to1 = to;
35a0a24752d3 (FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents: 89711
diff changeset
383 char_table_set_range (fontset, from, to1,
35a0a24752d3 (FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents: 89711
diff changeset
384 NILP (args[idx]) ? args[1 - idx]
35a0a24752d3 (FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents: 89711
diff changeset
385 : Fvconcat (2, args));
35a0a24752d3 (FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents: 89711
diff changeset
386 from = to1 + 1;
35a0a24752d3 (FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents: 89711
diff changeset
387 } while (from < to);
35a0a24752d3 (FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents: 89711
diff changeset
388 }
35a0a24752d3 (FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents: 89711
diff changeset
389 else
35a0a24752d3 (FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents: 89711
diff changeset
390 {
35a0a24752d3 (FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents: 89711
diff changeset
391 args[idx] = FONTSET_FALLBACK (fontset);
35a0a24752d3 (FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents: 89711
diff changeset
392 FONTSET_FALLBACK (fontset)
35a0a24752d3 (FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents: 89711
diff changeset
393 = NILP (args[idx]) ? args[1 - idx] : Fvconcat (2, args);
53353
b085f18ebcf0 (Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 53072
diff changeset
394 }
b085f18ebcf0 (Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 53072
diff changeset
395 return Qnil;
b085f18ebcf0 (Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 53072
diff changeset
396 }
b085f18ebcf0 (Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 53072
diff changeset
397
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
398
91231
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
399 /* Update FONT-GROUP which has this form:
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
400 [CHARSET-ORDERED-LIST-TICK PREFERRED-CHARSET-ID PREFERRED-FAMILY
89898
0167306cb580 (fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents: 89865
diff changeset
401 RFONT-DEF0 RFONT-DEF1 ...].
0167306cb580 (fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents: 89865
diff changeset
402 Reorder RFONT-DEFs according to the current order of charset
0167306cb580 (fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents: 89865
diff changeset
403 (Vcharset_ordered_list), and update CHARSET-ORDERED-LIST-TICK to
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
404 the latest value. */
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
405
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
406 static void
91231
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
407 reorder_font_vector (font_group, charset_id, family)
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
408 Lisp_Object font_group;
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
409 int charset_id;
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
410 Lisp_Object family;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
411 {
89940
713a4f4140ca (Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents: 89904
diff changeset
412 Lisp_Object list, *new_vec;
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
413 int size;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
414 int *charset_id_table;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
415 int i, idx;
91231
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
416 Lisp_Object preferred_by_charset, preferred_by_family;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
417
91231
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
418 size = ASIZE (font_group) - 3;
91364
1e43b74bf9e5 (reorder_font_vector): Exclude nil elements from the
Kenichi Handa <handa@m17n.org>
parents: 91352
diff changeset
419 /* Exclude the tailing nil elements from the reordering. */
1e43b74bf9e5 (reorder_font_vector): Exclude nil elements from the
Kenichi Handa <handa@m17n.org>
parents: 91352
diff changeset
420 while (NILP (AREF (font_group, size - 1))) size--;
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
421 charset_id_table = (int *) alloca (sizeof (int) * size);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
422 new_vec = (Lisp_Object *) alloca (sizeof (Lisp_Object) * size);
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
423
91231
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
424 /* At first, extract ENCODING (a chaset ID) from RFONT_DEF which
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
425 has this form:
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
426 [FACE-ID FONT-INDEX [ FONT-SPEC ENCODING REPERTORY ]]
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
427 In addtion, if RFONT_DEF is preferred by family or charset, store
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
428 it from the start of new_vec. */
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
429 for (i = 0, idx = 0; i < size; i++)
89699
cda6f41a592e (reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 89687
diff changeset
430 {
91231
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
431 Lisp_Object rfont_def = AREF (font_group, i + 3);
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
432 Lisp_Object font_spec = AREF (AREF (rfont_def, 2), 0);
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
433 Lisp_Object this_family = AREF (font_spec, FONT_FAMILY_INDEX);
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
434 int id = XINT (AREF (AREF (rfont_def, 2), 1));
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
435 struct charset *charset = CHARSET_FROM_ID (id);
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
436
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
437 charset_id_table[i] = -1;
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
438 if (! NILP (this_family)
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
439 && (fast_string_match_ignore_case (family, SYMBOL_NAME (this_family))
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
440 >= 0))
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
441 {
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
442 if (idx > 0)
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
443 memmove (new_vec + 1, new_vec, sizeof (Lisp_Object) * idx);
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
444 new_vec[0] = rfont_def;
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
445 idx++;
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
446 ASET (font_group, i + 3, Qnil);
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
447 }
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
448 else if (id == charset_id)
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
449 {
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
450 new_vec[idx++] = rfont_def;
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
451 ASET (font_group, i + 3, Qnil);
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
452 }
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
453 else if (! charset->supplementary_p)
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
454 charset_id_table[i] = id;
89699
cda6f41a592e (reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 89687
diff changeset
455 }
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
456
91266
3cd59392b3ec (Vfont_encoding_charset_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 91250
diff changeset
457 if (idx == 0
3cd59392b3ec (Vfont_encoding_charset_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 91250
diff changeset
458 && (XINT (AREF (font_group, 0)) == charset_ordered_list_tick))
3cd59392b3ec (Vfont_encoding_charset_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 91250
diff changeset
459 /* No need of reordering. */
3cd59392b3ec (Vfont_encoding_charset_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 91250
diff changeset
460 return;
3cd59392b3ec (Vfont_encoding_charset_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 91250
diff changeset
461
3cd59392b3ec (Vfont_encoding_charset_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 91250
diff changeset
462 ASET (font_group, 0, make_number (charset_ordered_list_tick));
3cd59392b3ec (Vfont_encoding_charset_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 91250
diff changeset
463 ASET (font_group, 1, make_number (charset_id));
3cd59392b3ec (Vfont_encoding_charset_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 91250
diff changeset
464 ASET (font_group, 2, family);
3cd59392b3ec (Vfont_encoding_charset_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 91250
diff changeset
465
91231
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
466 /* Then, store the remaining RFONT-DEFs in NEW_VEC in the correct
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
467 order. */
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
468 for (list = Vcharset_ordered_list; idx < size; list = XCDR (list))
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
469 {
91231
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
470 int id = XINT (XCAR (list));
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
471 struct charset *charset = CHARSET_FROM_ID (id);
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
472
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
473 if (charset->supplementary_p)
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
474 break;
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
475 for (i = 0; i < size; i++)
91231
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
476 if (charset_id_table[i] == XINT (XCAR (list))
91352
b6befec471b8 (reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents: 91336
diff changeset
477 && ! NILP (AREF (font_group, i + 3)))
91231
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
478 {
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
479 new_vec[idx++] = AREF (font_group, i + 3);
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
480 ASET (font_group, i + 3, Qnil);
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
481 }
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
482 }
90440
33277d7748f3 (reorder_font_vector): Pay attention to the case that
Kenichi Handa <handa@m17n.org>
parents: 90410
diff changeset
483 for (i = 0; i < size; i++)
91231
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
484 if (! NILP (AREF (font_group, i + 3)))
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
485 new_vec[idx++] = AREF (font_group, i + 3);
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
486
91231
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
487 /* At last, update elements of FONT-GROUP. */
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
488 for (i = 0; i < size; i++)
91231
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
489 ASET (font_group, i + 3, new_vec[i]);
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
490 }
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
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
493 /* Load a font matching the font related attributes in FACE->lface and
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
494 font pattern in FONT_DEF of FONTSET, and return an index of the
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
495 font. FONT_DEF has this form:
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
496 [ FONT-SPEC ENCODING REPERTORY ]
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
497 If REPERTORY is nil, generate a char-table representing the font
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
498 repertory by looking into the font itself. */
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
499
91231
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
500 extern Lisp_Object QCname;
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
501
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
502 static int
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
503 load_font_get_repertory (f, face, font_def, fontset)
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
504 FRAME_PTR f;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
505 struct face *face;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
506 Lisp_Object font_def;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
507 Lisp_Object fontset;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
508 {
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
509 char *font_name;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
510 struct font_info *font_info;
89572
971778c2578c (load_font_get_repertory): Pay attention to the case
Kenichi Handa <handa@m17n.org>
parents: 89483
diff changeset
511 int charset;
91231
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
512 Lisp_Object font_spec, name;
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
513
91231
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
514 font_spec = AREF (font_def, 0);
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
515 name = Ffont_get (font_spec, QCname);
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
516 if (! NILP (name))
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
517 font_name = choose_face_font (f, face->lface, name, NULL);
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
518 else
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
519 font_name = choose_face_font (f, face->lface, font_spec, NULL);
89901
d1a1970e3dd1 (find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents: 89898
diff changeset
520 charset = XINT (AREF (font_def, 1));
89572
971778c2578c (load_font_get_repertory): Pay attention to the case
Kenichi Handa <handa@m17n.org>
parents: 89483
diff changeset
521 if (! (font_info = fs_load_font (f, font_name, charset)))
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
522 return -1;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
523
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
524 if (NILP (AREF (font_def, 2))
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
525 && NILP (Fassq (make_number (font_info->font_idx),
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
526 FONTSET_REPERTORY (fontset))))
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
527 {
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
528 /* We must look into the font to get the correct repertory as a
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
529 char-table. */
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
530 Lisp_Object repertory;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
531
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
532 repertory = (*get_font_repertory_func) (f, font_info);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
533 FONTSET_REPERTORY (fontset)
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
534 = Fcons (Fcons (make_number (font_info->font_idx), repertory),
89483
2f877ed80fa6 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88123 89428
diff changeset
535 FONTSET_REPERTORY (fontset));
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
536 }
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
537
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
538 return font_info->font_idx;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
539 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
540
90802
bfafc889caa9 (fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents: 90737
diff changeset
541 static Lisp_Object fontset_find_font P_ ((Lisp_Object, int, struct face *,
bfafc889caa9 (fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents: 90737
diff changeset
542 int, int));
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
543
89898
0167306cb580 (fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents: 89865
diff changeset
544 /* Return RFONT-DEF (vector) in the realized fontset FONTSET for the
91352
b6befec471b8 (reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents: 91336
diff changeset
545 character C. If no font is found, return Qnil if there's a
b6befec471b8 (reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents: 91336
diff changeset
546 possibility that the default fontset or the fallback font groups
b6befec471b8 (reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents: 91336
diff changeset
547 have a proper font, and return Qt if not.
b6befec471b8 (reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents: 91336
diff changeset
548
b6befec471b8 (reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents: 91336
diff changeset
549 If a font is found but is not yet opened, open it (if FACE is not
b6befec471b8 (reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents: 91336
diff changeset
550 NULL) or return Qnil (if FACE is NULL).
b6befec471b8 (reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents: 91336
diff changeset
551
90802
bfafc889caa9 (fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents: 90737
diff changeset
552 ID is a charset-id that must be preferred, or -1 meaning no
bfafc889caa9 (fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents: 90737
diff changeset
553 preference.
91352
b6befec471b8 (reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents: 91336
diff changeset
554
91231
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
555 If FALLBACK is nonzero, search only fallback fonts. */
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
556
89898
0167306cb580 (fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents: 89865
diff changeset
557 static Lisp_Object
90802
bfafc889caa9 (fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents: 90737
diff changeset
558 fontset_find_font (fontset, c, face, id, fallback)
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
559 Lisp_Object fontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
560 int c;
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
561 struct face *face;
90802
bfafc889caa9 (fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents: 90737
diff changeset
562 int id, fallback;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
563 {
90821
5346cefbb15b (reorder_font_vector): Check contents of font_def.
Kenichi Handa <handa@m17n.org>
parents: 90818
diff changeset
564 Lisp_Object base_fontset, elt, vec, font_def;
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
565 int i, from, to;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
566 int font_idx;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
567 FRAME_PTR f = XFRAME (FONTSET_FRAME (fontset));
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
568
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
569 base_fontset = FONTSET_BASE (fontset);
90802
bfafc889caa9 (fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents: 90737
diff changeset
570 if (! fallback)
bfafc889caa9 (fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents: 90737
diff changeset
571 vec = CHAR_TABLE_REF (fontset, c);
bfafc889caa9 (fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents: 90737
diff changeset
572 else
bfafc889caa9 (fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents: 90737
diff changeset
573 vec = FONTSET_FALLBACK (fontset);
91364
1e43b74bf9e5 (reorder_font_vector): Exclude nil elements from the
Kenichi Handa <handa@m17n.org>
parents: 91352
diff changeset
574
89811
d13626b05df3 (fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents: 89805
diff changeset
575 if (NILP (vec))
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
576 {
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
577 Lisp_Object range;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
578
91231
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
579 /* We have not yet decided a font for C. */
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
580 if (! face)
89898
0167306cb580 (fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents: 89865
diff changeset
581 return Qnil;
90802
bfafc889caa9 (fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents: 90737
diff changeset
582 if (! fallback)
91231
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
583 {
91336
04716f23ac87 (FONTSET_REF_AND_RANGE): Delete it.
Kenichi Handa <handa@m17n.org>
parents: 91327
diff changeset
584 elt = char_table_ref_and_range (base_fontset, c, &from, &to);
91231
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
585 range = Fcons (make_number (from), make_number (to));
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
586 }
90802
bfafc889caa9 (fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents: 90737
diff changeset
587 else
91231
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
588 {
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
589 elt = FONTSET_FALLBACK (base_fontset);
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
590 }
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
591 if (NILP (elt))
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
592 {
91364
1e43b74bf9e5 (reorder_font_vector): Exclude nil elements from the
Kenichi Handa <handa@m17n.org>
parents: 91352
diff changeset
593 /* This fontset doesn't specify any font for C. */
91352
b6befec471b8 (reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents: 91336
diff changeset
594 vec = make_number (0);
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
595 }
91364
1e43b74bf9e5 (reorder_font_vector): Exclude nil elements from the
Kenichi Handa <handa@m17n.org>
parents: 91352
diff changeset
596 else if (ASIZE (elt) == 1 && NILP (AREF (elt, 0)))
1e43b74bf9e5 (reorder_font_vector): Exclude nil elements from the
Kenichi Handa <handa@m17n.org>
parents: 91352
diff changeset
597 {
1e43b74bf9e5 (reorder_font_vector): Exclude nil elements from the
Kenichi Handa <handa@m17n.org>
parents: 91352
diff changeset
598 /* Explicitly specified no font. */
1e43b74bf9e5 (reorder_font_vector): Exclude nil elements from the
Kenichi Handa <handa@m17n.org>
parents: 91352
diff changeset
599 vec = Qt;
1e43b74bf9e5 (reorder_font_vector): Exclude nil elements from the
Kenichi Handa <handa@m17n.org>
parents: 91352
diff changeset
600 }
90440
33277d7748f3 (reorder_font_vector): Pay attention to the case that
Kenichi Handa <handa@m17n.org>
parents: 90410
diff changeset
601 else
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
602 {
90802
bfafc889caa9 (fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents: 90737
diff changeset
603 /* Build a vector [ -1 -1 nil NEW-ELT0 NEW-ELT1 NEW-ELT2 ... ],
bfafc889caa9 (fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents: 90737
diff changeset
604 where the first -1 is to force reordering of NEW-ELTn,
bfafc889caa9 (fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents: 90737
diff changeset
605 NEW-ELTn is [nil nil AREF (elt, n) nil]. */
91364
1e43b74bf9e5 (reorder_font_vector): Exclude nil elements from the
Kenichi Handa <handa@m17n.org>
parents: 91352
diff changeset
606 int size = ASIZE (elt);
1e43b74bf9e5 (reorder_font_vector): Exclude nil elements from the
Kenichi Handa <handa@m17n.org>
parents: 91352
diff changeset
607 int j;
1e43b74bf9e5 (reorder_font_vector): Exclude nil elements from the
Kenichi Handa <handa@m17n.org>
parents: 91352
diff changeset
608
1e43b74bf9e5 (reorder_font_vector): Exclude nil elements from the
Kenichi Handa <handa@m17n.org>
parents: 91352
diff changeset
609 vec = Fmake_vector (make_number (size + 3), Qnil);
90802
bfafc889caa9 (fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents: 90737
diff changeset
610 ASET (vec, 0, make_number (-1));
bfafc889caa9 (fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents: 90737
diff changeset
611 ASET (vec, 1, make_number (-1));
91364
1e43b74bf9e5 (reorder_font_vector): Exclude nil elements from the
Kenichi Handa <handa@m17n.org>
parents: 91352
diff changeset
612 for (i = j = 0; i < size; i++)
1e43b74bf9e5 (reorder_font_vector): Exclude nil elements from the
Kenichi Handa <handa@m17n.org>
parents: 91352
diff changeset
613 if (! NILP (AREF (elt, i)))
1e43b74bf9e5 (reorder_font_vector): Exclude nil elements from the
Kenichi Handa <handa@m17n.org>
parents: 91352
diff changeset
614 {
1e43b74bf9e5 (reorder_font_vector): Exclude nil elements from the
Kenichi Handa <handa@m17n.org>
parents: 91352
diff changeset
615 Lisp_Object tmp;
1e43b74bf9e5 (reorder_font_vector): Exclude nil elements from the
Kenichi Handa <handa@m17n.org>
parents: 91352
diff changeset
616 tmp = Fmake_vector (make_number (5), Qnil);
1e43b74bf9e5 (reorder_font_vector): Exclude nil elements from the
Kenichi Handa <handa@m17n.org>
parents: 91352
diff changeset
617 ASET (tmp, 2, AREF (elt, i));
1e43b74bf9e5 (reorder_font_vector): Exclude nil elements from the
Kenichi Handa <handa@m17n.org>
parents: 91352
diff changeset
618 ASET (vec, j + 3, tmp);
1e43b74bf9e5 (reorder_font_vector): Exclude nil elements from the
Kenichi Handa <handa@m17n.org>
parents: 91352
diff changeset
619 j++;
1e43b74bf9e5 (reorder_font_vector): Exclude nil elements from the
Kenichi Handa <handa@m17n.org>
parents: 91352
diff changeset
620 }
90802
bfafc889caa9 (fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents: 90737
diff changeset
621 }
91231
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
622 /* Then store it in the fontset. */
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
623 if (! fallback)
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
624 FONTSET_SET (fontset, range, vec);
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
625 else
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
626 FONTSET_FALLBACK (fontset) = vec;
91364
1e43b74bf9e5 (reorder_font_vector): Exclude nil elements from the
Kenichi Handa <handa@m17n.org>
parents: 91352
diff changeset
627
89699
cda6f41a592e (reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 89687
diff changeset
628 }
91352
b6befec471b8 (reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents: 91336
diff changeset
629 if (! VECTORP (vec))
91364
1e43b74bf9e5 (reorder_font_vector): Exclude nil elements from the
Kenichi Handa <handa@m17n.org>
parents: 91352
diff changeset
630 return (EQ (vec, Qt) ? Qt : Qnil);
89699
cda6f41a592e (reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 89687
diff changeset
631
91250
2de541db2c82 (fontset_find_font): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents: 91241
diff changeset
632 if (ASIZE (vec) > 4
2de541db2c82 (fontset_find_font): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents: 91241
diff changeset
633 && (XINT (AREF (vec, 0)) != charset_ordered_list_tick
91266
3cd59392b3ec (Vfont_encoding_charset_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 91250
diff changeset
634 || (id >= 0 && XINT (AREF (vec, 1)) != id)
91250
2de541db2c82 (fontset_find_font): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents: 91241
diff changeset
635 || NILP (Fequal (AREF (vec, 2), face->lface[LFACE_FAMILY_INDEX]))))
91231
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
636 /* We have just created VEC,
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
637 or the charset priorities were changed,
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
638 or the preferred charset was changed,
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
639 or the preferred family was changed. */
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
640 reorder_font_vector (vec, id, face->lface[LFACE_FAMILY_INDEX]);
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
641
89898
0167306cb580 (fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents: 89865
diff changeset
642 /* Find the first available font in the vector of RFONT-DEF. */
91231
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
643 for (i = 3; i < ASIZE (vec); i++)
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
644 {
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
645 elt = AREF (vec, i);
89699
cda6f41a592e (reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 89687
diff changeset
646 if (NILP (elt))
91364
1e43b74bf9e5 (reorder_font_vector): Exclude nil elements from the
Kenichi Handa <handa@m17n.org>
parents: 91352
diff changeset
647 /* This is the sign of not to try fallback fonts. */
1e43b74bf9e5 (reorder_font_vector): Exclude nil elements from the
Kenichi Handa <handa@m17n.org>
parents: 91352
diff changeset
648 return Qt;
91231
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
649 /* ELT == [ FACE-ID FONT-INDEX FONT-DEF ... ] */
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
650 if (INTEGERP (AREF (elt, 1)) && XINT (AREF (elt, 1)) < 0)
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
651 /* We couldn't open this font last time. */
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
652 continue;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
653
89898
0167306cb580 (fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents: 89865
diff changeset
654 if (!face && NILP (AREF (elt, 1)))
0167306cb580 (fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents: 89865
diff changeset
655 /* We have not yet opened the font. */
0167306cb580 (fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents: 89865
diff changeset
656 return Qnil;
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
657
89898
0167306cb580 (fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents: 89865
diff changeset
658 font_def = AREF (elt, 2);
0167306cb580 (fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents: 89865
diff changeset
659 /* FONT_DEF == [ FONT-SPEC ENCODING REPERTORY ] */
90410
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
660
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
661 #ifdef USE_FONT_BACKEND
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
662 if (enable_font_backend)
61736
e3221787f899 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 60511
diff changeset
663 {
91352
b6befec471b8 (reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents: 91336
diff changeset
664 /* ELT == [ FACE-ID FONT-INDEX FONT-DEF FONT-ENTITY ]
b6befec471b8 (reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents: 91336
diff changeset
665 where FONT-ENTITY turns to a font-object once opened. */
b6befec471b8 (reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents: 91336
diff changeset
666 Lisp_Object font_entity = AREF (elt, 3);
b6befec471b8 (reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents: 91336
diff changeset
667 int has_char = 0;
90410
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
668
91352
b6befec471b8 (reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents: 91336
diff changeset
669 if (NILP (font_entity))
90410
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
670 {
91352
b6befec471b8 (reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents: 91336
diff changeset
671 font_entity = font_find_for_lface (f, face->lface,
91364
1e43b74bf9e5 (reorder_font_vector): Exclude nil elements from the
Kenichi Handa <handa@m17n.org>
parents: 91352
diff changeset
672 AREF (font_def, 0), -1);
90818
c307aa794b2d (fontset_find_font): Pay attention to font size
Kenichi Handa <handa@m17n.org>
parents: 90806
diff changeset
673 if (NILP (font_entity))
91364
1e43b74bf9e5 (reorder_font_vector): Exclude nil elements from the
Kenichi Handa <handa@m17n.org>
parents: 91352
diff changeset
674 {
1e43b74bf9e5 (reorder_font_vector): Exclude nil elements from the
Kenichi Handa <handa@m17n.org>
parents: 91352
diff changeset
675 ASET (elt, 1, make_number (-1));
1e43b74bf9e5 (reorder_font_vector): Exclude nil elements from the
Kenichi Handa <handa@m17n.org>
parents: 91352
diff changeset
676 continue;
1e43b74bf9e5 (reorder_font_vector): Exclude nil elements from the
Kenichi Handa <handa@m17n.org>
parents: 91352
diff changeset
677 }
91352
b6befec471b8 (reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents: 91336
diff changeset
678 ASET (elt, 3, font_entity);
91136
d54684fee154 (fontset_find_font) [USE_FONT_BACKEND]: Try multiple
Kenichi Handa <handa@m17n.org>
parents: 91053
diff changeset
679 }
91352
b6befec471b8 (reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents: 91336
diff changeset
680 else if (FONT_ENTITY_P (font_entity))
91136
d54684fee154 (fontset_find_font) [USE_FONT_BACKEND]: Try multiple
Kenichi Handa <handa@m17n.org>
parents: 91053
diff changeset
681 {
91352
b6befec471b8 (reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents: 91336
diff changeset
682 if (FONT_ENTITY_NOT_LOADABLE (font_entity))
b6befec471b8 (reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents: 91336
diff changeset
683 continue;
b6befec471b8 (reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents: 91336
diff changeset
684 }
91364
1e43b74bf9e5 (reorder_font_vector): Exclude nil elements from the
Kenichi Handa <handa@m17n.org>
parents: 91352
diff changeset
685 has_char = font_has_char (f, font_entity, c);
1e43b74bf9e5 (reorder_font_vector): Exclude nil elements from the
Kenichi Handa <handa@m17n.org>
parents: 91352
diff changeset
686 if (! has_char)
1e43b74bf9e5 (reorder_font_vector): Exclude nil elements from the
Kenichi Handa <handa@m17n.org>
parents: 91352
diff changeset
687 continue;
91352
b6befec471b8 (reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents: 91336
diff changeset
688 if (! FONT_OBJECT_P (font_entity))
b6befec471b8 (reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents: 91336
diff changeset
689 {
91364
1e43b74bf9e5 (reorder_font_vector): Exclude nil elements from the
Kenichi Handa <handa@m17n.org>
parents: 91352
diff changeset
690 Lisp_Object font_object
1e43b74bf9e5 (reorder_font_vector): Exclude nil elements from the
Kenichi Handa <handa@m17n.org>
parents: 91352
diff changeset
691 = font_open_for_lface (f, font_entity, face->lface, Qnil);
1e43b74bf9e5 (reorder_font_vector): Exclude nil elements from the
Kenichi Handa <handa@m17n.org>
parents: 91352
diff changeset
692
1e43b74bf9e5 (reorder_font_vector): Exclude nil elements from the
Kenichi Handa <handa@m17n.org>
parents: 91352
diff changeset
693 if (NILP (font_object))
90818
c307aa794b2d (fontset_find_font): Pay attention to font size
Kenichi Handa <handa@m17n.org>
parents: 90806
diff changeset
694 {
91352
b6befec471b8 (reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents: 91336
diff changeset
695 FONT_ENTITY_SET_NOT_LOADABLE (font_entity);
90818
c307aa794b2d (fontset_find_font): Pay attention to font size
Kenichi Handa <handa@m17n.org>
parents: 90806
diff changeset
696 continue;
c307aa794b2d (fontset_find_font): Pay attention to font size
Kenichi Handa <handa@m17n.org>
parents: 90806
diff changeset
697 }
91908
6916adc8df33 (FONTSET_OBJLIST): New macro.
Kenichi Handa <handa@m17n.org>
parents: 91887
diff changeset
698 FONTSET_OBJLIST (fontset)
6916adc8df33 (FONTSET_OBJLIST): New macro.
Kenichi Handa <handa@m17n.org>
parents: 91887
diff changeset
699 = Fcons (font_object, FONTSET_OBJLIST (fontset));
91364
1e43b74bf9e5 (reorder_font_vector): Exclude nil elements from the
Kenichi Handa <handa@m17n.org>
parents: 91352
diff changeset
700 ASET (elt, 3, font_object);
1e43b74bf9e5 (reorder_font_vector): Exclude nil elements from the
Kenichi Handa <handa@m17n.org>
parents: 91352
diff changeset
701 if (has_char < 0)
1e43b74bf9e5 (reorder_font_vector): Exclude nil elements from the
Kenichi Handa <handa@m17n.org>
parents: 91352
diff changeset
702 {
1e43b74bf9e5 (reorder_font_vector): Exclude nil elements from the
Kenichi Handa <handa@m17n.org>
parents: 91352
diff changeset
703 has_char = font_has_char (f, font_object, c);
1e43b74bf9e5 (reorder_font_vector): Exclude nil elements from the
Kenichi Handa <handa@m17n.org>
parents: 91352
diff changeset
704 if (! has_char)
1e43b74bf9e5 (reorder_font_vector): Exclude nil elements from the
Kenichi Handa <handa@m17n.org>
parents: 91352
diff changeset
705 continue;
1e43b74bf9e5 (reorder_font_vector): Exclude nil elements from the
Kenichi Handa <handa@m17n.org>
parents: 91352
diff changeset
706 }
90410
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
707 }
91364
1e43b74bf9e5 (reorder_font_vector): Exclude nil elements from the
Kenichi Handa <handa@m17n.org>
parents: 91352
diff changeset
708 /* Decide to use this font. */
90410
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
709 ASET (elt, 1, make_number (0));
61736
e3221787f899 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 60511
diff changeset
710 }
90410
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
711 else
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
712 #endif /* USE_FONT_BACKEND */
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
713
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
714 if (INTEGERP (AREF (font_def, 2)))
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
715 {
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
716 /* The repertory is specified by charset ID. */
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
717 struct charset *charset
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
718 = CHARSET_FROM_ID (XINT (AREF (font_def, 2)));
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
719
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
720 if (! CHAR_CHARSET_P (c, charset))
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
721 /* This font can't display C. */
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
722 continue;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
723 }
89826
b17725d55ba2 (Fset_fontset_font): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents: 89811
diff changeset
724 else if (CHAR_TABLE_P (AREF (font_def, 2)))
61736
e3221787f899 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 60511
diff changeset
725 {
89826
b17725d55ba2 (Fset_fontset_font): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents: 89811
diff changeset
726 /* The repertory is specified by a char table. */
b17725d55ba2 (Fset_fontset_font): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents: 89811
diff changeset
727 if (NILP (CHAR_TABLE_REF (AREF (font_def, 2), c)))
b17725d55ba2 (Fset_fontset_font): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents: 89811
diff changeset
728 /* This font can't display C. */
b17725d55ba2 (Fset_fontset_font): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents: 89811
diff changeset
729 continue;
b17725d55ba2 (Fset_fontset_font): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents: 89811
diff changeset
730 }
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
731 else
61736
e3221787f899 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 60511
diff changeset
732 {
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
733 Lisp_Object slot;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
734
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
735 if (! INTEGERP (AREF (elt, 1)))
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
736 {
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
737 /* We have not yet opened a font matching this spec.
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
738 Open the best matching font now and register the
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
739 repertory. */
89898
0167306cb580 (fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents: 89865
diff changeset
740 struct font_info *font_info;
0167306cb580 (fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents: 89865
diff changeset
741
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
742 font_idx = load_font_get_repertory (f, face, font_def, fontset);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
743 ASET (elt, 1, make_number (font_idx));
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
744 if (font_idx < 0)
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
745 /* This means that we couldn't find a font matching
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
746 FONT_DEF. */
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
747 continue;
89898
0167306cb580 (fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents: 89865
diff changeset
748 font_info = (*get_font_info_func) (f, font_idx);
0167306cb580 (fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents: 89865
diff changeset
749 ASET (elt, 3, build_string (font_info->full_name));
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
750 }
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
751
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
752 slot = Fassq (AREF (elt, 1), FONTSET_REPERTORY (fontset));
89898
0167306cb580 (fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents: 89865
diff changeset
753 xassert (CONSP (slot));
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
754 if (NILP (CHAR_TABLE_REF (XCDR (slot), c)))
89898
0167306cb580 (fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents: 89865
diff changeset
755 /* This font can't display C. */
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
756 continue;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
757 }
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
758
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
759 /* Now we have decided to use this font spec to display C. */
89898
0167306cb580 (fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents: 89865
diff changeset
760 if (! INTEGERP (AREF (elt, 1)))
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
761 {
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
762 /* But not yet opened the best matching font. */
89898
0167306cb580 (fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents: 89865
diff changeset
763 struct font_info *font_info;
0167306cb580 (fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents: 89865
diff changeset
764
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
765 font_idx = load_font_get_repertory (f, face, font_def, fontset);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
766 ASET (elt, 1, make_number (font_idx));
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
767 if (font_idx < 0)
89898
0167306cb580 (fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents: 89865
diff changeset
768 /* Can't open it. Try the other one. */
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
769 continue;
89898
0167306cb580 (fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents: 89865
diff changeset
770 font_info = (*get_font_info_func) (f, font_idx);
0167306cb580 (fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents: 89865
diff changeset
771 ASET (elt, 3, build_string (font_info->full_name));
61736
e3221787f899 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 60511
diff changeset
772 }
89898
0167306cb580 (fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents: 89865
diff changeset
773 return elt;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
774 }
91352
b6befec471b8 (reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents: 91336
diff changeset
775
91364
1e43b74bf9e5 (reorder_font_vector): Exclude nil elements from the
Kenichi Handa <handa@m17n.org>
parents: 91352
diff changeset
776 return Qnil;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
777 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
778
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
779
53353
b085f18ebcf0 (Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 53072
diff changeset
780 static Lisp_Object
90802
bfafc889caa9 (fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents: 90737
diff changeset
781 fontset_font (fontset, c, face, id)
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
782 Lisp_Object fontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
783 int c;
90802
bfafc889caa9 (fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents: 90737
diff changeset
784 struct face *face;
bfafc889caa9 (fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents: 90737
diff changeset
785 int id;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
786 {
90802
bfafc889caa9 (fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents: 90737
diff changeset
787 Lisp_Object rfont_def;
bfafc889caa9 (fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents: 90737
diff changeset
788 Lisp_Object base_fontset;
89811
d13626b05df3 (fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents: 89805
diff changeset
789
90802
bfafc889caa9 (fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents: 90737
diff changeset
790 /* Try a font-group for C. */
bfafc889caa9 (fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents: 90737
diff changeset
791 rfont_def = fontset_find_font (fontset, c, face, id, 0);
91364
1e43b74bf9e5 (reorder_font_vector): Exclude nil elements from the
Kenichi Handa <handa@m17n.org>
parents: 91352
diff changeset
792 if (VECTORP (rfont_def))
1e43b74bf9e5 (reorder_font_vector): Exclude nil elements from the
Kenichi Handa <handa@m17n.org>
parents: 91352
diff changeset
793 return rfont_def;
1e43b74bf9e5 (reorder_font_vector): Exclude nil elements from the
Kenichi Handa <handa@m17n.org>
parents: 91352
diff changeset
794 if (EQ (rfont_def, Qt))
1e43b74bf9e5 (reorder_font_vector): Exclude nil elements from the
Kenichi Handa <handa@m17n.org>
parents: 91352
diff changeset
795 return Qnil;
90802
bfafc889caa9 (fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents: 90737
diff changeset
796 base_fontset = FONTSET_BASE (fontset);
bfafc889caa9 (fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents: 90737
diff changeset
797 /* Try a font-group for C of the default fontset. */
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
798 if (! EQ (base_fontset, Vdefault_fontset))
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
799 {
89805
35a0a24752d3 (FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents: 89711
diff changeset
800 if (NILP (FONTSET_DEFAULT (fontset)))
35a0a24752d3 (FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents: 89711
diff changeset
801 FONTSET_DEFAULT (fontset)
89610
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
802 = make_fontset (FONTSET_FRAME (fontset), Qnil, Vdefault_fontset);
90802
bfafc889caa9 (fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents: 90737
diff changeset
803 rfont_def = fontset_find_font (FONTSET_DEFAULT (fontset), c, face, id, 0);
91364
1e43b74bf9e5 (reorder_font_vector): Exclude nil elements from the
Kenichi Handa <handa@m17n.org>
parents: 91352
diff changeset
804 if (VECTORP (rfont_def))
1e43b74bf9e5 (reorder_font_vector): Exclude nil elements from the
Kenichi Handa <handa@m17n.org>
parents: 91352
diff changeset
805 return (rfont_def);
91352
b6befec471b8 (reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents: 91336
diff changeset
806 if (! NILP (rfont_def))
91364
1e43b74bf9e5 (reorder_font_vector): Exclude nil elements from the
Kenichi Handa <handa@m17n.org>
parents: 91352
diff changeset
807 /* Remeber that we have no font for C. */
1e43b74bf9e5 (reorder_font_vector): Exclude nil elements from the
Kenichi Handa <handa@m17n.org>
parents: 91352
diff changeset
808 FONTSET_SET (fontset, make_number (c), Qt);
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
809 }
91352
b6befec471b8 (reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents: 91336
diff changeset
810
90802
bfafc889caa9 (fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents: 90737
diff changeset
811 /* Try a fallback font-group. */
bfafc889caa9 (fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents: 90737
diff changeset
812 rfont_def = fontset_find_font (fontset, c, face, id, 1);
91352
b6befec471b8 (reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents: 91336
diff changeset
813 if (! VECTORP (rfont_def)
b6befec471b8 (reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents: 91336
diff changeset
814 && ! EQ (base_fontset, Vdefault_fontset))
b6befec471b8 (reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents: 91336
diff changeset
815 /* Try a fallback font-group of the default fontset . */
90802
bfafc889caa9 (fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents: 90737
diff changeset
816 rfont_def = fontset_find_font (FONTSET_DEFAULT (fontset), c, face, id, 1);
91352
b6befec471b8 (reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents: 91336
diff changeset
817
b6befec471b8 (reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents: 91336
diff changeset
818 if (! VECTORP (rfont_def))
b6befec471b8 (reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents: 91336
diff changeset
819 /* Remeber that we have no font for C. */
b6befec471b8 (reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents: 91336
diff changeset
820 FONTSET_SET (fontset, make_number (c), Qt);
b6befec471b8 (reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents: 91336
diff changeset
821
90802
bfafc889caa9 (fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents: 90737
diff changeset
822 return rfont_def;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
823 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
824
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
825 /* Return a newly created fontset with NAME. If BASE is nil, make a
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
826 base fontset. Otherwise make a realized fontset whose base is
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
827 BASE. */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
828
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
829 static Lisp_Object
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
830 make_fontset (frame, name, base)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
831 Lisp_Object frame, name, base;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
832 {
34975
0d69e2d2724e (fontset_ref): Remove unused variable `i'.
Eli Zaretskii <eliz@gnu.org>
parents: 32978
diff changeset
833 Lisp_Object fontset;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
834 int size = ASIZE (Vfontset_table);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
835 int id = next_fontset_id;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
836
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
837 /* 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
838 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
839 terminates quickly. In addition, as the last element of
41987
34952771ae85 Fix typos, remove unnecessary space.
Pavel Janík <Pavel@Janik.cz>
parents: 41052
diff changeset
840 Vfontset_table is always nil, we don't have to check the range of
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
841 id. */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
842 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
843
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
844 if (id + 1 == size)
91053
a0e466c4d599 Merge from emacs--devo--0
Miles Bader <miles@gnu.org>
parents: 91046 85244
diff changeset
845 Vfontset_table = larger_vector (Vfontset_table, size + 32, Qnil);
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
846
29767
c8e5453dc85d (FONTSET_ASCII): Use the first element of char table
Kenichi Handa <handa@m17n.org>
parents: 29501
diff changeset
847 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
848
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
849 FONTSET_ID (fontset) = make_number (id);
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
850 if (NILP (base))
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
851 {
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
852 FONTSET_NAME (fontset) = name;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
853 }
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
854 else
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
855 {
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
856 FONTSET_NAME (fontset) = Qnil;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
857 FONTSET_FRAME (fontset) = frame;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
858 FONTSET_BASE (fontset) = base;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
859 }
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
860
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
861 ASET (Vfontset_table, id, fontset);
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
862 next_fontset_id = id + 1;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
863 return fontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
864 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
865
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
866
60511
7ee9d8cb89cb (set_default_ascii_font): New function.
Kenichi Handa <handa@m17n.org>
parents: 58025
diff changeset
867 /* Set the ASCII font of the default fontset to FONTNAME if that is
7ee9d8cb89cb (set_default_ascii_font): New function.
Kenichi Handa <handa@m17n.org>
parents: 58025
diff changeset
868 not yet set. */
7ee9d8cb89cb (set_default_ascii_font): New function.
Kenichi Handa <handa@m17n.org>
parents: 58025
diff changeset
869 void
7ee9d8cb89cb (set_default_ascii_font): New function.
Kenichi Handa <handa@m17n.org>
parents: 58025
diff changeset
870 set_default_ascii_font (fontname)
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
871 Lisp_Object fontname;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
872 {
90121
4465a2011c2d (set_default_ascii_font): Fix the change for syncing with CVS head.
Kenichi Handa <handa@m17n.org>
parents: 90116
diff changeset
873 if (! STRINGP (FONTSET_ASCII (Vdefault_fontset)))
60511
7ee9d8cb89cb (set_default_ascii_font): New function.
Kenichi Handa <handa@m17n.org>
parents: 58025
diff changeset
874 {
7ee9d8cb89cb (set_default_ascii_font): New function.
Kenichi Handa <handa@m17n.org>
parents: 58025
diff changeset
875 int id = fs_query_fontset (fontname, 2);
41987
34952771ae85 Fix typos, remove unnecessary space.
Pavel Janík <Pavel@Janik.cz>
parents: 41052
diff changeset
876
60511
7ee9d8cb89cb (set_default_ascii_font): New function.
Kenichi Handa <handa@m17n.org>
parents: 58025
diff changeset
877 if (id >= 0)
90121
4465a2011c2d (set_default_ascii_font): Fix the change for syncing with CVS head.
Kenichi Handa <handa@m17n.org>
parents: 90116
diff changeset
878 fontname = FONTSET_ASCII (FONTSET_FROM_ID (id));
4465a2011c2d (set_default_ascii_font): Fix the change for syncing with CVS head.
Kenichi Handa <handa@m17n.org>
parents: 90116
diff changeset
879 FONTSET_ASCII (Vdefault_fontset)= fontname;
60511
7ee9d8cb89cb (set_default_ascii_font): New function.
Kenichi Handa <handa@m17n.org>
parents: 58025
diff changeset
880 }
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
881 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
882
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
883
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
884 /********** INTERFACES TO xfaces.c, xfns.c, and dispextern.h **********/
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
885
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
886 /* Return the name of the fontset who has ID. */
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
887
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
888 Lisp_Object
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
889 fontset_name (id)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
890 int id;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
891 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
892 Lisp_Object fontset;
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
893
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
894 fontset = FONTSET_FROM_ID (id);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
895 return FONTSET_NAME (fontset);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
896 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
897
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
898
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
899 /* Return the ASCII font name of the fontset who has ID. */
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
900
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
901 Lisp_Object
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
902 fontset_ascii (id)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
903 int id;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
904 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
905 Lisp_Object fontset, elt;
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
906
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
907 fontset= FONTSET_FROM_ID (id);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
908 elt = FONTSET_ASCII (fontset);
90410
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
909 #ifdef USE_FONT_BACKEND
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
910 if (CONSP (elt))
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
911 elt = XCAR (elt);
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
912 #endif /* USE_FONT_BACKEND */
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
913 /* It is assured that ELT is always a string (i.e. fontname
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
914 pattern). */
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
915 return elt;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
916 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
917
91908
6916adc8df33 (FONTSET_OBJLIST): New macro.
Kenichi Handa <handa@m17n.org>
parents: 91887
diff changeset
918 void
6916adc8df33 (FONTSET_OBJLIST): New macro.
Kenichi Handa <handa@m17n.org>
parents: 91887
diff changeset
919 free_realized_fontset (f, fontset)
6916adc8df33 (FONTSET_OBJLIST): New macro.
Kenichi Handa <handa@m17n.org>
parents: 91887
diff changeset
920 FRAME_PTR f;
6916adc8df33 (FONTSET_OBJLIST): New macro.
Kenichi Handa <handa@m17n.org>
parents: 91887
diff changeset
921 Lisp_Object fontset;
6916adc8df33 (FONTSET_OBJLIST): New macro.
Kenichi Handa <handa@m17n.org>
parents: 91887
diff changeset
922 {
6916adc8df33 (FONTSET_OBJLIST): New macro.
Kenichi Handa <handa@m17n.org>
parents: 91887
diff changeset
923 int i;
6916adc8df33 (FONTSET_OBJLIST): New macro.
Kenichi Handa <handa@m17n.org>
parents: 91887
diff changeset
924 Lisp_Object tail;
6916adc8df33 (FONTSET_OBJLIST): New macro.
Kenichi Handa <handa@m17n.org>
parents: 91887
diff changeset
925
6916adc8df33 (FONTSET_OBJLIST): New macro.
Kenichi Handa <handa@m17n.org>
parents: 91887
diff changeset
926 return;
6916adc8df33 (FONTSET_OBJLIST): New macro.
Kenichi Handa <handa@m17n.org>
parents: 91887
diff changeset
927 for (tail = FONTSET_OBJLIST (fontset); CONSP (tail); tail = XCDR (tail))
6916adc8df33 (FONTSET_OBJLIST): New macro.
Kenichi Handa <handa@m17n.org>
parents: 91887
diff changeset
928 {
6916adc8df33 (FONTSET_OBJLIST): New macro.
Kenichi Handa <handa@m17n.org>
parents: 91887
diff changeset
929 xassert (FONT_OBJECT_P (XCAR (tail)));
6916adc8df33 (FONTSET_OBJLIST): New macro.
Kenichi Handa <handa@m17n.org>
parents: 91887
diff changeset
930 font_close_object (f, XCAR (tail));
6916adc8df33 (FONTSET_OBJLIST): New macro.
Kenichi Handa <handa@m17n.org>
parents: 91887
diff changeset
931 }
6916adc8df33 (FONTSET_OBJLIST): New macro.
Kenichi Handa <handa@m17n.org>
parents: 91887
diff changeset
932 }
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
933
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
934 /* Free fontset of FACE defined on frame F. Called from
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
935 free_realized_face. */
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
936
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
937 void
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
938 free_face_fontset (f, face)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
939 FRAME_PTR f;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
940 struct face *face;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
941 {
89610
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
942 Lisp_Object fontset;
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
943
91668
aeadaa72f7b1 (free_face_fontset): Use FONTSET_FROM_ID.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 91513
diff changeset
944 fontset = FONTSET_FROM_ID (face->fontset);
89610
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
945 xassert (!NILP (fontset) && ! BASE_FONTSET_P (fontset));
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
946 xassert (f == XFRAME (FONTSET_FRAME (fontset)));
91908
6916adc8df33 (FONTSET_OBJLIST): New macro.
Kenichi Handa <handa@m17n.org>
parents: 91887
diff changeset
947 free_realized_fontset (f, fontset);
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
948 ASET (Vfontset_table, face->fontset, Qnil);
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
949 if (face->fontset < next_fontset_id)
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
950 next_fontset_id = face->fontset;
89805
35a0a24752d3 (FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents: 89711
diff changeset
951 if (! NILP (FONTSET_DEFAULT (fontset)))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
952 {
89865
d2b1cc2ef7f1 Include "intervals.h".
Kenichi Handa <handa@m17n.org>
parents: 89826
diff changeset
953 int id = XINT (FONTSET_ID (FONTSET_DEFAULT (fontset)));
89610
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
954
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
955 fontset = AREF (Vfontset_table, id);
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
956 xassert (!NILP (fontset) && ! BASE_FONTSET_P (fontset));
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
957 xassert (f == XFRAME (FONTSET_FRAME (fontset)));
91908
6916adc8df33 (FONTSET_OBJLIST): New macro.
Kenichi Handa <handa@m17n.org>
parents: 91887
diff changeset
958 free_realized_fontset (f, fontset);
89610
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
959 ASET (Vfontset_table, id, Qnil);
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
960 if (id < next_fontset_id)
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
961 next_fontset_id = face->fontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
962 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
963 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
964
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
965
78501
1677cf1c2509 Replace `iff' in comments.
Glenn Morris <rgm@gnu.org>
parents: 78313
diff changeset
966 /* Return 1 if FACE is suitable for displaying character C.
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
967 Otherwise return 0. Called from the macro FACE_SUITABLE_FOR_CHAR_P
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
968 when C is not an ASCII character. */
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
969
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
970 int
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
971 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
972 struct face *face;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
973 int c;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
974 {
89898
0167306cb580 (fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents: 89865
diff changeset
975 Lisp_Object fontset, rfont_def;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
976
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
977 fontset = FONTSET_FROM_ID (face->fontset);
89898
0167306cb580 (fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents: 89865
diff changeset
978 rfont_def = fontset_font (fontset, c, NULL, -1);
0167306cb580 (fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents: 89865
diff changeset
979 return (VECTORP (rfont_def)
0167306cb580 (fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents: 89865
diff changeset
980 && INTEGERP (AREF (rfont_def, 0))
0167306cb580 (fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents: 89865
diff changeset
981 && face->id == XINT (AREF (rfont_def, 0)));
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
982 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
983
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 /* Return ID of face suitable for displaying character C on frame F.
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
986 FACE must be reazlied for ASCII characters in advance. Called from
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
987 the macro FACE_FOR_CHAR. */
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
988
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
989 int
89699
cda6f41a592e (reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 89687
diff changeset
990 face_for_char (f, face, c, pos, object)
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
991 FRAME_PTR f;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
992 struct face *face;
89699
cda6f41a592e (reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 89687
diff changeset
993 int c, pos;
cda6f41a592e (reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 89687
diff changeset
994 Lisp_Object object;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
995 {
89898
0167306cb580 (fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents: 89865
diff changeset
996 Lisp_Object fontset, charset, rfont_def;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
997 int face_id;
89699
cda6f41a592e (reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 89687
diff changeset
998 int id;
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
999
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1000 if (ASCII_CHAR_P (c))
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1001 return face->ascii_face->id;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1002
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1003 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
1004 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
1005 xassert (!BASE_FONTSET_P (fontset));
89699
cda6f41a592e (reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 89687
diff changeset
1006 if (pos < 0)
cda6f41a592e (reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 89687
diff changeset
1007 id = -1;
cda6f41a592e (reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 89687
diff changeset
1008 else
cda6f41a592e (reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 89687
diff changeset
1009 {
cda6f41a592e (reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 89687
diff changeset
1010 charset = Fget_char_property (make_number (pos), Qcharset, object);
cda6f41a592e (reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 89687
diff changeset
1011 if (NILP (charset))
cda6f41a592e (reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 89687
diff changeset
1012 id = -1;
cda6f41a592e (reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 89687
diff changeset
1013 else if (CHARSETP (charset))
91266
3cd59392b3ec (Vfont_encoding_charset_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 91250
diff changeset
1014 {
3cd59392b3ec (Vfont_encoding_charset_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 91250
diff changeset
1015 Lisp_Object val;
3cd59392b3ec (Vfont_encoding_charset_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 91250
diff changeset
1016
3cd59392b3ec (Vfont_encoding_charset_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 91250
diff changeset
1017 val = assoc_no_quit (charset, Vfont_encoding_charset_alist);
3cd59392b3ec (Vfont_encoding_charset_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 91250
diff changeset
1018 if (CONSP (val) && CHARSETP (XCDR (val)))
3cd59392b3ec (Vfont_encoding_charset_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 91250
diff changeset
1019 charset = XCDR (val);
3cd59392b3ec (Vfont_encoding_charset_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 91250
diff changeset
1020 id = XINT (CHARSET_SYMBOL_ID (charset));
3cd59392b3ec (Vfont_encoding_charset_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 91250
diff changeset
1021 }
89699
cda6f41a592e (reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 89687
diff changeset
1022 }
89898
0167306cb580 (fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents: 89865
diff changeset
1023 rfont_def = fontset_font (fontset, c, face, id);
0167306cb580 (fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents: 89865
diff changeset
1024 if (VECTORP (rfont_def))
0167306cb580 (fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents: 89865
diff changeset
1025 {
90410
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
1026 #ifdef USE_FONT_BACKEND
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
1027 if (enable_font_backend
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
1028 && NILP (AREF (rfont_def, 0)))
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
1029 {
91352
b6befec471b8 (reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents: 91336
diff changeset
1030 struct font *font = XSAVE_VALUE (AREF (rfont_def, 3))->pointer;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1031
90410
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
1032 face_id = face_for_font (f, font, face);
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
1033 ASET (rfont_def, 0, make_number (face_id));
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
1034 }
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
1035 else
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
1036 #endif /* USE_FONT_BACKEND */
89898
0167306cb580 (fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents: 89865
diff changeset
1037 if (NILP (AREF (rfont_def, 0)))
0167306cb580 (fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents: 89865
diff changeset
1038 {
0167306cb580 (fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents: 89865
diff changeset
1039 /* We have not yet made a realized face that uses this font. */
0167306cb580 (fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents: 89865
diff changeset
1040 int font_idx = XINT (AREF (rfont_def, 1));
41987
34952771ae85 Fix typos, remove unnecessary space.
Pavel Janík <Pavel@Janik.cz>
parents: 41052
diff changeset
1041
89898
0167306cb580 (fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents: 89865
diff changeset
1042 face_id = lookup_non_ascii_face (f, font_idx, face);
0167306cb580 (fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents: 89865
diff changeset
1043 ASET (rfont_def, 0, make_number (face_id));
0167306cb580 (fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents: 89865
diff changeset
1044 }
0167306cb580 (fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents: 89865
diff changeset
1045 return XINT (AREF (rfont_def, 0));
0167306cb580 (fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents: 89865
diff changeset
1046 }
41987
34952771ae85 Fix typos, remove unnecessary space.
Pavel Janík <Pavel@Janik.cz>
parents: 41052
diff changeset
1047
89898
0167306cb580 (fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents: 89865
diff changeset
1048 if (NILP (FONTSET_NOFONT_FACE (fontset)))
0167306cb580 (fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents: 89865
diff changeset
1049 {
0167306cb580 (fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents: 89865
diff changeset
1050 face_id = lookup_non_ascii_face (f, -1, face);
0167306cb580 (fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents: 89865
diff changeset
1051 FONTSET_NOFONT_FACE (fontset) = make_number (face_id);
0167306cb580 (fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents: 89865
diff changeset
1052 }
0167306cb580 (fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents: 89865
diff changeset
1053 return XINT (FONTSET_NOFONT_FACE (fontset));
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1054 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1055
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1056
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1057 /* 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
1058 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
1059 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
1060 Called from realize_x_face. */
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1061
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1062 int
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1063 make_fontset_for_ascii_face (f, base_fontset_id, face)
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1064 FRAME_PTR f;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1065 int base_fontset_id;
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1066 struct face *face;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1067 {
34975
0d69e2d2724e (fontset_ref): Remove unused variable `i'.
Eli Zaretskii <eliz@gnu.org>
parents: 32978
diff changeset
1068 Lisp_Object base_fontset, fontset, frame;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1069
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1070 XSETFRAME (frame, f);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1071 if (base_fontset_id >= 0)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1072 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1073 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
1074 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
1075 base_fontset = FONTSET_BASE (base_fontset);
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1076 if (! BASE_FONTSET_P (base_fontset))
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1077 abort ();
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1078 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1079 else
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1080 base_fontset = Vdefault_fontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1081
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1082 fontset = make_fontset (frame, Qnil, base_fontset);
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1083 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
1084 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1085
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1086
40028
392c2fe9edd7 (fs_load_font) [WINDOWSNT && _MSC_VER]: Disable
Andrew Innes <andrewi@gnu.org>
parents: 39973
diff changeset
1087 #if defined(WINDOWSNT) && defined (_MSC_VER)
392c2fe9edd7 (fs_load_font) [WINDOWSNT && _MSC_VER]: Disable
Andrew Innes <andrewi@gnu.org>
parents: 39973
diff changeset
1088 #pragma optimize("", off)
392c2fe9edd7 (fs_load_font) [WINDOWSNT && _MSC_VER]: Disable
Andrew Innes <andrewi@gnu.org>
parents: 39973
diff changeset
1089 #endif
392c2fe9edd7 (fs_load_font) [WINDOWSNT && _MSC_VER]: Disable
Andrew Innes <andrewi@gnu.org>
parents: 39973
diff changeset
1090
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1091 /* Load a font named FONTNAME on frame F. Return a pointer to the
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1092 struct font_info of the loaded font. If loading fails, return
88968
a35b7b45baa3 (fs_load_font): If fontp->charset is not negative,
Kenichi Handa <handa@m17n.org>
parents: 88931
diff changeset
1093 NULL. CHARSET is an ID of charset to encode characters for this
a35b7b45baa3 (fs_load_font): If fontp->charset is not negative,
Kenichi Handa <handa@m17n.org>
parents: 88931
diff changeset
1094 font. If it is -1, find one from Vfont_encoding_alist. */
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1095
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1096 struct font_info *
88968
a35b7b45baa3 (fs_load_font): If fontp->charset is not negative,
Kenichi Handa <handa@m17n.org>
parents: 88931
diff changeset
1097 fs_load_font (f, fontname, charset)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1098 FRAME_PTR f;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1099 char *fontname;
88968
a35b7b45baa3 (fs_load_font): If fontp->charset is not negative,
Kenichi Handa <handa@m17n.org>
parents: 88931
diff changeset
1100 int charset;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1101 {
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1102 struct font_info *fontp;
90034
dbbe513cabef (fs_load_font): Use fast_string_match_ignore_case
Kenichi Handa <handa@m17n.org>
parents: 90033
diff changeset
1103 Lisp_Object fullname;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1104
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1105 if (!fontname)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1106 /* No way to get fontname. */
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1107 return NULL;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1108
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1109 fontp = (*load_font_func) (f, fontname, 0);
88968
a35b7b45baa3 (fs_load_font): If fontp->charset is not negative,
Kenichi Handa <handa@m17n.org>
parents: 88931
diff changeset
1110 if (! fontp || fontp->charset >= 0)
a35b7b45baa3 (fs_load_font): If fontp->charset is not negative,
Kenichi Handa <handa@m17n.org>
parents: 88931
diff changeset
1111 return fontp;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1112
88500
3d67875ee2b1 (fs_load_font): Check fontp->full_name (not fontname)
Kenichi Handa <handa@m17n.org>
parents: 88482
diff changeset
1113 fontname = fontp->full_name;
57573
43067aee2f3e (fs_load_font): Use fast_string_match_ignore_case for
Kenichi Handa <handa@m17n.org>
parents: 56293
diff changeset
1114 fullname = build_string (fontp->full_name);
26858
7cc081b4e084 (Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents: 26164
diff changeset
1115
88968
a35b7b45baa3 (fs_load_font): If fontp->charset is not negative,
Kenichi Handa <handa@m17n.org>
parents: 88931
diff changeset
1116 if (charset < 0)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1117 {
88968
a35b7b45baa3 (fs_load_font): If fontp->charset is not negative,
Kenichi Handa <handa@m17n.org>
parents: 88931
diff changeset
1118 Lisp_Object charset_symbol;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1119
90034
dbbe513cabef (fs_load_font): Use fast_string_match_ignore_case
Kenichi Handa <handa@m17n.org>
parents: 90033
diff changeset
1120 charset_symbol = find_font_encoding (fullname);
88968
a35b7b45baa3 (fs_load_font): If fontp->charset is not negative,
Kenichi Handa <handa@m17n.org>
parents: 88931
diff changeset
1121 if (CONSP (charset_symbol))
a35b7b45baa3 (fs_load_font): If fontp->charset is not negative,
Kenichi Handa <handa@m17n.org>
parents: 88931
diff changeset
1122 charset_symbol = XCAR (charset_symbol);
90410
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
1123 if (NILP (charset_symbol))
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
1124 charset_symbol = Qascii;
88968
a35b7b45baa3 (fs_load_font): If fontp->charset is not negative,
Kenichi Handa <handa@m17n.org>
parents: 88931
diff changeset
1125 charset = XINT (CHARSET_SYMBOL_ID (charset_symbol));
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1126 }
88968
a35b7b45baa3 (fs_load_font): If fontp->charset is not negative,
Kenichi Handa <handa@m17n.org>
parents: 88931
diff changeset
1127 fontp->charset = charset;
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1128 fontp->vertical_centering = 0;
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1129 fontp->font_encoder = NULL;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1130
88968
a35b7b45baa3 (fs_load_font): If fontp->charset is not negative,
Kenichi Handa <handa@m17n.org>
parents: 88931
diff changeset
1131 if (charset != charset_ascii)
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1132 {
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1133 fontp->vertical_centering
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1134 = (STRINGP (Vvertical_centering_font_regexp)
90034
dbbe513cabef (fs_load_font): Use fast_string_match_ignore_case
Kenichi Handa <handa@m17n.org>
parents: 90033
diff changeset
1135 && (fast_string_match_ignore_case
dbbe513cabef (fs_load_font): Use fast_string_match_ignore_case
Kenichi Handa <handa@m17n.org>
parents: 90033
diff changeset
1136 (Vvertical_centering_font_regexp, fullname) >= 0));
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1137
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1138 if (find_ccl_program_func)
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1139 (*find_ccl_program_func) (fontp);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1140 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1141
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1142 return fontp;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1143 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1144
40028
392c2fe9edd7 (fs_load_font) [WINDOWSNT && _MSC_VER]: Disable
Andrew Innes <andrewi@gnu.org>
parents: 39973
diff changeset
1145 #if defined(WINDOWSNT) && defined (_MSC_VER)
392c2fe9edd7 (fs_load_font) [WINDOWSNT && _MSC_VER]: Disable
Andrew Innes <andrewi@gnu.org>
parents: 39973
diff changeset
1146 #pragma optimize("", on)
392c2fe9edd7 (fs_load_font) [WINDOWSNT && _MSC_VER]: Disable
Andrew Innes <andrewi@gnu.org>
parents: 39973
diff changeset
1147 #endif
392c2fe9edd7 (fs_load_font) [WINDOWSNT && _MSC_VER]: Disable
Andrew Innes <andrewi@gnu.org>
parents: 39973
diff changeset
1148
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1149
88968
a35b7b45baa3 (fs_load_font): If fontp->charset is not negative,
Kenichi Handa <handa@m17n.org>
parents: 88931
diff changeset
1150 /* Return ENCODING or a cons of ENCODING and REPERTORY of the font
a35b7b45baa3 (fs_load_font): If fontp->charset is not negative,
Kenichi Handa <handa@m17n.org>
parents: 88931
diff changeset
1151 FONTNAME. ENCODING is a charset symbol that specifies the encoding
a35b7b45baa3 (fs_load_font): If fontp->charset is not negative,
Kenichi Handa <handa@m17n.org>
parents: 88931
diff changeset
1152 of the font. REPERTORY is a charset symbol or nil. */
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1153
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1154
90410
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
1155 Lisp_Object
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1156 find_font_encoding (fontname)
60511
7ee9d8cb89cb (set_default_ascii_font): New function.
Kenichi Handa <handa@m17n.org>
parents: 58025
diff changeset
1157 Lisp_Object fontname;
7ee9d8cb89cb (set_default_ascii_font): New function.
Kenichi Handa <handa@m17n.org>
parents: 58025
diff changeset
1158 {
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1159 Lisp_Object tail, elt;
60511
7ee9d8cb89cb (set_default_ascii_font): New function.
Kenichi Handa <handa@m17n.org>
parents: 58025
diff changeset
1160
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1161 for (tail = Vfont_encoding_alist; CONSP (tail); tail = XCDR (tail))
60511
7ee9d8cb89cb (set_default_ascii_font): New function.
Kenichi Handa <handa@m17n.org>
parents: 58025
diff changeset
1162 {
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1163 elt = XCAR (tail);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1164 if (CONSP (elt)
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1165 && STRINGP (XCAR (elt))
90034
dbbe513cabef (fs_load_font): Use fast_string_match_ignore_case
Kenichi Handa <handa@m17n.org>
parents: 90033
diff changeset
1166 && fast_string_match_ignore_case (XCAR (elt), fontname) >= 0
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1167 && (SYMBOLP (XCDR (elt))
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1168 ? CHARSETP (XCDR (elt))
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1169 : CONSP (XCDR (elt)) && CHARSETP (XCAR (XCDR (elt)))))
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1170 return (XCDR (elt));
60511
7ee9d8cb89cb (set_default_ascii_font): New function.
Kenichi Handa <handa@m17n.org>
parents: 58025
diff changeset
1171 }
89901
d1a1970e3dd1 (find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents: 89898
diff changeset
1172 /* We don't know the encoding of this font. Let's assume `ascii'. */
d1a1970e3dd1 (find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents: 89898
diff changeset
1173 return Qascii;
60511
7ee9d8cb89cb (set_default_ascii_font): New function.
Kenichi Handa <handa@m17n.org>
parents: 58025
diff changeset
1174 }
7ee9d8cb89cb (set_default_ascii_font): New function.
Kenichi Handa <handa@m17n.org>
parents: 58025
diff changeset
1175
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1176
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1177 /* Cache data used by fontset_pattern_regexp. The car part is a
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1178 pattern string containing at least one wild card, the cdr part is
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1179 the corresponding regular expression. */
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1180 static Lisp_Object Vcached_fontset_data;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1181
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 45848
diff changeset
1182 #define CACHED_FONTSET_NAME (SDATA (XCAR (Vcached_fontset_data)))
26164
d39ec0a27081 more XCAR/XCDR/XFLOAT_DATA uses, to help isolete lisp engine
Ken Raeburn <raeburn@raeburn.org>
parents: 25668
diff changeset
1183 #define CACHED_FONTSET_REGEX (XCDR (Vcached_fontset_data))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1184
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1185 /* If fontset name PATTERN contains any wild card, return regular
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1186 expression corresponding to PATTERN. */
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1187
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1188 static Lisp_Object
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1189 fontset_pattern_regexp (pattern)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1190 Lisp_Object pattern;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1191 {
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 45848
diff changeset
1192 if (!index (SDATA (pattern), '*')
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 45848
diff changeset
1193 && !index (SDATA (pattern), '?'))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1194 /* PATTERN does not contain any wild cards. */
17730
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
1195 return Qnil;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1196
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1197 if (!CONSP (Vcached_fontset_data)
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 45848
diff changeset
1198 || strcmp (SDATA (pattern), CACHED_FONTSET_NAME))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1199 {
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1200 /* We must at first update the cached data. */
57947
678d2c0d522e (fontset_pattern_regexp): Use unsigned char.
Kim F. Storm <storm@cua.dk>
parents: 57921
diff changeset
1201 unsigned char *regex, *p0, *p1;
57685
b935fc1cb542 (fontset_pattern_regexp): Optimize for the case that
Kenichi Handa <handa@m17n.org>
parents: 57573
diff changeset
1202 int ndashes = 0, nstars = 0;
57947
678d2c0d522e (fontset_pattern_regexp): Use unsigned char.
Kim F. Storm <storm@cua.dk>
parents: 57921
diff changeset
1203
57685
b935fc1cb542 (fontset_pattern_regexp): Optimize for the case that
Kenichi Handa <handa@m17n.org>
parents: 57573
diff changeset
1204 for (p0 = SDATA (pattern); *p0; p0++)
b935fc1cb542 (fontset_pattern_regexp): Optimize for the case that
Kenichi Handa <handa@m17n.org>
parents: 57573
diff changeset
1205 {
b935fc1cb542 (fontset_pattern_regexp): Optimize for the case that
Kenichi Handa <handa@m17n.org>
parents: 57573
diff changeset
1206 if (*p0 == '-')
b935fc1cb542 (fontset_pattern_regexp): Optimize for the case that
Kenichi Handa <handa@m17n.org>
parents: 57573
diff changeset
1207 ndashes++;
58025
bcd053632eb2 (fontset_pattern_regexp): Cancel my previous change;
Kenichi Handa <handa@m17n.org>
parents: 57947
diff changeset
1208 else if (*p0 == '*')
57685
b935fc1cb542 (fontset_pattern_regexp): Optimize for the case that
Kenichi Handa <handa@m17n.org>
parents: 57573
diff changeset
1209 nstars++;
b935fc1cb542 (fontset_pattern_regexp): Optimize for the case that
Kenichi Handa <handa@m17n.org>
parents: 57573
diff changeset
1210 }
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1211
57685
b935fc1cb542 (fontset_pattern_regexp): Optimize for the case that
Kenichi Handa <handa@m17n.org>
parents: 57573
diff changeset
1212 /* If PATTERN is not full XLFD we conert "*" to ".*". Otherwise
b935fc1cb542 (fontset_pattern_regexp): Optimize for the case that
Kenichi Handa <handa@m17n.org>
parents: 57573
diff changeset
1213 we convert "*" to "[^-]*" which is much faster in regular
b935fc1cb542 (fontset_pattern_regexp): Optimize for the case that
Kenichi Handa <handa@m17n.org>
parents: 57573
diff changeset
1214 expression matching. */
b935fc1cb542 (fontset_pattern_regexp): Optimize for the case that
Kenichi Handa <handa@m17n.org>
parents: 57573
diff changeset
1215 if (ndashes < 14)
57947
678d2c0d522e (fontset_pattern_regexp): Use unsigned char.
Kim F. Storm <storm@cua.dk>
parents: 57921
diff changeset
1216 p1 = regex = (unsigned char *) alloca (SBYTES (pattern) + 2 * nstars + 1);
57685
b935fc1cb542 (fontset_pattern_regexp): Optimize for the case that
Kenichi Handa <handa@m17n.org>
parents: 57573
diff changeset
1217 else
57947
678d2c0d522e (fontset_pattern_regexp): Use unsigned char.
Kim F. Storm <storm@cua.dk>
parents: 57921
diff changeset
1218 p1 = regex = (unsigned char *) alloca (SBYTES (pattern) + 5 * nstars + 1);
57685
b935fc1cb542 (fontset_pattern_regexp): Optimize for the case that
Kenichi Handa <handa@m17n.org>
parents: 57573
diff changeset
1219
17730
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
1220 *p1++ = '^';
57947
678d2c0d522e (fontset_pattern_regexp): Use unsigned char.
Kim F. Storm <storm@cua.dk>
parents: 57921
diff changeset
1221 for (p0 = SDATA (pattern); *p0; p0++)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1222 {
58025
bcd053632eb2 (fontset_pattern_regexp): Cancel my previous change;
Kenichi Handa <handa@m17n.org>
parents: 57947
diff changeset
1223 if (*p0 == '*')
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1224 {
57685
b935fc1cb542 (fontset_pattern_regexp): Optimize for the case that
Kenichi Handa <handa@m17n.org>
parents: 57573
diff changeset
1225 if (ndashes < 14)
b935fc1cb542 (fontset_pattern_regexp): Optimize for the case that
Kenichi Handa <handa@m17n.org>
parents: 57573
diff changeset
1226 *p1++ = '.';
b935fc1cb542 (fontset_pattern_regexp): Optimize for the case that
Kenichi Handa <handa@m17n.org>
parents: 57573
diff changeset
1227 else
b935fc1cb542 (fontset_pattern_regexp): Optimize for the case that
Kenichi Handa <handa@m17n.org>
parents: 57573
diff changeset
1228 *p1++ = '[', *p1++ = '^', *p1++ = '-', *p1++ = ']';
17730
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
1229 *p1++ = '*';
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1230 }
17730
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
1231 else if (*p0 == '?')
21127
577865651099 (fontset_pattern_regexp): `==' was used instead of `='.
Richard M. Stallman <rms@gnu.org>
parents: 20346
diff changeset
1232 *p1++ = '.';
17730
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
1233 else
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
1234 *p1++ = *p0;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1235 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1236 *p1++ = '$';
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1237 *p1++ = 0;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1238
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 45848
diff changeset
1239 Vcached_fontset_data = Fcons (build_string (SDATA (pattern)),
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1240 build_string (regex));
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1241 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1242
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1243 return CACHED_FONTSET_REGEX;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1244 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1245
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1246 /* Return ID of the base fontset named NAME. If there's no such
58025
bcd053632eb2 (fontset_pattern_regexp): Cancel my previous change;
Kenichi Handa <handa@m17n.org>
parents: 57947
diff changeset
1247 fontset, return -1. NAME_PATTERN specifies how to treat NAME as this:
bcd053632eb2 (fontset_pattern_regexp): Cancel my previous change;
Kenichi Handa <handa@m17n.org>
parents: 57947
diff changeset
1248 0: pattern containing '*' and '?' as wildcards
bcd053632eb2 (fontset_pattern_regexp): Cancel my previous change;
Kenichi Handa <handa@m17n.org>
parents: 57947
diff changeset
1249 1: regular expression
bcd053632eb2 (fontset_pattern_regexp): Cancel my previous change;
Kenichi Handa <handa@m17n.org>
parents: 57947
diff changeset
1250 2: literal fontset name
bcd053632eb2 (fontset_pattern_regexp): Cancel my previous change;
Kenichi Handa <handa@m17n.org>
parents: 57947
diff changeset
1251 */
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1252
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1253 int
58025
bcd053632eb2 (fontset_pattern_regexp): Cancel my previous change;
Kenichi Handa <handa@m17n.org>
parents: 57947
diff changeset
1254 fs_query_fontset (name, name_pattern)
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1255 Lisp_Object name;
58025
bcd053632eb2 (fontset_pattern_regexp): Cancel my previous change;
Kenichi Handa <handa@m17n.org>
parents: 57947
diff changeset
1256 int name_pattern;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1257 {
34975
0d69e2d2724e (fontset_ref): Remove unused variable `i'.
Eli Zaretskii <eliz@gnu.org>
parents: 32978
diff changeset
1258 Lisp_Object tem;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1259 int i;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1260
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1261 name = Fdowncase (name);
58025
bcd053632eb2 (fontset_pattern_regexp): Cancel my previous change;
Kenichi Handa <handa@m17n.org>
parents: 57947
diff changeset
1262 if (name_pattern != 1)
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1263 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1264 tem = Frassoc (name, Vfontset_alias_alist);
89699
cda6f41a592e (reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 89687
diff changeset
1265 if (NILP (tem))
cda6f41a592e (reorder_font_vector): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 89687
diff changeset
1266 tem = Fassoc (name, Vfontset_alias_alist);
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1267 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
1268 name = XCAR (tem);
58025
bcd053632eb2 (fontset_pattern_regexp): Cancel my previous change;
Kenichi Handa <handa@m17n.org>
parents: 57947
diff changeset
1269 else if (name_pattern == 0)
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1270 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1271 tem = fontset_pattern_regexp (name);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1272 if (STRINGP (tem))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1273 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1274 name = tem;
58025
bcd053632eb2 (fontset_pattern_regexp): Cancel my previous change;
Kenichi Handa <handa@m17n.org>
parents: 57947
diff changeset
1275 name_pattern = 1;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1276 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1277 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1278 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1279
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1280 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
1281 {
57573
43067aee2f3e (fs_load_font): Use fast_string_match_ignore_case for
Kenichi Handa <handa@m17n.org>
parents: 56293
diff changeset
1282 Lisp_Object fontset, this_name;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1283
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1284 fontset = FONTSET_FROM_ID (i);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1285 if (NILP (fontset)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1286 || !BASE_FONTSET_P (fontset))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1287 continue;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1288
57573
43067aee2f3e (fs_load_font): Use fast_string_match_ignore_case for
Kenichi Handa <handa@m17n.org>
parents: 56293
diff changeset
1289 this_name = FONTSET_NAME (fontset);
58025
bcd053632eb2 (fontset_pattern_regexp): Cancel my previous change;
Kenichi Handa <handa@m17n.org>
parents: 57947
diff changeset
1290 if (name_pattern == 1
57573
43067aee2f3e (fs_load_font): Use fast_string_match_ignore_case for
Kenichi Handa <handa@m17n.org>
parents: 56293
diff changeset
1291 ? fast_string_match (name, this_name) >= 0
43067aee2f3e (fs_load_font): Use fast_string_match_ignore_case for
Kenichi Handa <handa@m17n.org>
parents: 56293
diff changeset
1292 : !strcmp (SDATA (name), SDATA (this_name)))
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1293 return i;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1294 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1295 return -1;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1296 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1297
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1298
21553
2d7afcd11b72 (find_ccl_program_func): New variable.
Kenichi Handa <handa@m17n.org>
parents: 21514
diff changeset
1299 DEFUN ("query-fontset", Fquery_fontset, Squery_fontset, 1, 2, 0,
41001
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1300 doc: /* Return the name of a fontset that matches PATTERN.
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1301 The value is nil if there is no matching fontset.
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1302 PATTERN can contain `*' or `?' as a wildcard
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1303 just as X font name matching algorithm allows.
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1304 If REGEXPP is non-nil, PATTERN is a regular expression. */)
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1305 (pattern, regexpp)
21553
2d7afcd11b72 (find_ccl_program_func): New variable.
Kenichi Handa <handa@m17n.org>
parents: 21514
diff changeset
1306 Lisp_Object pattern, regexpp;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1307 {
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1308 Lisp_Object fontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1309 int id;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1310
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1311 (*check_window_system_func) ();
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1312
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40028
diff changeset
1313 CHECK_STRING (pattern);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1314
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 45848
diff changeset
1315 if (SCHARS (pattern) == 0)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1316 return Qnil;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1317
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1318 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
1319 if (id < 0)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1320 return Qnil;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1321
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1322 fontset = FONTSET_FROM_ID (id);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1323 return FONTSET_NAME (fontset);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1324 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1325
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1326 /* Return a list of base fontset names matching PATTERN on frame F. */
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1327
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1328 Lisp_Object
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1329 list_fontsets (f, pattern, size)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1330 FRAME_PTR f;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1331 Lisp_Object pattern;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1332 int size;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1333 {
34975
0d69e2d2724e (fontset_ref): Remove unused variable `i'.
Eli Zaretskii <eliz@gnu.org>
parents: 32978
diff changeset
1334 Lisp_Object frame, regexp, val;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1335 int id;
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 XSETFRAME (frame, f);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1338
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1339 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
1340 val = Qnil;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1341
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1342 for (id = 0; id < ASIZE (Vfontset_table); id++)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1343 {
57573
43067aee2f3e (fs_load_font): Use fast_string_match_ignore_case for
Kenichi Handa <handa@m17n.org>
parents: 56293
diff changeset
1344 Lisp_Object fontset, name;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1345
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1346 fontset = FONTSET_FROM_ID (id);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1347 if (NILP (fontset)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1348 || !BASE_FONTSET_P (fontset)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1349 || !EQ (frame, FONTSET_FRAME (fontset)))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1350 continue;
57573
43067aee2f3e (fs_load_font): Use fast_string_match_ignore_case for
Kenichi Handa <handa@m17n.org>
parents: 56293
diff changeset
1351 name = FONTSET_NAME (fontset);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1352
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1353 if (STRINGP (regexp)
57573
43067aee2f3e (fs_load_font): Use fast_string_match_ignore_case for
Kenichi Handa <handa@m17n.org>
parents: 56293
diff changeset
1354 ? (fast_string_match (regexp, name) < 0)
43067aee2f3e (fs_load_font): Use fast_string_match_ignore_case for
Kenichi Handa <handa@m17n.org>
parents: 56293
diff changeset
1355 : strcmp (SDATA (pattern), SDATA (name)))
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1356 continue;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1357
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1358 val = Fcons (Fcopy_sequence (FONTSET_NAME (fontset)), val);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1359 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1360
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1361 return val;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1362 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1363
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1364
89483
2f877ed80fa6 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88123 89428
diff changeset
1365 /* Free all realized fontsets whose base fontset is BASE. */
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1366
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1367 static void
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1368 free_realized_fontsets (base)
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1369 Lisp_Object base;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1370 {
58025
bcd053632eb2 (fontset_pattern_regexp): Cancel my previous change;
Kenichi Handa <handa@m17n.org>
parents: 57947
diff changeset
1371 int id;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1372
90806
1ae136ad0ba0 (free_realized_fontsets): Avoid unnecessary call of
Kenichi Handa <handa@m17n.org>
parents: 90802
diff changeset
1373 #if 0
88482
effba1417b74 (free_realized_fontsets): Call Fclear_face_cache instead
Kenichi Handa <handa@m17n.org>
parents: 88405
diff changeset
1374 /* For the moment, this doesn't work because free_realized_face
effba1417b74 (free_realized_fontsets): Call Fclear_face_cache instead
Kenichi Handa <handa@m17n.org>
parents: 88405
diff changeset
1375 doesn't remove FACE from a cache. Until we find a solution, we
effba1417b74 (free_realized_fontsets): Call Fclear_face_cache instead
Kenichi Handa <handa@m17n.org>
parents: 88405
diff changeset
1376 suppress this code, and simply use Fclear_face_cache even though
effba1417b74 (free_realized_fontsets): Call Fclear_face_cache instead
Kenichi Handa <handa@m17n.org>
parents: 88405
diff changeset
1377 that is not efficient. */
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1378 BLOCK_INPUT;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1379 for (id = 0; id < ASIZE (Vfontset_table); id++)
58025
bcd053632eb2 (fontset_pattern_regexp): Cancel my previous change;
Kenichi Handa <handa@m17n.org>
parents: 57947
diff changeset
1380 {
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1381 Lisp_Object this = AREF (Vfontset_table, id);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1382
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1383 if (EQ (FONTSET_BASE (this), base))
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1384 {
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1385 Lisp_Object tail;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1386
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1387 for (tail = FONTSET_FACE_ALIST (this); CONSP (tail);
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1388 tail = XCDR (tail))
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1389 {
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1390 FRAME_PTR f = XFRAME (FONTSET_FRAME (this));
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1391 int face_id = XINT (XCDR (XCAR (tail)));
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1392 struct face *face = FACE_FROM_ID (f, face_id);
89483
2f877ed80fa6 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88123 89428
diff changeset
1393
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1394 /* Face THIS itself is also freed by the following call. */
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1395 free_realized_face (f, face);
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1396 }
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1397 }
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1398 }
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1399 UNBLOCK_INPUT;
88482
effba1417b74 (free_realized_fontsets): Call Fclear_face_cache instead
Kenichi Handa <handa@m17n.org>
parents: 88405
diff changeset
1400 #else /* not 0 */
90806
1ae136ad0ba0 (free_realized_fontsets): Avoid unnecessary call of
Kenichi Handa <handa@m17n.org>
parents: 90802
diff changeset
1401 /* But, we don't have to call Fclear_face_cache if no fontset has
1ae136ad0ba0 (free_realized_fontsets): Avoid unnecessary call of
Kenichi Handa <handa@m17n.org>
parents: 90802
diff changeset
1402 been realized from BASE. */
1ae136ad0ba0 (free_realized_fontsets): Avoid unnecessary call of
Kenichi Handa <handa@m17n.org>
parents: 90802
diff changeset
1403 for (id = 0; id < ASIZE (Vfontset_table); id++)
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1404 {
90806
1ae136ad0ba0 (free_realized_fontsets): Avoid unnecessary call of
Kenichi Handa <handa@m17n.org>
parents: 90802
diff changeset
1405 Lisp_Object this = AREF (Vfontset_table, id);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1406
91046
35069180a991 Fix up multi-tty merge
Miles Bader <miles@gnu.org>
parents: 91041
diff changeset
1407 if (CHAR_TABLE_P (this) && EQ (FONTSET_BASE (this), base))
90806
1ae136ad0ba0 (free_realized_fontsets): Avoid unnecessary call of
Kenichi Handa <handa@m17n.org>
parents: 90802
diff changeset
1408 {
1ae136ad0ba0 (free_realized_fontsets): Avoid unnecessary call of
Kenichi Handa <handa@m17n.org>
parents: 90802
diff changeset
1409 Fclear_face_cache (Qt);
1ae136ad0ba0 (free_realized_fontsets): Avoid unnecessary call of
Kenichi Handa <handa@m17n.org>
parents: 90802
diff changeset
1410 break;
1ae136ad0ba0 (free_realized_fontsets): Avoid unnecessary call of
Kenichi Handa <handa@m17n.org>
parents: 90802
diff changeset
1411 }
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1412 }
88482
effba1417b74 (free_realized_fontsets): Call Fclear_face_cache instead
Kenichi Handa <handa@m17n.org>
parents: 88405
diff changeset
1413 #endif /* not 0 */
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1414 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1415
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1416
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1417 /* 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
1418 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
1419 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
1420
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1421 static Lisp_Object
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1422 check_fontset_name (name)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1423 Lisp_Object name;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1424 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1425 int id;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1426
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1427 if (EQ (name, Qt))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1428 return Vdefault_fontset;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1429
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40028
diff changeset
1430 CHECK_STRING (name);
58025
bcd053632eb2 (fontset_pattern_regexp): Cancel my previous change;
Kenichi Handa <handa@m17n.org>
parents: 57947
diff changeset
1431 /* First try NAME as literal. */
bcd053632eb2 (fontset_pattern_regexp): Cancel my previous change;
Kenichi Handa <handa@m17n.org>
parents: 57947
diff changeset
1432 id = fs_query_fontset (name, 2);
bcd053632eb2 (fontset_pattern_regexp): Cancel my previous change;
Kenichi Handa <handa@m17n.org>
parents: 57947
diff changeset
1433 if (id < 0)
bcd053632eb2 (fontset_pattern_regexp): Cancel my previous change;
Kenichi Handa <handa@m17n.org>
parents: 57947
diff changeset
1434 /* For backward compatibility, try again NAME as pattern. */
bcd053632eb2 (fontset_pattern_regexp): Cancel my previous change;
Kenichi Handa <handa@m17n.org>
parents: 57947
diff changeset
1435 id = fs_query_fontset (name, 0);
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1436 if (id < 0)
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 45848
diff changeset
1437 error ("Fontset `%s' does not exist", SDATA (name));
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1438 return FONTSET_FROM_ID (id);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1439 }
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1440
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1441 static void
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1442 accumulate_script_ranges (arg, range, val)
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1443 Lisp_Object arg, range, val;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1444 {
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1445 if (EQ (XCAR (arg), val))
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1446 {
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1447 if (CONSP (range))
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1448 XSETCDR (arg, Fcons (Fcons (XCAR (range), XCDR (range)), XCDR (arg)));
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1449 else
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1450 XSETCDR (arg, Fcons (Fcons (range, range), XCDR (arg)));
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1451 }
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1452 }
53353
b085f18ebcf0 (Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 53072
diff changeset
1453
b085f18ebcf0 (Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 53072
diff changeset
1454
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1455 /* Return an ASCII font name generated from fontset name NAME and
91169
8eb408860621 Include "font.h" unconditionally.
Kenichi Handa <handa@m17n.org>
parents: 91136
diff changeset
1456 font-spec ASCII_SPEC. NAME is a string conforming to XLFD. */
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1457
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1458 static INLINE Lisp_Object
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1459 generate_ascii_font_name (name, ascii_spec)
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1460 Lisp_Object name, ascii_spec;
53353
b085f18ebcf0 (Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 53072
diff changeset
1461 {
91169
8eb408860621 Include "font.h" unconditionally.
Kenichi Handa <handa@m17n.org>
parents: 91136
diff changeset
1462 Lisp_Object font_spec = Ffont_spec (0, NULL);
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1463 Lisp_Object vec;
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1464 int i;
91169
8eb408860621 Include "font.h" unconditionally.
Kenichi Handa <handa@m17n.org>
parents: 91136
diff changeset
1465 char xlfd[256];
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1466
91169
8eb408860621 Include "font.h" unconditionally.
Kenichi Handa <handa@m17n.org>
parents: 91136
diff changeset
1467 if (font_parse_xlfd (SDATA (name), font_spec) < 0)
8eb408860621 Include "font.h" unconditionally.
Kenichi Handa <handa@m17n.org>
parents: 91136
diff changeset
1468 error ("Not an XLFD font name: %s", SDATA (name));
8eb408860621 Include "font.h" unconditionally.
Kenichi Handa <handa@m17n.org>
parents: 91136
diff changeset
1469 for (i = FONT_FOUNDRY_INDEX; i <= FONT_WIDTH_INDEX; i++)
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1470 if (! NILP (AREF (ascii_spec, i)))
91169
8eb408860621 Include "font.h" unconditionally.
Kenichi Handa <handa@m17n.org>
parents: 91136
diff changeset
1471 ASET (font_spec, i, AREF (ascii_spec, i));
8eb408860621 Include "font.h" unconditionally.
Kenichi Handa <handa@m17n.org>
parents: 91136
diff changeset
1472 i = font_unparse_xlfd (font_spec, 0, xlfd, 256);
8eb408860621 Include "font.h" unconditionally.
Kenichi Handa <handa@m17n.org>
parents: 91136
diff changeset
1473 if (i < 0)
8eb408860621 Include "font.h" unconditionally.
Kenichi Handa <handa@m17n.org>
parents: 91136
diff changeset
1474 error ("Not an XLFD font name: %s", SDATA (name));
8eb408860621 Include "font.h" unconditionally.
Kenichi Handa <handa@m17n.org>
parents: 91136
diff changeset
1475 return make_unibyte_string (xlfd, i);
53353
b085f18ebcf0 (Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 53072
diff changeset
1476 }
b085f18ebcf0 (Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 53072
diff changeset
1477
89901
d1a1970e3dd1 (find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents: 89898
diff changeset
1478 /* Variables referred in set_fontset_font. They are set before
d1a1970e3dd1 (find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents: 89898
diff changeset
1479 map_charset_chars is called in Fset_fontset_font. */
d1a1970e3dd1 (find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents: 89898
diff changeset
1480 static Lisp_Object font_def_arg, add_arg;
d1a1970e3dd1 (find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents: 89898
diff changeset
1481 static int from_arg, to_arg;
d1a1970e3dd1 (find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents: 89898
diff changeset
1482
d1a1970e3dd1 (find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents: 89898
diff changeset
1483 /* Callback function for map_charset_chars in Fset_fontset_font. In
d1a1970e3dd1 (find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents: 89898
diff changeset
1484 FONTSET, set font_def_arg in a fashion specified by add_arg for
d1a1970e3dd1 (find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents: 89898
diff changeset
1485 characters in RANGE while ignoring the range between from_arg and
d1a1970e3dd1 (find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents: 89898
diff changeset
1486 to_arg. */
41001
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1487
89614
355fc0282e50 (set_fontset_font): New function.
Kenichi Handa <handa@m17n.org>
parents: 89610
diff changeset
1488 static void
89901
d1a1970e3dd1 (find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents: 89898
diff changeset
1489 set_fontset_font (fontset, range)
d1a1970e3dd1 (find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents: 89898
diff changeset
1490 Lisp_Object fontset, range;
89614
355fc0282e50 (set_fontset_font): New function.
Kenichi Handa <handa@m17n.org>
parents: 89610
diff changeset
1491 {
89901
d1a1970e3dd1 (find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents: 89898
diff changeset
1492 if (from_arg < to_arg)
53353
b085f18ebcf0 (Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 53072
diff changeset
1493 {
89901
d1a1970e3dd1 (find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents: 89898
diff changeset
1494 int from = XINT (XCAR (range)), to = XINT (XCDR (range));
89614
355fc0282e50 (set_fontset_font): New function.
Kenichi Handa <handa@m17n.org>
parents: 89610
diff changeset
1495
89901
d1a1970e3dd1 (find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents: 89898
diff changeset
1496 if (from < from_arg)
d1a1970e3dd1 (find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents: 89898
diff changeset
1497 {
d1a1970e3dd1 (find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents: 89898
diff changeset
1498 if (to > to_arg)
d1a1970e3dd1 (find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents: 89898
diff changeset
1499 {
d1a1970e3dd1 (find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents: 89898
diff changeset
1500 Lisp_Object range2;
41001
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1501
89901
d1a1970e3dd1 (find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents: 89898
diff changeset
1502 range2 = Fcons (make_number (to_arg), XCDR (range));
d1a1970e3dd1 (find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents: 89898
diff changeset
1503 FONTSET_ADD (fontset, range, font_def_arg, add_arg);
d1a1970e3dd1 (find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents: 89898
diff changeset
1504 to = to_arg;
d1a1970e3dd1 (find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents: 89898
diff changeset
1505 }
d1a1970e3dd1 (find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents: 89898
diff changeset
1506 if (to > from_arg)
d1a1970e3dd1 (find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents: 89898
diff changeset
1507 range = Fcons (XCAR (range), make_number (from_arg));
d1a1970e3dd1 (find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents: 89898
diff changeset
1508 }
d1a1970e3dd1 (find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents: 89898
diff changeset
1509 else if (to <= to_arg)
d1a1970e3dd1 (find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents: 89898
diff changeset
1510 return;
d1a1970e3dd1 (find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents: 89898
diff changeset
1511 else
d1a1970e3dd1 (find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents: 89898
diff changeset
1512 {
d1a1970e3dd1 (find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents: 89898
diff changeset
1513 if (from < to_arg)
d1a1970e3dd1 (find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents: 89898
diff changeset
1514 range = Fcons (make_number (to_arg), XCDR (range));
d1a1970e3dd1 (find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents: 89898
diff changeset
1515 }
53353
b085f18ebcf0 (Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 53072
diff changeset
1516 }
89901
d1a1970e3dd1 (find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents: 89898
diff changeset
1517 FONTSET_ADD (fontset, range, font_def_arg, add_arg);
53353
b085f18ebcf0 (Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 53072
diff changeset
1518 }
b085f18ebcf0 (Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 53072
diff changeset
1519
91136
d54684fee154 (fontset_find_font) [USE_FONT_BACKEND]: Try multiple
Kenichi Handa <handa@m17n.org>
parents: 91053
diff changeset
1520 extern Lisp_Object QCfamily, QCregistry;
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1521
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1522 DEFUN ("set-fontset-font", Fset_fontset_font, Sset_fontset_font, 3, 5, 0,
89483
2f877ed80fa6 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88123 89428
diff changeset
1523 doc: /*
89805
35a0a24752d3 (FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents: 89711
diff changeset
1524 Modify fontset NAME to use FONT-SPEC for TARGET characters.
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1525
89805
35a0a24752d3 (FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents: 89711
diff changeset
1526 TARGET may be a cons; (FROM . TO), where FROM and TO are characters.
35a0a24752d3 (FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents: 89711
diff changeset
1527 In that case, use FONT-SPEC for all characters in the range FROM and
35a0a24752d3 (FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents: 89711
diff changeset
1528 TO (inclusive).
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1529
89805
35a0a24752d3 (FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents: 89711
diff changeset
1530 TARGET may be a script name symbol. In that case, use FONT-SPEC for
35a0a24752d3 (FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents: 89711
diff changeset
1531 all characters that belong to the script.
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1532
89805
35a0a24752d3 (FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents: 89711
diff changeset
1533 TARGET may be a charset. In that case, use FONT-SPEC for all
89669
6871c119b186 (Fset_fontset_font): Fix docstring.
Kenichi Handa <handa@m17n.org>
parents: 89614
diff changeset
1534 characters in the charset.
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1535
89805
35a0a24752d3 (FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents: 89711
diff changeset
1536 TARGET may be nil. In that case, use FONT-SPEC for any characters for
35a0a24752d3 (FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents: 89711
diff changeset
1537 that no FONT-SPEC is specified.
35a0a24752d3 (FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents: 89711
diff changeset
1538
89940
713a4f4140ca (Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents: 89904
diff changeset
1539 FONT-SPEC may one of these:
89337
6026c8e5664f (Fset_fontset_font): Fix indentation of docstring.
Kenichi Handa <handa@m17n.org>
parents: 89069
diff changeset
1540 * A cons (FAMILY . REGISTRY), where FAMILY is a font family name and
89940
713a4f4140ca (Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents: 89904
diff changeset
1541 REGISTRY is a font registry name. FAMILY may contains foundry
713a4f4140ca (Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents: 89904
diff changeset
1542 name, and REGISTRY may contains encoding name.
88931
74d18470865c (fontset_add): Declare args. Call make_number
Dave Love <fx@gnu.org>
parents: 88903
diff changeset
1543 * A font name string.
91364
1e43b74bf9e5 (reorder_font_vector): Exclude nil elements from the
Kenichi Handa <handa@m17n.org>
parents: 91352
diff changeset
1544 * nil, which explicitly specifies that there's no font for TARGET.
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1545
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1546 Optional 4th argument FRAME, if non-nil, is a frame. This argument is
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1547 kept for backward compatibility and has no meaning.
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1548
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1549 Optional 5th argument ADD, if non-nil, specifies how to add FONT-SPEC
89805
35a0a24752d3 (FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents: 89711
diff changeset
1550 to the font specifications for TARGET previously set. If it is
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1551 `prepend', FONT-SPEC is prepended. If it is `append', FONT-SPEC is
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1552 appended. By default, FONT-SPEC overrides the previous settings. */)
89805
35a0a24752d3 (FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents: 89711
diff changeset
1553 (name, target, font_spec, frame, add)
35a0a24752d3 (FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents: 89711
diff changeset
1554 Lisp_Object name, target, font_spec, frame, add;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1555 {
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1556 Lisp_Object fontset;
90056
b0c203a8776d (Fset_fontset_font): Call find_font_encoding with
Kenichi Handa <handa@m17n.org>
parents: 90044
diff changeset
1557 Lisp_Object font_def, registry, family;
88931
74d18470865c (fontset_add): Declare args. Call make_number
Dave Love <fx@gnu.org>
parents: 88903
diff changeset
1558 Lisp_Object encoding, repertory;
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1559 Lisp_Object range_list;
89901
d1a1970e3dd1 (find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents: 89898
diff changeset
1560 struct charset *charset = NULL;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1561
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1562 fontset = check_fontset_name (name);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1563
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1564 /* 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
1565 the validity. */
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1566 if (!NILP (frame))
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40028
diff changeset
1567 CHECK_LIVE_FRAME (frame);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1568
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1569 if (VECTORP (font_spec))
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1570 {
91169
8eb408860621 Include "font.h" unconditionally.
Kenichi Handa <handa@m17n.org>
parents: 91136
diff changeset
1571 if (! FONT_SPEC_P (font_spec))
8eb408860621 Include "font.h" unconditionally.
Kenichi Handa <handa@m17n.org>
parents: 91136
diff changeset
1572 Fsignal (Qfont, list2 (build_string ("invalid font-spec"), font_spec));
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1573 }
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1574 else if (CONSP (font_spec))
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1575 {
91169
8eb408860621 Include "font.h" unconditionally.
Kenichi Handa <handa@m17n.org>
parents: 91136
diff changeset
1576 Lisp_Object args[4];
8eb408860621 Include "font.h" unconditionally.
Kenichi Handa <handa@m17n.org>
parents: 91136
diff changeset
1577 int i= 0;
8eb408860621 Include "font.h" unconditionally.
Kenichi Handa <handa@m17n.org>
parents: 91136
diff changeset
1578
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1579 family = XCAR (font_spec);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1580 registry = XCDR (font_spec);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1581
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1582 if (! NILP (family))
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1583 {
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1584 CHECK_STRING (family);
91169
8eb408860621 Include "font.h" unconditionally.
Kenichi Handa <handa@m17n.org>
parents: 91136
diff changeset
1585 args[i++] = QCfamily;
8eb408860621 Include "font.h" unconditionally.
Kenichi Handa <handa@m17n.org>
parents: 91136
diff changeset
1586 args[i++] = family;
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1587 }
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1588 CHECK_STRING (registry);
91169
8eb408860621 Include "font.h" unconditionally.
Kenichi Handa <handa@m17n.org>
parents: 91136
diff changeset
1589 args[i++] = QCregistry;
8eb408860621 Include "font.h" unconditionally.
Kenichi Handa <handa@m17n.org>
parents: 91136
diff changeset
1590 args[i++] = registry;
8eb408860621 Include "font.h" unconditionally.
Kenichi Handa <handa@m17n.org>
parents: 91136
diff changeset
1591 font_spec = Ffont_spec (i, args);
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1592 }
91352
b6befec471b8 (reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents: 91336
diff changeset
1593 else if (STRINGP (font_spec))
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1594 {
91231
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
1595 Lisp_Object args[2];
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
1596
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
1597 args[0] = QCname;
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
1598 args[1] = font_spec;
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
1599 font_spec = Ffont_spec (2, args);
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1600 }
91352
b6befec471b8 (reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents: 91336
diff changeset
1601 else if (! NILP (font_spec))
b6befec471b8 (reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents: 91336
diff changeset
1602 wrong_type_argument (intern ("font-spec"), font_spec);
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1603
91352
b6befec471b8 (reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents: 91336
diff changeset
1604 if (! NILP (font_spec))
b6befec471b8 (reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents: 91336
diff changeset
1605 {
b6befec471b8 (reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents: 91336
diff changeset
1606 family = AREF (font_spec, FONT_FAMILY_INDEX);
b6befec471b8 (reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents: 91336
diff changeset
1607 if (! NILP (family) && SYMBOLP (family))
b6befec471b8 (reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents: 91336
diff changeset
1608 family = SYMBOL_NAME (family);
b6befec471b8 (reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents: 91336
diff changeset
1609 registry = AREF (font_spec, FONT_REGISTRY_INDEX);
b6befec471b8 (reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents: 91336
diff changeset
1610 if (! NILP (registry) && SYMBOLP (registry))
b6befec471b8 (reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents: 91336
diff changeset
1611 registry = SYMBOL_NAME (registry);
b6befec471b8 (reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents: 91336
diff changeset
1612
b6befec471b8 (reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents: 91336
diff changeset
1613 encoding = find_font_encoding (concat2 (family, registry));
b6befec471b8 (reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents: 91336
diff changeset
1614 if (NILP (encoding))
b6befec471b8 (reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents: 91336
diff changeset
1615 encoding = Qascii;
91231
29d8135e8f58 (fontset_add): New args charset_id and famliy. Caller
Kenichi Handa <handa@m17n.org>
parents: 91224
diff changeset
1616
91352
b6befec471b8 (reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents: 91336
diff changeset
1617 if (SYMBOLP (encoding))
b6befec471b8 (reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents: 91336
diff changeset
1618 {
b6befec471b8 (reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents: 91336
diff changeset
1619 CHECK_CHARSET (encoding);
b6befec471b8 (reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents: 91336
diff changeset
1620 encoding = repertory = CHARSET_SYMBOL_ID (encoding);
b6befec471b8 (reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents: 91336
diff changeset
1621 }
b6befec471b8 (reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents: 91336
diff changeset
1622 else
b6befec471b8 (reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents: 91336
diff changeset
1623 {
b6befec471b8 (reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents: 91336
diff changeset
1624 repertory = XCDR (encoding);
b6befec471b8 (reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents: 91336
diff changeset
1625 encoding = XCAR (encoding);
b6befec471b8 (reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents: 91336
diff changeset
1626 CHECK_CHARSET (encoding);
b6befec471b8 (reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents: 91336
diff changeset
1627 encoding = CHARSET_SYMBOL_ID (encoding);
b6befec471b8 (reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents: 91336
diff changeset
1628 if (! NILP (repertory) && SYMBOLP (repertory))
b6befec471b8 (reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents: 91336
diff changeset
1629 {
b6befec471b8 (reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents: 91336
diff changeset
1630 CHECK_CHARSET (repertory);
b6befec471b8 (reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents: 91336
diff changeset
1631 repertory = CHARSET_SYMBOL_ID (repertory);
b6befec471b8 (reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents: 91336
diff changeset
1632 }
b6befec471b8 (reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents: 91336
diff changeset
1633 }
b6befec471b8 (reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents: 91336
diff changeset
1634 font_def = Fmake_vector (make_number (3), font_spec);
b6befec471b8 (reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents: 91336
diff changeset
1635 ASET (font_def, 1, encoding);
b6befec471b8 (reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents: 91336
diff changeset
1636 ASET (font_def, 2, repertory);
89826
b17725d55ba2 (Fset_fontset_font): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents: 89811
diff changeset
1637 }
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1638 else
91352
b6befec471b8 (reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents: 91336
diff changeset
1639 font_def = Qnil;
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1640
89805
35a0a24752d3 (FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents: 89711
diff changeset
1641 if (CHARACTERP (target))
35a0a24752d3 (FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents: 89711
diff changeset
1642 range_list = Fcons (Fcons (target, target), Qnil);
35a0a24752d3 (FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents: 89711
diff changeset
1643 else if (CONSP (target))
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1644 {
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1645 Lisp_Object from, to;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1646
89805
35a0a24752d3 (FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents: 89711
diff changeset
1647 from = Fcar (target);
35a0a24752d3 (FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents: 89711
diff changeset
1648 to = Fcdr (target);
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1649 CHECK_CHARACTER (from);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1650 CHECK_CHARACTER (to);
89805
35a0a24752d3 (FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents: 89711
diff changeset
1651 range_list = Fcons (target, Qnil);
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1652 }
89805
35a0a24752d3 (FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents: 89711
diff changeset
1653 else if (SYMBOLP (target) && !NILP (target))
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1654 {
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1655 Lisp_Object script_list;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1656 Lisp_Object val;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1657
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1658 range_list = Qnil;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1659 script_list = XCHAR_TABLE (Vchar_script_table)->extras[0];
89805
35a0a24752d3 (FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents: 89711
diff changeset
1660 if (! NILP (Fmemq (target, script_list)))
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1661 {
89805
35a0a24752d3 (FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents: 89711
diff changeset
1662 val = Fcons (target, Qnil);
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1663 map_char_table (accumulate_script_ranges, Qnil, Vchar_script_table,
89483
2f877ed80fa6 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88123 89428
diff changeset
1664 val);
2f877ed80fa6 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88123 89428
diff changeset
1665 range_list = XCDR (val);
91336
04716f23ac87 (FONTSET_REF_AND_RANGE): Delete it.
Kenichi Handa <handa@m17n.org>
parents: 91327
diff changeset
1666 if (EQ (target, Qlatin) && NILP (FONTSET_ASCII (fontset)))
90642
92baf98563e4 (Qlatin): New variable.
Kenichi Handa <handa@m17n.org>
parents: 90509
diff changeset
1667 {
92baf98563e4 (Qlatin): New variable.
Kenichi Handa <handa@m17n.org>
parents: 90509
diff changeset
1668 if (VECTORP (font_spec))
92baf98563e4 (Qlatin): New variable.
Kenichi Handa <handa@m17n.org>
parents: 90509
diff changeset
1669 val = generate_ascii_font_name (FONTSET_NAME (fontset),
92baf98563e4 (Qlatin): New variable.
Kenichi Handa <handa@m17n.org>
parents: 90509
diff changeset
1670 font_spec);
92baf98563e4 (Qlatin): New variable.
Kenichi Handa <handa@m17n.org>
parents: 90509
diff changeset
1671 else
92baf98563e4 (Qlatin): New variable.
Kenichi Handa <handa@m17n.org>
parents: 90509
diff changeset
1672 val = font_spec;
92baf98563e4 (Qlatin): New variable.
Kenichi Handa <handa@m17n.org>
parents: 90509
diff changeset
1673 FONTSET_ASCII (fontset) = val;
92baf98563e4 (Qlatin): New variable.
Kenichi Handa <handa@m17n.org>
parents: 90509
diff changeset
1674 }
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1675 }
89901
d1a1970e3dd1 (find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents: 89898
diff changeset
1676 if (CHARSETP (target))
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1677 {
91336
04716f23ac87 (FONTSET_REF_AND_RANGE): Delete it.
Kenichi Handa <handa@m17n.org>
parents: 91327
diff changeset
1678 if (EQ (target, Qascii) && NILP (FONTSET_ASCII (fontset)))
89006
faa38aebf129 (Fset_fontset_font): Treate `ascii' as charset, not script.
Kenichi Handa <handa@m17n.org>
parents: 88982
diff changeset
1679 {
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1680 if (VECTORP (font_spec))
89006
faa38aebf129 (Fset_fontset_font): Treate `ascii' as charset, not script.
Kenichi Handa <handa@m17n.org>
parents: 88982
diff changeset
1681 font_spec = generate_ascii_font_name (FONTSET_NAME (fontset),
faa38aebf129 (Fset_fontset_font): Treate `ascii' as charset, not script.
Kenichi Handa <handa@m17n.org>
parents: 88982
diff changeset
1682 font_spec);
faa38aebf129 (Fset_fontset_font): Treate `ascii' as charset, not script.
Kenichi Handa <handa@m17n.org>
parents: 88982
diff changeset
1683 FONTSET_ASCII (fontset) = font_spec;
89614
355fc0282e50 (set_fontset_font): New function.
Kenichi Handa <handa@m17n.org>
parents: 89610
diff changeset
1684 range_list = Fcons (Fcons (make_number (0), make_number (127)),
355fc0282e50 (set_fontset_font): New function.
Kenichi Handa <handa@m17n.org>
parents: 89610
diff changeset
1685 Qnil);
355fc0282e50 (set_fontset_font): New function.
Kenichi Handa <handa@m17n.org>
parents: 89610
diff changeset
1686 }
355fc0282e50 (set_fontset_font): New function.
Kenichi Handa <handa@m17n.org>
parents: 89610
diff changeset
1687 else
355fc0282e50 (set_fontset_font): New function.
Kenichi Handa <handa@m17n.org>
parents: 89610
diff changeset
1688 {
89901
d1a1970e3dd1 (find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents: 89898
diff changeset
1689 CHECK_CHARSET_GET_CHARSET (target, charset);
89006
faa38aebf129 (Fset_fontset_font): Treate `ascii' as charset, not script.
Kenichi Handa <handa@m17n.org>
parents: 88982
diff changeset
1690 }
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1691 }
89901
d1a1970e3dd1 (find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents: 89898
diff changeset
1692 else if (NILP (range_list))
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1693 error ("Invalid script or charset name: %s",
89805
35a0a24752d3 (FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents: 89711
diff changeset
1694 SDATA (SYMBOL_NAME (target)));
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1695 }
89805
35a0a24752d3 (FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents: 89711
diff changeset
1696 else if (NILP (target))
35a0a24752d3 (FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents: 89711
diff changeset
1697 range_list = Fcons (Qnil, Qnil);
35a0a24752d3 (FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents: 89711
diff changeset
1698 else
35a0a24752d3 (FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents: 89711
diff changeset
1699 error ("Invalid target for setting a font");
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1700
89901
d1a1970e3dd1 (find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents: 89898
diff changeset
1701
d1a1970e3dd1 (find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents: 89898
diff changeset
1702 if (charset)
d1a1970e3dd1 (find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents: 89898
diff changeset
1703 {
d1a1970e3dd1 (find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents: 89898
diff changeset
1704 font_def_arg = font_def;
d1a1970e3dd1 (find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents: 89898
diff changeset
1705 add_arg = add;
d1a1970e3dd1 (find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents: 89898
diff changeset
1706 if (NILP (range_list))
d1a1970e3dd1 (find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents: 89898
diff changeset
1707 from_arg = to_arg = 0;
d1a1970e3dd1 (find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents: 89898
diff changeset
1708 else
d1a1970e3dd1 (find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents: 89898
diff changeset
1709 from_arg = XINT (XCAR (XCAR (range_list))),
d1a1970e3dd1 (find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents: 89898
diff changeset
1710 to_arg = XINT (XCDR (XCAR (range_list)));
d1a1970e3dd1 (find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents: 89898
diff changeset
1711
d1a1970e3dd1 (find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents: 89898
diff changeset
1712 map_charset_chars (set_fontset_font, Qnil, fontset, charset,
d1a1970e3dd1 (find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents: 89898
diff changeset
1713 CHARSET_MIN_CODE (charset),
d1a1970e3dd1 (find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents: 89898
diff changeset
1714 CHARSET_MAX_CODE (charset));
d1a1970e3dd1 (find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents: 89898
diff changeset
1715 }
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1716 for (; CONSP (range_list); range_list = XCDR (range_list))
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1717 FONTSET_ADD (fontset, XCAR (range_list), font_def, add);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1718
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1719 /* Free all realized fontsets whose base is FONTSET. This way, the
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1720 specified character(s) are surely redisplayed by a correct
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1721 font. */
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1722 free_realized_fontsets (fontset);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1723
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1724 return Qnil;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1725 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1726
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1727
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1728 DEFUN ("new-fontset", Fnew_fontset, Snew_fontset, 2, 2, 0,
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1729 doc: /* Create a new fontset NAME from font information in FONTLIST.
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1730
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1731 FONTLIST is an alist of scripts vs the corresponding font specification list.
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1732 Each element of FONTLIST has the form (SCRIPT FONT-SPEC ...), where a
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1733 character of SCRIPT is displayed by a font that matches one of
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1734 FONT-SPEC.
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1735
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1736 SCRIPT is a symbol that appears in the first extra slot of the
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1737 char-table `char-script-table'.
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1738
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1739 FONT-SPEC is a vector, a cons, or a string. See the documentation of
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1740 `set-fontset-font' for the meaning. */)
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1741 (name, fontlist)
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1742 Lisp_Object name, fontlist;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1743 {
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1744 Lisp_Object fontset;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1745 Lisp_Object val;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1746 int id;
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1747
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1748 CHECK_STRING (name);
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1749 CHECK_LIST (fontlist);
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1750
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1751 id = fs_query_fontset (name, 0);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1752 if (id < 0)
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1753 {
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1754 name = Fdowncase (name);
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1755 val = split_font_name_into_vector (name);
89603
7f9f2d025eee (Fnew_fontset): Check NAME more rigidly.
Kenichi Handa <handa@m17n.org>
parents: 89572
diff changeset
1756 if (NILP (val) || NILP (AREF (val, 12)) || NILP (AREF (val, 13)))
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1757 error ("Fontset name must be in XLFD format");
89483
2f877ed80fa6 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88123 89428
diff changeset
1758 if (strcmp (SDATA (AREF (val, 12)), "fontset"))
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1759 error ("Registry field of fontset name must be \"fontset\"");
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1760 Vfontset_alias_alist
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1761 = Fcons (Fcons (name,
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1762 concat2 (concat2 (AREF (val, 12), build_string ("-")),
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1763 AREF (val, 13))),
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1764 Vfontset_alias_alist);
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1765 ASET (val, 12, build_string ("iso8859-1"));
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1766 fontset = make_fontset (Qnil, name, Qnil);
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1767 FONTSET_ASCII (fontset) = build_font_name_from_vector (val);
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1768 }
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1769 else
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1770 {
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1771 fontset = FONTSET_FROM_ID (id);;
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1772 free_realized_fontsets (fontset);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1773 Fset_char_table_range (fontset, Qt, Qnil);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1774 }
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1775
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1776 for (; ! NILP (fontlist); fontlist = Fcdr (fontlist))
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1777 {
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1778 Lisp_Object elt, script;
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1779
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1780 elt = Fcar (fontlist);
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1781 script = Fcar (elt);
89607
9090f7eba02c (Fnew_fontset): Check NAME more rigidly.
Kenichi Handa <handa@m17n.org>
parents: 89603
diff changeset
1782 elt = Fcdr (elt);
9090f7eba02c (Fnew_fontset): Check NAME more rigidly.
Kenichi Handa <handa@m17n.org>
parents: 89603
diff changeset
1783 if (CONSP (elt) && (NILP (XCDR (elt)) || CONSP (XCDR (elt))))
9090f7eba02c (Fnew_fontset): Check NAME more rigidly.
Kenichi Handa <handa@m17n.org>
parents: 89603
diff changeset
1784 for (; CONSP (elt); elt = XCDR (elt))
9090f7eba02c (Fnew_fontset): Check NAME more rigidly.
Kenichi Handa <handa@m17n.org>
parents: 89603
diff changeset
1785 Fset_fontset_font (name, script, XCAR (elt), Qnil, Qappend);
9090f7eba02c (Fnew_fontset): Check NAME more rigidly.
Kenichi Handa <handa@m17n.org>
parents: 89603
diff changeset
1786 else
9090f7eba02c (Fnew_fontset): Check NAME more rigidly.
Kenichi Handa <handa@m17n.org>
parents: 89603
diff changeset
1787 Fset_fontset_font (name, script, elt, Qnil, Qappend);
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
1788 }
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1789 return name;
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1790 }
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1791
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
1792
89610
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1793 /* Alist of automatically created fontsets. Each element is a cons
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1794 (FONTNAME . FONTSET-ID). */
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1795 static Lisp_Object auto_fontset_alist;
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1796
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1797 int
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1798 new_fontset_from_font_name (Lisp_Object fontname)
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1799 {
89610
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1800 Lisp_Object val;
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1801 Lisp_Object name;
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1802 Lisp_Object vec;
89610
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1803 int id;
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1804
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1805 fontname = Fdowncase (fontname);
89610
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1806 val = Fassoc (fontname, auto_fontset_alist);
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1807 if (CONSP (val))
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1808 return XINT (XCDR (val));
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1809
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1810 vec = split_font_name_into_vector (fontname);
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1811 if ( NILP (vec))
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1812 vec = Fmake_vector (make_number (14), build_string (""));
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1813 ASET (vec, 12, build_string ("fontset"));
89610
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1814 if (NILP (auto_fontset_alist))
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1815 {
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1816 ASET (vec, 13, build_string ("startup"));
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1817 name = build_font_name_from_vector (vec);
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1818 }
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1819 else
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1820 {
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1821 char temp[20];
89865
d2b1cc2ef7f1 Include "intervals.h".
Kenichi Handa <handa@m17n.org>
parents: 89826
diff changeset
1822 int len = XINT (Flength (auto_fontset_alist));
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1823
89610
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1824 sprintf (temp, "auto%d", len);
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1825 ASET (vec, 13, build_string (temp));
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1826 name = build_font_name_from_vector (vec);
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1827 }
89901
d1a1970e3dd1 (find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents: 89898
diff changeset
1828 name = Fnew_fontset (name, list2 (list2 (Qascii, fontname),
d1a1970e3dd1 (find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents: 89898
diff changeset
1829 list2 (Fcons (make_number (0),
89711
fca3686ff6bb (new_fontset_from_font_name): Use the specified font
Kenichi Handa <handa@m17n.org>
parents: 89699
diff changeset
1830 make_number (MAX_CHAR)),
89901
d1a1970e3dd1 (find_font_encoding): Return `ascii' for unknown
Kenichi Handa <handa@m17n.org>
parents: 89898
diff changeset
1831 fontname)));
89610
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1832 id = fs_query_fontset (name, 0);
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1833 auto_fontset_alist
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1834 = Fcons (Fcons (fontname, make_number (id)), auto_fontset_alist);
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
1835 return id;
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1836 }
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1837
90410
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
1838 #ifdef USE_FONT_BACKEND
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
1839 int
90466
4c9461c6aef4 (new_fontset_from_font) [USE_FONT_BACKEND]: Argument F
Kenichi Handa <handa@m17n.org>
parents: 90449
diff changeset
1840 new_fontset_from_font (font_object)
90410
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
1841 Lisp_Object font_object;
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
1842 {
90466
4c9461c6aef4 (new_fontset_from_font) [USE_FONT_BACKEND]: Argument F
Kenichi Handa <handa@m17n.org>
parents: 90449
diff changeset
1843 Lisp_Object font_name = font_get_name (font_object);
4c9461c6aef4 (new_fontset_from_font) [USE_FONT_BACKEND]: Argument F
Kenichi Handa <handa@m17n.org>
parents: 90449
diff changeset
1844 Lisp_Object font_spec = font_get_spec (font_object);
90802
bfafc889caa9 (fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents: 90737
diff changeset
1845 Lisp_Object fontset_spec, short_name, name, fontset;
90466
4c9461c6aef4 (new_fontset_from_font) [USE_FONT_BACKEND]: Argument F
Kenichi Handa <handa@m17n.org>
parents: 90449
diff changeset
1846
4c9461c6aef4 (new_fontset_from_font) [USE_FONT_BACKEND]: Argument F
Kenichi Handa <handa@m17n.org>
parents: 90449
diff changeset
1847 if (NILP (auto_fontset_alist))
4c9461c6aef4 (new_fontset_from_font) [USE_FONT_BACKEND]: Argument F
Kenichi Handa <handa@m17n.org>
parents: 90449
diff changeset
1848 short_name = build_string ("fontset-startup");
4c9461c6aef4 (new_fontset_from_font) [USE_FONT_BACKEND]: Argument F
Kenichi Handa <handa@m17n.org>
parents: 90449
diff changeset
1849 else
4c9461c6aef4 (new_fontset_from_font) [USE_FONT_BACKEND]: Argument F
Kenichi Handa <handa@m17n.org>
parents: 90449
diff changeset
1850 {
4c9461c6aef4 (new_fontset_from_font) [USE_FONT_BACKEND]: Argument F
Kenichi Handa <handa@m17n.org>
parents: 90449
diff changeset
1851 char temp[32];
4c9461c6aef4 (new_fontset_from_font) [USE_FONT_BACKEND]: Argument F
Kenichi Handa <handa@m17n.org>
parents: 90449
diff changeset
1852 int len = XINT (Flength (auto_fontset_alist));
90410
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
1853
90466
4c9461c6aef4 (new_fontset_from_font) [USE_FONT_BACKEND]: Argument F
Kenichi Handa <handa@m17n.org>
parents: 90449
diff changeset
1854 sprintf (temp, "fontset-auto%d", len);
4c9461c6aef4 (new_fontset_from_font) [USE_FONT_BACKEND]: Argument F
Kenichi Handa <handa@m17n.org>
parents: 90449
diff changeset
1855 short_name = build_string (temp);
4c9461c6aef4 (new_fontset_from_font) [USE_FONT_BACKEND]: Argument F
Kenichi Handa <handa@m17n.org>
parents: 90449
diff changeset
1856 }
90802
bfafc889caa9 (fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents: 90737
diff changeset
1857 fontset_spec = Fcopy_sequence (font_spec);
bfafc889caa9 (fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents: 90737
diff changeset
1858 ASET (fontset_spec, FONT_REGISTRY_INDEX, short_name);
bfafc889caa9 (fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents: 90737
diff changeset
1859 name = Ffont_xlfd_name (fontset_spec);
90466
4c9461c6aef4 (new_fontset_from_font) [USE_FONT_BACKEND]: Argument F
Kenichi Handa <handa@m17n.org>
parents: 90449
diff changeset
1860 if (NILP (name))
4c9461c6aef4 (new_fontset_from_font) [USE_FONT_BACKEND]: Argument F
Kenichi Handa <handa@m17n.org>
parents: 90449
diff changeset
1861 {
4c9461c6aef4 (new_fontset_from_font) [USE_FONT_BACKEND]: Argument F
Kenichi Handa <handa@m17n.org>
parents: 90449
diff changeset
1862 int i;
90410
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
1863
90466
4c9461c6aef4 (new_fontset_from_font) [USE_FONT_BACKEND]: Argument F
Kenichi Handa <handa@m17n.org>
parents: 90449
diff changeset
1864 for (i = 0; i < FONT_SIZE_INDEX; i++)
4c9461c6aef4 (new_fontset_from_font) [USE_FONT_BACKEND]: Argument F
Kenichi Handa <handa@m17n.org>
parents: 90449
diff changeset
1865 if ((i != FONT_FAMILY_INDEX) && (i != FONT_REGISTRY_INDEX))
90802
bfafc889caa9 (fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents: 90737
diff changeset
1866 ASET (fontset_spec, i, Qnil);
bfafc889caa9 (fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents: 90737
diff changeset
1867 name = Ffont_xlfd_name (fontset_spec);
90466
4c9461c6aef4 (new_fontset_from_font) [USE_FONT_BACKEND]: Argument F
Kenichi Handa <handa@m17n.org>
parents: 90449
diff changeset
1868 if (NILP (name))
4c9461c6aef4 (new_fontset_from_font) [USE_FONT_BACKEND]: Argument F
Kenichi Handa <handa@m17n.org>
parents: 90449
diff changeset
1869 abort ();
4c9461c6aef4 (new_fontset_from_font) [USE_FONT_BACKEND]: Argument F
Kenichi Handa <handa@m17n.org>
parents: 90449
diff changeset
1870 }
4c9461c6aef4 (new_fontset_from_font) [USE_FONT_BACKEND]: Argument F
Kenichi Handa <handa@m17n.org>
parents: 90449
diff changeset
1871 fontset = make_fontset (Qnil, name, Qnil);
4c9461c6aef4 (new_fontset_from_font) [USE_FONT_BACKEND]: Argument F
Kenichi Handa <handa@m17n.org>
parents: 90449
diff changeset
1872 FONTSET_ASCII (fontset) = font_name;
90802
bfafc889caa9 (fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents: 90737
diff changeset
1873 font_spec = Fcons (SYMBOL_NAME (AREF (font_spec, FONT_FAMILY_INDEX)),
bfafc889caa9 (fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents: 90737
diff changeset
1874 SYMBOL_NAME (AREF (font_spec, FONT_REGISTRY_INDEX)));
bfafc889caa9 (fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents: 90737
diff changeset
1875 Fset_fontset_font (name, Qlatin, font_spec, Qnil, Qnil);
91336
04716f23ac87 (FONTSET_REF_AND_RANGE): Delete it.
Kenichi Handa <handa@m17n.org>
parents: 91327
diff changeset
1876 XSETCDR (font_spec, build_string ("iso10646-1"));
04716f23ac87 (FONTSET_REF_AND_RANGE): Delete it.
Kenichi Handa <handa@m17n.org>
parents: 91327
diff changeset
1877 Fset_fontset_font (name, Qlatin, font_spec, Qnil, Qappend);
90802
bfafc889caa9 (fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents: 90737
diff changeset
1878 Fset_fontset_font (name, Qnil, font_spec, Qnil, Qnil);
90466
4c9461c6aef4 (new_fontset_from_font) [USE_FONT_BACKEND]: Argument F
Kenichi Handa <handa@m17n.org>
parents: 90449
diff changeset
1879 return XINT (FONTSET_ID (fontset));
90410
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
1880 }
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
1881
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
1882 struct font *
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
1883 fontset_ascii_font (f, id)
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
1884 FRAME_PTR f;
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
1885 int id;
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
1886 {
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
1887 Lisp_Object fontset = FONTSET_FROM_ID (id);
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
1888 Lisp_Object ascii_slot = FONTSET_ASCII (fontset);
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
1889 Lisp_Object val, font_object;
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
1890
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
1891 if (CONSP (ascii_slot))
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
1892 {
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
1893 Lisp_Object ascii_font_name = XCAR (ascii_slot);
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
1894
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
1895 font_object = Qnil;
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
1896 for (val = XCDR (ascii_slot); ! NILP (val); val = XCDR (val))
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
1897 {
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
1898 Lisp_Object frame = font_get_frame (XCAR (val));
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
1899
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
1900 if (NILP (frame) || XFRAME (frame) == f)
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
1901 {
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
1902 font_object = XCAR (val);
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
1903 if (XSAVE_VALUE (font_object)->integer == 0)
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
1904 {
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
1905 font_object = font_open_by_name (f, SDATA (ascii_font_name));
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
1906 XSETCAR (val, font_object);
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
1907 }
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
1908 break;
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
1909 }
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
1910 }
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
1911 if (NILP (font_object))
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
1912 {
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
1913 font_object = font_open_by_name (f, SDATA (ascii_font_name));
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
1914 XSETCDR (ascii_slot, Fcons (font_object, XCDR (ascii_slot)));
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
1915 }
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
1916 }
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
1917 else
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
1918 {
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
1919 font_object = font_open_by_name (f, SDATA (ascii_slot));
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
1920 FONTSET_ASCII (fontset) = Fcons (ascii_slot, Fcons (font_object, Qnil));
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
1921 }
90440
33277d7748f3 (reorder_font_vector): Pay attention to the case that
Kenichi Handa <handa@m17n.org>
parents: 90410
diff changeset
1922 if (NILP (font_object))
33277d7748f3 (reorder_font_vector): Pay attention to the case that
Kenichi Handa <handa@m17n.org>
parents: 90410
diff changeset
1923 return NULL;
90410
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
1924 return XSAVE_VALUE (font_object)->pointer;
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
1925 }
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
1926
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
1927 #endif /* USE_FONT_BACKEND */
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
1928
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1929 DEFUN ("font-info", Ffont_info, Sfont_info, 1, 2, 0,
41001
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1930 doc: /* Return information about a font named NAME on frame FRAME.
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1931 If FRAME is omitted or nil, use the selected frame.
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1932 The returned value is a vector of OPENED-NAME, FULL-NAME, CHARSET, SIZE,
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1933 HEIGHT, BASELINE-OFFSET, RELATIVE-COMPOSE, and DEFAULT-ASCENT,
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1934 where
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1935 OPENED-NAME is the name used for opening the font,
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1936 FULL-NAME is the full name of the font,
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1937 SIZE is the maximum bound width of the font,
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1938 HEIGHT is the height of the font,
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1939 BASELINE-OFFSET is the upward offset pixels from ASCII baseline,
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1940 RELATIVE-COMPOSE and DEFAULT-ASCENT are the numbers controlling
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1941 how to compose characters.
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1942 If the named font is not yet loaded, return nil. */)
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
1943 (name, frame)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1944 Lisp_Object name, frame;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1945 {
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1946 FRAME_PTR f;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1947 struct font_info *fontp;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1948 Lisp_Object info;
90410
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
1949 Lisp_Object font_object;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1950
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1951 (*check_window_system_func) ();
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1952
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40028
diff changeset
1953 CHECK_STRING (name);
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1954 name = Fdowncase (name);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1955 if (NILP (frame))
25668
99290b59352d (Ffont_info): Change for Lisp_Object selected_frame.
Gerd Moellmann <gerd@gnu.org>
parents: 24611
diff changeset
1956 frame = selected_frame;
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40028
diff changeset
1957 CHECK_LIVE_FRAME (frame);
25668
99290b59352d (Ffont_info): Change for Lisp_Object selected_frame.
Gerd Moellmann <gerd@gnu.org>
parents: 24611
diff changeset
1958 f = XFRAME (frame);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1959
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1960 if (!query_font_func)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1961 error ("Font query function is not supported");
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1962
90410
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
1963 #ifdef USE_FONT_BACKEND
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
1964 if (enable_font_backend)
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
1965 {
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
1966 font_object = font_open_by_name (f, SDATA (name));
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
1967 if (NILP (font_object))
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
1968 fontp = NULL;
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
1969 else
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
1970 fontp = (struct font_info *) XSAVE_VALUE (font_object)->pointer;
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
1971 }
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
1972 else
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
1973 #endif /* USE_FONT_BACKEND */
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 45848
diff changeset
1974 fontp = (*query_font_func) (f, SDATA (name));
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1975 if (!fontp)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1976 return Qnil;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1977
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
1978 info = Fmake_vector (make_number (7), Qnil);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1979
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1980 XVECTOR (info)->contents[0] = build_string (fontp->name);
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1981 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
1982 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
1983 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
1984 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
1985 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
1986 XVECTOR (info)->contents[6] = make_number (fontp->default_ascent);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1987
90410
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
1988 #ifdef USE_FONT_BACKEND
91908
6916adc8df33 (FONTSET_OBJLIST): New macro.
Kenichi Handa <handa@m17n.org>
parents: 91887
diff changeset
1989 if (enable_font_backend && ! NILP (font_object))
90410
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
1990 font_close_object (f, font_object);
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
1991 #endif /* USE_FONT_BACKEND */
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1992 return info;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1993 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1994
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1995
52654
2e5944e29aa0 (Finternal_char_font): Change return value to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1996 /* Return a cons (FONT-NAME . GLYPH-CODE).
2e5944e29aa0 (Finternal_char_font): Change return value to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
1997 FONT-NAME is the font name for the character at POSITION in the current
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
1998 buffer. This is computed from all the text properties and overlays
55094
450b41d3c078 (Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents: 54995
diff changeset
1999 that apply to POSITION. POSTION may be nil, in which case,
450b41d3c078 (Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents: 54995
diff changeset
2000 FONT-NAME is the font name for display the character CH with the
450b41d3c078 (Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents: 54995
diff changeset
2001 default face.
450b41d3c078 (Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents: 54995
diff changeset
2002
52654
2e5944e29aa0 (Finternal_char_font): Change return value to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
2003 GLYPH-CODE is the glyph code in the font to use for the character.
2e5944e29aa0 (Finternal_char_font): Change return value to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
2004
2e5944e29aa0 (Finternal_char_font): Change return value to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
2005 If the 2nd optional arg CH is non-nil, it is a character to check
2e5944e29aa0 (Finternal_char_font): Change return value to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
2006 the font instead of the character at POSITION.
2e5944e29aa0 (Finternal_char_font): Change return value to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
2007
2e5944e29aa0 (Finternal_char_font): Change return value to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
2008 It returns nil in the following cases:
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
2009
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
2010 (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
2011 it is displayed by an empty box).
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
2012
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
2013 (2) The character code is invalid.
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
2014
55094
450b41d3c078 (Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents: 54995
diff changeset
2015 (3) If POSITION is not nil, and the current buffer is not displayed
450b41d3c078 (Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents: 54995
diff changeset
2016 in any window.
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
2017
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
2018 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
2019 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
2020 POSITION is currently not visible. */
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
2021
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
2022
52654
2e5944e29aa0 (Finternal_char_font): Change return value to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
2023 DEFUN ("internal-char-font", Finternal_char_font, Sinternal_char_font, 1, 2, 0,
41001
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
2024 doc: /* For internal use only. */)
52654
2e5944e29aa0 (Finternal_char_font): Change return value to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
2025 (position, ch)
2e5944e29aa0 (Finternal_char_font): Change return value to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
2026 Lisp_Object position, ch;
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
2027 {
92237
ce06567a933d * dispextern.h (face_at_buffer_position, face_for_overlay_string)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 91908
diff changeset
2028 EMACS_INT pos, pos_byte, dummy;
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
2029 int face_id;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
2030 int c;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
2031 struct frame *f;
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
2032 struct face *face;
89898
0167306cb580 (fontset_font): Renamed from fontset_face. Return
Kenichi Handa <handa@m17n.org>
parents: 89865
diff changeset
2033 Lisp_Object charset, rfont_def;
90725
6d8c81691fc8 (Finternal_char_font): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents: 90716
diff changeset
2034 int cs_id;
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
2035
55094
450b41d3c078 (Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents: 54995
diff changeset
2036 if (NILP (position))
52654
2e5944e29aa0 (Finternal_char_font): Change return value to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
2037 {
89904
76c449b624ad Sync to HEAD.
Kenichi Handa <handa@m17n.org>
parents: 89901
diff changeset
2038 CHECK_CHARACTER (ch);
52654
2e5944e29aa0 (Finternal_char_font): Change return value to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
2039 c = XINT (ch);
55094
450b41d3c078 (Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents: 54995
diff changeset
2040 f = XFRAME (selected_frame);
450b41d3c078 (Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents: 54995
diff changeset
2041 face_id = DEFAULT_FACE_ID;
89943
4c90ffeb71c5 Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
parents: 89940 55094
diff changeset
2042 pos = -1;
90725
6d8c81691fc8 (Finternal_char_font): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents: 90716
diff changeset
2043 cs_id = -1;
55094
450b41d3c078 (Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents: 54995
diff changeset
2044 }
450b41d3c078 (Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents: 54995
diff changeset
2045 else
450b41d3c078 (Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents: 54995
diff changeset
2046 {
90716
f5dc0b9a442c (Finternal_char_font): Fix for the case of POSITION
Kenichi Handa <handa@m17n.org>
parents: 90642
diff changeset
2047 Lisp_Object window, charset;
55094
450b41d3c078 (Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents: 54995
diff changeset
2048 struct window *w;
450b41d3c078 (Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents: 54995
diff changeset
2049
450b41d3c078 (Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents: 54995
diff changeset
2050 CHECK_NUMBER_COERCE_MARKER (position);
450b41d3c078 (Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents: 54995
diff changeset
2051 pos = XINT (position);
450b41d3c078 (Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents: 54995
diff changeset
2052 if (pos < BEGV || pos >= ZV)
450b41d3c078 (Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents: 54995
diff changeset
2053 args_out_of_range_3 (position, make_number (BEGV), make_number (ZV));
450b41d3c078 (Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents: 54995
diff changeset
2054 pos_byte = CHAR_TO_BYTE (pos);
450b41d3c078 (Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents: 54995
diff changeset
2055 if (NILP (ch))
450b41d3c078 (Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents: 54995
diff changeset
2056 c = FETCH_CHAR (pos_byte);
450b41d3c078 (Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents: 54995
diff changeset
2057 else
450b41d3c078 (Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents: 54995
diff changeset
2058 {
450b41d3c078 (Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents: 54995
diff changeset
2059 CHECK_NATNUM (ch);
450b41d3c078 (Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents: 54995
diff changeset
2060 c = XINT (ch);
450b41d3c078 (Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents: 54995
diff changeset
2061 }
450b41d3c078 (Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents: 54995
diff changeset
2062 window = Fget_buffer_window (Fcurrent_buffer (), Qnil);
450b41d3c078 (Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents: 54995
diff changeset
2063 if (NILP (window))
450b41d3c078 (Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents: 54995
diff changeset
2064 return Qnil;
450b41d3c078 (Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents: 54995
diff changeset
2065 w = XWINDOW (window);
450b41d3c078 (Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents: 54995
diff changeset
2066 f = XFRAME (w->frame);
450b41d3c078 (Finternal_char_font): If POSITION is nil, return
Kenichi Handa <handa@m17n.org>
parents: 54995
diff changeset
2067 face_id = face_at_buffer_position (w, pos, -1, -1, &dummy, pos + 100, 0);
90716
f5dc0b9a442c (Finternal_char_font): Fix for the case of POSITION
Kenichi Handa <handa@m17n.org>
parents: 90642
diff changeset
2068 charset = Fget_char_property (position, Qcharset, Qnil);
f5dc0b9a442c (Finternal_char_font): Fix for the case of POSITION
Kenichi Handa <handa@m17n.org>
parents: 90642
diff changeset
2069 if (CHARSETP (charset))
90725
6d8c81691fc8 (Finternal_char_font): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents: 90716
diff changeset
2070 cs_id = XINT (CHARSET_SYMBOL_ID (charset));
90716
f5dc0b9a442c (Finternal_char_font): Fix for the case of POSITION
Kenichi Handa <handa@m17n.org>
parents: 90642
diff changeset
2071 else
90725
6d8c81691fc8 (Finternal_char_font): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents: 90716
diff changeset
2072 cs_id = -1;
52654
2e5944e29aa0 (Finternal_char_font): Change return value to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
2073 }
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
2074 if (! CHAR_VALID_P (c, 0))
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
2075 return Qnil;
89943
4c90ffeb71c5 Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
parents: 89940 55094
diff changeset
2076 face_id = FACE_FOR_CHAR (f, FACE_FROM_ID (f, face_id), c, pos, Qnil);
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
2077 face = FACE_FROM_ID (f, face_id);
90725
6d8c81691fc8 (Finternal_char_font): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents: 90716
diff changeset
2078 rfont_def = fontset_font (FONTSET_FROM_ID (face->fontset), c, face, cs_id);
90410
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
2079 #ifdef USE_FONT_BACKEND
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
2080 if (enable_font_backend)
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
2081 {
91136
d54684fee154 (fontset_find_font) [USE_FONT_BACKEND]: Try multiple
Kenichi Handa <handa@m17n.org>
parents: 91053
diff changeset
2082 if (VECTORP (rfont_def) && ! NILP (AREF (rfont_def, 3)))
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
2083 {
91352
b6befec471b8 (reorder_font_vector): Fix typo.
Kenichi Handa <handa@m17n.org>
parents: 91336
diff changeset
2084 Lisp_Object font_object = AREF (rfont_def, 3);
90410
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
2085 struct font *font = XSAVE_VALUE (font_object)->pointer;
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
2086 unsigned code = font->driver->encode_char (font, c);
90475
b19205fb08bd (Finternal_char_font): Use font_get_name, not
Kenichi Handa <handa@m17n.org>
parents: 90466
diff changeset
2087 Lisp_Object fontname = font_get_name (font_object);
91887
507af35dcead (Finternal_char_font): Fix compilation warning.
Glenn Morris <rgm@gnu.org>
parents: 91668
diff changeset
2088 /* Assignment to EMACS_INT stops GCC whining about limited range
507af35dcead (Finternal_char_font): Fix compilation warning.
Glenn Morris <rgm@gnu.org>
parents: 91668
diff changeset
2089 of data type. */
507af35dcead (Finternal_char_font): Fix compilation warning.
Glenn Morris <rgm@gnu.org>
parents: 91668
diff changeset
2090 EMACS_INT cod = code;
49874
3bdee1887901 (check_fontset_name): If NAME is nil, return the
Kenichi Handa <handa@m17n.org>
parents: 49286
diff changeset
2091
90410
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
2092 if (code == FONT_INVALID_CODE)
91364
1e43b74bf9e5 (reorder_font_vector): Exclude nil elements from the
Kenichi Handa <handa@m17n.org>
parents: 91352
diff changeset
2093 return Qnil;
91887
507af35dcead (Finternal_char_font): Fix compilation warning.
Glenn Morris <rgm@gnu.org>
parents: 91668
diff changeset
2094 if (cod <= MOST_POSITIVE_FIXNUM)
90410
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
2095 return Fcons (fontname, make_number (code));
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
2096 return Fcons (fontname, Fcons (make_number (code >> 16),
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
2097 make_number (code & 0xFFFF)));
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
2098 }
90410
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
2099 return Qnil;
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
2100 }
90410
55a58b0d3d9e Include "font.h".
Kenichi Handa <handa@m17n.org>
parents: 90294
diff changeset
2101 #endif /* USE_FONT_BACKEND */
89904
76c449b624ad Sync to HEAD.
Kenichi Handa <handa@m17n.org>
parents: 89901
diff changeset
2102 if (VECTORP (rfont_def) && STRINGP (AREF (rfont_def, 3)))
76c449b624ad Sync to HEAD.
Kenichi Handa <handa@m17n.org>
parents: 89901
diff changeset
2103 {
76c449b624ad Sync to HEAD.
Kenichi Handa <handa@m17n.org>
parents: 89901
diff changeset
2104 Lisp_Object font_def;
76c449b624ad Sync to HEAD.
Kenichi Handa <handa@m17n.org>
parents: 89901
diff changeset
2105 struct font_info *fontp;
76c449b624ad Sync to HEAD.
Kenichi Handa <handa@m17n.org>
parents: 89901
diff changeset
2106 struct charset *charset;
76c449b624ad Sync to HEAD.
Kenichi Handa <handa@m17n.org>
parents: 89901
diff changeset
2107 XChar2b char2b;
76c449b624ad Sync to HEAD.
Kenichi Handa <handa@m17n.org>
parents: 89901
diff changeset
2108 int code;
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
2109
89904
76c449b624ad Sync to HEAD.
Kenichi Handa <handa@m17n.org>
parents: 89901
diff changeset
2110 font_def = AREF (rfont_def, 2);
76c449b624ad Sync to HEAD.
Kenichi Handa <handa@m17n.org>
parents: 89901
diff changeset
2111 charset = CHARSET_FROM_ID (XINT (AREF (font_def, 1)));
76c449b624ad Sync to HEAD.
Kenichi Handa <handa@m17n.org>
parents: 89901
diff changeset
2112 code = ENCODE_CHAR (charset, c);
76c449b624ad Sync to HEAD.
Kenichi Handa <handa@m17n.org>
parents: 89901
diff changeset
2113 if (code == CHARSET_INVALID_CODE (charset))
76c449b624ad Sync to HEAD.
Kenichi Handa <handa@m17n.org>
parents: 89901
diff changeset
2114 return (Fcons (AREF (rfont_def, 3), Qnil));
76c449b624ad Sync to HEAD.
Kenichi Handa <handa@m17n.org>
parents: 89901
diff changeset
2115 STORE_XCHAR2B (&char2b, ((code >> 8) & 0xFF), (code & 0xFF));
76c449b624ad Sync to HEAD.
Kenichi Handa <handa@m17n.org>
parents: 89901
diff changeset
2116 fontp = (*get_font_info_func) (f, XINT (AREF (rfont_def, 1)));
91041
bdb3fe0ba9fa Merge from emacs--devo--0
Miles Bader <miles@gnu.org>
parents: 91005 83652
diff changeset
2117 FRAME_RIF (f)->encode_char (c, &char2b, fontp, charset, NULL);
89904
76c449b624ad Sync to HEAD.
Kenichi Handa <handa@m17n.org>
parents: 89901
diff changeset
2118 code = (XCHAR2B_BYTE1 (&char2b) << 8) | XCHAR2B_BYTE2 (&char2b);
76c449b624ad Sync to HEAD.
Kenichi Handa <handa@m17n.org>
parents: 89901
diff changeset
2119 return (Fcons (AREF (rfont_def, 3), make_number (code)));
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
2120 }
89904
76c449b624ad Sync to HEAD.
Kenichi Handa <handa@m17n.org>
parents: 89901
diff changeset
2121 return Qnil;
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
2122 }
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
2123
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
2124
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
2125 DEFUN ("fontset-info", Ffontset_info, Sfontset_info, 1, 2, 0,
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
2126 doc: /* Return information about a fontset FONTSET on frame FRAME.
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
2127 The value is a char-table of which elements has this form.
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
2128
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
2129 ((FONT-PATTERN OPENED-FONT ...) ...)
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
2130
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
2131 FONT-PATTERN is a vector:
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
2132
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
2133 [ FAMILY WEIGHT SLANT SWIDTH ADSTYLE REGISTRY ]
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
2134
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
2135 or a string of font name pattern.
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
2136
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
2137 OPENED-FONT is a name of a font actually opened.
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
2138
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
2139 The char-table has one extra slot. The value is a char-table
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
2140 containing the information about the derived fonts from the default
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
2141 fontset. The format is the same as abobe. */)
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
2142 (fontset, frame)
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
2143 Lisp_Object fontset, frame;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
2144 {
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
2145 FRAME_PTR f;
89811
d13626b05df3 (fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents: 89805
diff changeset
2146 Lisp_Object *realized[2], fontsets[2], tables[2];
d13626b05df3 (fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents: 89805
diff changeset
2147 Lisp_Object val, elt;
d13626b05df3 (fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents: 89805
diff changeset
2148 int c, i, j, k;
41987
34952771ae85 Fix typos, remove unnecessary space.
Pavel Janík <Pavel@Janik.cz>
parents: 41052
diff changeset
2149
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
2150 (*check_window_system_func) ();
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
2151
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
2152 fontset = check_fontset_name (fontset);
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
2153
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
2154 if (NILP (frame))
25668
99290b59352d (Ffont_info): Change for Lisp_Object selected_frame.
Gerd Moellmann <gerd@gnu.org>
parents: 24611
diff changeset
2155 frame = selected_frame;
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40028
diff changeset
2156 CHECK_LIVE_FRAME (frame);
25668
99290b59352d (Ffont_info): Change for Lisp_Object selected_frame.
Gerd Moellmann <gerd@gnu.org>
parents: 24611
diff changeset
2157 f = XFRAME (frame);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
2158
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
2159 /* Recode fontsets realized on FRAME from the base fontset FONTSET
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
2160 in the table `realized'. */
89811
d13626b05df3 (fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents: 89805
diff changeset
2161 realized[0] = (Lisp_Object *) alloca (sizeof (Lisp_Object)
d13626b05df3 (fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents: 89805
diff changeset
2162 * ASIZE (Vfontset_table));
d13626b05df3 (fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents: 89805
diff changeset
2163 for (i = j = 0; i < ASIZE (Vfontset_table); i++)
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
2164 {
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
2165 elt = FONTSET_FROM_ID (i);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
2166 if (!NILP (elt)
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
2167 && EQ (FONTSET_BASE (elt), fontset)
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
2168 && EQ (FONTSET_FRAME (elt), frame))
89811
d13626b05df3 (fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents: 89805
diff changeset
2169 realized[0][j++] = elt;
49874
3bdee1887901 (check_fontset_name): If NAME is nil, return the
Kenichi Handa <handa@m17n.org>
parents: 49286
diff changeset
2170 }
89811
d13626b05df3 (fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents: 89805
diff changeset
2171 realized[0][j] = Qnil;
49874
3bdee1887901 (check_fontset_name): If NAME is nil, return the
Kenichi Handa <handa@m17n.org>
parents: 49286
diff changeset
2172
89811
d13626b05df3 (fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents: 89805
diff changeset
2173 realized[1] = (Lisp_Object *) alloca (sizeof (Lisp_Object)
d13626b05df3 (fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents: 89805
diff changeset
2174 * ASIZE (Vfontset_table));
d13626b05df3 (fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents: 89805
diff changeset
2175 for (i = j = 0; ! NILP (realized[0][i]); i++)
d13626b05df3 (fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents: 89805
diff changeset
2176 {
d13626b05df3 (fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents: 89805
diff changeset
2177 elt = FONTSET_DEFAULT (realized[0][i]);
d13626b05df3 (fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents: 89805
diff changeset
2178 if (! NILP (elt))
d13626b05df3 (fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents: 89805
diff changeset
2179 realized[1][j++] = elt;
d13626b05df3 (fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents: 89805
diff changeset
2180 }
d13626b05df3 (fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents: 89805
diff changeset
2181 realized[1][j] = Qnil;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
2182
89811
d13626b05df3 (fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents: 89805
diff changeset
2183 tables[0] = Fmake_char_table (Qfontset_info, Qnil);
d13626b05df3 (fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents: 89805
diff changeset
2184 tables[1] = Fmake_char_table (Qnil, Qnil);
d13626b05df3 (fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents: 89805
diff changeset
2185 XCHAR_TABLE (tables[0])->extras[0] = tables[1];
d13626b05df3 (fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents: 89805
diff changeset
2186 fontsets[0] = fontset;
d13626b05df3 (fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents: 89805
diff changeset
2187 fontsets[1] = Vdefault_fontset;
d13626b05df3 (fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents: 89805
diff changeset
2188
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
2189 /* Accumulate information of the fontset in TABLE. The format of
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
2190 each element is ((FONT-SPEC OPENED-FONT ...) ...). */
89811
d13626b05df3 (fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents: 89805
diff changeset
2191 for (k = 0; k <= 1; k++)
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
2192 {
89811
d13626b05df3 (fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents: 89805
diff changeset
2193 for (c = 0; c <= MAX_CHAR; )
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
2194 {
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
2195 int from, to;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
2196
89811
d13626b05df3 (fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents: 89805
diff changeset
2197 if (c <= MAX_5_BYTE_CHAR)
d13626b05df3 (fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents: 89805
diff changeset
2198 {
d13626b05df3 (fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents: 89805
diff changeset
2199 val = char_table_ref_and_range (fontsets[k], c, &from, &to);
d13626b05df3 (fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents: 89805
diff changeset
2200 if (to > MAX_5_BYTE_CHAR)
d13626b05df3 (fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents: 89805
diff changeset
2201 to = MAX_5_BYTE_CHAR;
d13626b05df3 (fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents: 89805
diff changeset
2202 }
d13626b05df3 (fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents: 89805
diff changeset
2203 else
d13626b05df3 (fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents: 89805
diff changeset
2204 {
d13626b05df3 (fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents: 89805
diff changeset
2205 val = FONTSET_FALLBACK (fontsets[k]);
d13626b05df3 (fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents: 89805
diff changeset
2206 to = MAX_CHAR;
d13626b05df3 (fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents: 89805
diff changeset
2207 }
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
2208 if (VECTORP (val))
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
2209 {
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
2210 Lisp_Object alist;
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
2211
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
2212 /* At first, set ALIST to ((FONT-SPEC) ...). */
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
2213 for (alist = Qnil, i = 0; i < ASIZE (val); i++)
91513
53399782ad84 (Ffontset_info): Handle the case of inhibitting the
Kenichi Handa <handa@m17n.org>
parents: 91364
diff changeset
2214 {
53399782ad84 (Ffontset_info): Handle the case of inhibitting the
Kenichi Handa <handa@m17n.org>
parents: 91364
diff changeset
2215 if (NILP (AREF (val, i)))
53399782ad84 (Ffontset_info): Handle the case of inhibitting the
Kenichi Handa <handa@m17n.org>
parents: 91364
diff changeset
2216 alist = Fcons (Qnil, alist);
53399782ad84 (Ffontset_info): Handle the case of inhibitting the
Kenichi Handa <handa@m17n.org>
parents: 91364
diff changeset
2217 else
53399782ad84 (Ffontset_info): Handle the case of inhibitting the
Kenichi Handa <handa@m17n.org>
parents: 91364
diff changeset
2218 alist = Fcons (Fcons (AREF (AREF (val, i), 0), Qnil), alist);
53399782ad84 (Ffontset_info): Handle the case of inhibitting the
Kenichi Handa <handa@m17n.org>
parents: 91364
diff changeset
2219 }
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
2220 alist = Fnreverse (alist);
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
2221
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
2222 /* Then store opend font names to cdr of each elements. */
89811
d13626b05df3 (fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents: 89805
diff changeset
2223 for (i = 0; ! NILP (realized[k][i]); i++)
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
2224 {
89811
d13626b05df3 (fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents: 89805
diff changeset
2225 if (c <= MAX_5_BYTE_CHAR)
d13626b05df3 (fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents: 89805
diff changeset
2226 val = FONTSET_REF (realized[k][i], c);
d13626b05df3 (fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents: 89805
diff changeset
2227 else
d13626b05df3 (fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents: 89805
diff changeset
2228 val = FONTSET_FALLBACK (realized[k][i]);
d13626b05df3 (fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents: 89805
diff changeset
2229 if (! VECTORP (val))
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
2230 continue;
91513
53399782ad84 (Ffontset_info): Handle the case of inhibitting the
Kenichi Handa <handa@m17n.org>
parents: 91364
diff changeset
2231 #ifdef USE_FONT_BACKEND
53399782ad84 (Ffontset_info): Handle the case of inhibitting the
Kenichi Handa <handa@m17n.org>
parents: 91364
diff changeset
2232 /* VAL: [int int ?
53399782ad84 (Ffontset_info): Handle the case of inhibitting the
Kenichi Handa <handa@m17n.org>
parents: 91364
diff changeset
2233 [FACE-ID FONT-INDEX FONT-DEF FONT-ENTITY/OBJECT]
53399782ad84 (Ffontset_info): Handle the case of inhibitting the
Kenichi Handa <handa@m17n.org>
parents: 91364
diff changeset
2234 ...] */
53399782ad84 (Ffontset_info): Handle the case of inhibitting the
Kenichi Handa <handa@m17n.org>
parents: 91364
diff changeset
2235 if (enable_font_backend)
53399782ad84 (Ffontset_info): Handle the case of inhibitting the
Kenichi Handa <handa@m17n.org>
parents: 91364
diff changeset
2236 for (j = 3; j < ASIZE (val); j++)
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
2237 {
91513
53399782ad84 (Ffontset_info): Handle the case of inhibitting the
Kenichi Handa <handa@m17n.org>
parents: 91364
diff changeset
2238 elt = AREF (val, j);
53399782ad84 (Ffontset_info): Handle the case of inhibitting the
Kenichi Handa <handa@m17n.org>
parents: 91364
diff changeset
2239 if (INTEGERP (AREF (elt, 1))
53399782ad84 (Ffontset_info): Handle the case of inhibitting the
Kenichi Handa <handa@m17n.org>
parents: 91364
diff changeset
2240 && XINT (AREF (elt, 1)) >= 0)
53399782ad84 (Ffontset_info): Handle the case of inhibitting the
Kenichi Handa <handa@m17n.org>
parents: 91364
diff changeset
2241 {
53399782ad84 (Ffontset_info): Handle the case of inhibitting the
Kenichi Handa <handa@m17n.org>
parents: 91364
diff changeset
2242 Lisp_Object font_object = AREF (elt, 3);
53399782ad84 (Ffontset_info): Handle the case of inhibitting the
Kenichi Handa <handa@m17n.org>
parents: 91364
diff changeset
2243
53399782ad84 (Ffontset_info): Handle the case of inhibitting the
Kenichi Handa <handa@m17n.org>
parents: 91364
diff changeset
2244 if (FONT_OBJECT_P (font_object))
53399782ad84 (Ffontset_info): Handle the case of inhibitting the
Kenichi Handa <handa@m17n.org>
parents: 91364
diff changeset
2245 {
53399782ad84 (Ffontset_info): Handle the case of inhibitting the
Kenichi Handa <handa@m17n.org>
parents: 91364
diff changeset
2246 struct font *font
53399782ad84 (Ffontset_info): Handle the case of inhibitting the
Kenichi Handa <handa@m17n.org>
parents: 91364
diff changeset
2247 = XSAVE_VALUE (font_object)->pointer;
92705
e9a2a0f6094f (Ffontset_info): Remove extra ;
Jan Djärv <jan.h.d@swipnet.se>
parents: 92237
diff changeset
2248 char *name = font->font.full_name;
91513
53399782ad84 (Ffontset_info): Handle the case of inhibitting the
Kenichi Handa <handa@m17n.org>
parents: 91364
diff changeset
2249 int len = strlen (name);
53399782ad84 (Ffontset_info): Handle the case of inhibitting the
Kenichi Handa <handa@m17n.org>
parents: 91364
diff changeset
2250 Lisp_Object slot;
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
2251
91513
53399782ad84 (Ffontset_info): Handle the case of inhibitting the
Kenichi Handa <handa@m17n.org>
parents: 91364
diff changeset
2252 slot = Fassq (AREF (AREF (elt, 2), 0), alist);
53399782ad84 (Ffontset_info): Handle the case of inhibitting the
Kenichi Handa <handa@m17n.org>
parents: 91364
diff changeset
2253 nconc2 (slot,
53399782ad84 (Ffontset_info): Handle the case of inhibitting the
Kenichi Handa <handa@m17n.org>
parents: 91364
diff changeset
2254 Fcons (make_unibyte_string (name, len),
53399782ad84 (Ffontset_info): Handle the case of inhibitting the
Kenichi Handa <handa@m17n.org>
parents: 91364
diff changeset
2255 Qnil));
53399782ad84 (Ffontset_info): Handle the case of inhibitting the
Kenichi Handa <handa@m17n.org>
parents: 91364
diff changeset
2256 }
53399782ad84 (Ffontset_info): Handle the case of inhibitting the
Kenichi Handa <handa@m17n.org>
parents: 91364
diff changeset
2257 }
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
2258 }
91513
53399782ad84 (Ffontset_info): Handle the case of inhibitting the
Kenichi Handa <handa@m17n.org>
parents: 91364
diff changeset
2259 else
53399782ad84 (Ffontset_info): Handle the case of inhibitting the
Kenichi Handa <handa@m17n.org>
parents: 91364
diff changeset
2260 #endif /* not USE_FONT_BACKEND */
53399782ad84 (Ffontset_info): Handle the case of inhibitting the
Kenichi Handa <handa@m17n.org>
parents: 91364
diff changeset
2261 {
53399782ad84 (Ffontset_info): Handle the case of inhibitting the
Kenichi Handa <handa@m17n.org>
parents: 91364
diff changeset
2262 /* VAL is [int int ?
53399782ad84 (Ffontset_info): Handle the case of inhibitting the
Kenichi Handa <handa@m17n.org>
parents: 91364
diff changeset
2263 [FACE-ID FONT-INDEX FONT-DEF FONT-NAME] ...].
53399782ad84 (Ffontset_info): Handle the case of inhibitting the
Kenichi Handa <handa@m17n.org>
parents: 91364
diff changeset
2264 If a font of an element is already opened,
53399782ad84 (Ffontset_info): Handle the case of inhibitting the
Kenichi Handa <handa@m17n.org>
parents: 91364
diff changeset
2265 FONT-NAME is the name of a opened font. */
53399782ad84 (Ffontset_info): Handle the case of inhibitting the
Kenichi Handa <handa@m17n.org>
parents: 91364
diff changeset
2266 for (j = 3; j < ASIZE (val); j++)
53399782ad84 (Ffontset_info): Handle the case of inhibitting the
Kenichi Handa <handa@m17n.org>
parents: 91364
diff changeset
2267 if (STRINGP (AREF (AREF (val, j), 3)))
53399782ad84 (Ffontset_info): Handle the case of inhibitting the
Kenichi Handa <handa@m17n.org>
parents: 91364
diff changeset
2268 {
53399782ad84 (Ffontset_info): Handle the case of inhibitting the
Kenichi Handa <handa@m17n.org>
parents: 91364
diff changeset
2269 Lisp_Object font_idx;
53399782ad84 (Ffontset_info): Handle the case of inhibitting the
Kenichi Handa <handa@m17n.org>
parents: 91364
diff changeset
2270
53399782ad84 (Ffontset_info): Handle the case of inhibitting the
Kenichi Handa <handa@m17n.org>
parents: 91364
diff changeset
2271 font_idx = AREF (AREF (val, j), 1);
53399782ad84 (Ffontset_info): Handle the case of inhibitting the
Kenichi Handa <handa@m17n.org>
parents: 91364
diff changeset
2272 elt = Fassq (AREF (AREF (AREF (val, j), 2), 0),
53399782ad84 (Ffontset_info): Handle the case of inhibitting the
Kenichi Handa <handa@m17n.org>
parents: 91364
diff changeset
2273 alist);
53399782ad84 (Ffontset_info): Handle the case of inhibitting the
Kenichi Handa <handa@m17n.org>
parents: 91364
diff changeset
2274 if (CONSP (elt)
53399782ad84 (Ffontset_info): Handle the case of inhibitting the
Kenichi Handa <handa@m17n.org>
parents: 91364
diff changeset
2275 && NILP (Fmemq (font_idx, XCDR(elt))))
53399782ad84 (Ffontset_info): Handle the case of inhibitting the
Kenichi Handa <handa@m17n.org>
parents: 91364
diff changeset
2276 nconc2 (elt, Fcons (font_idx, Qnil));
53399782ad84 (Ffontset_info): Handle the case of inhibitting the
Kenichi Handa <handa@m17n.org>
parents: 91364
diff changeset
2277 }
53399782ad84 (Ffontset_info): Handle the case of inhibitting the
Kenichi Handa <handa@m17n.org>
parents: 91364
diff changeset
2278 for (val = alist; CONSP (val); val = XCDR (val))
53399782ad84 (Ffontset_info): Handle the case of inhibitting the
Kenichi Handa <handa@m17n.org>
parents: 91364
diff changeset
2279 for (elt = XCDR (XCAR (val)); CONSP (elt);
53399782ad84 (Ffontset_info): Handle the case of inhibitting the
Kenichi Handa <handa@m17n.org>
parents: 91364
diff changeset
2280 elt = XCDR (elt))
53399782ad84 (Ffontset_info): Handle the case of inhibitting the
Kenichi Handa <handa@m17n.org>
parents: 91364
diff changeset
2281 {
53399782ad84 (Ffontset_info): Handle the case of inhibitting the
Kenichi Handa <handa@m17n.org>
parents: 91364
diff changeset
2282 struct font_info *font_info
53399782ad84 (Ffontset_info): Handle the case of inhibitting the
Kenichi Handa <handa@m17n.org>
parents: 91364
diff changeset
2283 = (*get_font_info_func) (f, XINT (XCAR (elt)));
53399782ad84 (Ffontset_info): Handle the case of inhibitting the
Kenichi Handa <handa@m17n.org>
parents: 91364
diff changeset
2284 XSETCAR (elt, build_string (font_info->full_name));
53399782ad84 (Ffontset_info): Handle the case of inhibitting the
Kenichi Handa <handa@m17n.org>
parents: 91364
diff changeset
2285 }
53399782ad84 (Ffontset_info): Handle the case of inhibitting the
Kenichi Handa <handa@m17n.org>
parents: 91364
diff changeset
2286 }
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
2287 }
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
2288
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
2289 /* Store ALIST in TBL for characters C..TO. */
89811
d13626b05df3 (fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents: 89805
diff changeset
2290 if (c <= MAX_5_BYTE_CHAR)
d13626b05df3 (fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents: 89805
diff changeset
2291 char_table_set_range (tables[k], c, to, alist);
d13626b05df3 (fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents: 89805
diff changeset
2292 else
d13626b05df3 (fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents: 89805
diff changeset
2293 XCHAR_TABLE (tables[k])->defalt = alist;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
2294 }
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
2295 c = to + 1;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
2296 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
2297 }
30124
26076259e03f (Ffontset_info): Make the return value more compatible
Kenichi Handa <handa@m17n.org>
parents: 29767
diff changeset
2298
89811
d13626b05df3 (fontset_face): Handle fallback fonts correctly.
Kenichi Handa <handa@m17n.org>
parents: 89805
diff changeset
2299 return tables[0];
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
2300 }
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
2301
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
2302
89940
713a4f4140ca (Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents: 89904
diff changeset
2303 DEFUN ("fontset-font", Ffontset_font, Sfontset_font, 2, 3, 0,
41001
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
2304 doc: /* Return a font name pattern for character CH in fontset NAME.
89940
713a4f4140ca (Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents: 89904
diff changeset
2305 If NAME is t, find a pattern in the default fontset.
713a4f4140ca (Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents: 89904
diff changeset
2306
713a4f4140ca (Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents: 89904
diff changeset
2307 The value has the form (FAMILY . REGISTRY), where FAMILY is a font
713a4f4140ca (Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents: 89904
diff changeset
2308 family name and REGISTRY is a font registry name. This is actually
713a4f4140ca (Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents: 89904
diff changeset
2309 the first font name pattern for CH in the fontset or in the default
713a4f4140ca (Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents: 89904
diff changeset
2310 fontset.
713a4f4140ca (Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents: 89904
diff changeset
2311
713a4f4140ca (Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents: 89904
diff changeset
2312 If the 2nd optional arg ALL is non-nil, return a list of all font name
713a4f4140ca (Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents: 89904
diff changeset
2313 patterns. */)
713a4f4140ca (Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents: 89904
diff changeset
2314 (name, ch, all)
713a4f4140ca (Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents: 89904
diff changeset
2315 Lisp_Object name, ch, all;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
2316 {
34975
0d69e2d2724e (fontset_ref): Remove unused variable `i'.
Eli Zaretskii <eliz@gnu.org>
parents: 32978
diff changeset
2317 int c;
89940
713a4f4140ca (Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents: 89904
diff changeset
2318 Lisp_Object fontset, elt, list, repertory, val;
713a4f4140ca (Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents: 89904
diff changeset
2319 int i, j;
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
2320
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
2321 fontset = check_fontset_name (name);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
2322
88405
8ae0d0693ed9 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 41987
diff changeset
2323 CHECK_CHARACTER (ch);
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
2324 c = XINT (ch);
89940
713a4f4140ca (Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents: 89904
diff changeset
2325 list = Qnil;
713a4f4140ca (Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents: 89904
diff changeset
2326 while (1)
713a4f4140ca (Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents: 89904
diff changeset
2327 {
713a4f4140ca (Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents: 89904
diff changeset
2328 for (i = 0, elt = FONTSET_REF (fontset, c); i < 2;
713a4f4140ca (Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents: 89904
diff changeset
2329 i++, elt = FONTSET_FALLBACK (fontset))
713a4f4140ca (Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents: 89904
diff changeset
2330 if (VECTORP (elt))
713a4f4140ca (Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents: 89904
diff changeset
2331 for (j = 0; j < ASIZE (elt); j++)
713a4f4140ca (Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents: 89904
diff changeset
2332 {
713a4f4140ca (Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents: 89904
diff changeset
2333 val = AREF (elt, j);
713a4f4140ca (Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents: 89904
diff changeset
2334 repertory = AREF (val, 1);
713a4f4140ca (Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents: 89904
diff changeset
2335 if (INTEGERP (repertory))
713a4f4140ca (Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents: 89904
diff changeset
2336 {
713a4f4140ca (Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents: 89904
diff changeset
2337 struct charset *charset = CHARSET_FROM_ID (XINT (repertory));
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
2338
89940
713a4f4140ca (Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents: 89904
diff changeset
2339 if (! CHAR_CHARSET_P (c, charset))
713a4f4140ca (Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents: 89904
diff changeset
2340 continue;
713a4f4140ca (Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents: 89904
diff changeset
2341 }
713a4f4140ca (Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents: 89904
diff changeset
2342 else if (CHAR_TABLE_P (repertory))
713a4f4140ca (Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents: 89904
diff changeset
2343 {
713a4f4140ca (Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents: 89904
diff changeset
2344 if (NILP (CHAR_TABLE_REF (repertory, c)))
713a4f4140ca (Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents: 89904
diff changeset
2345 continue;
713a4f4140ca (Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents: 89904
diff changeset
2346 }
713a4f4140ca (Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents: 89904
diff changeset
2347 val = AREF (val, 0);
713a4f4140ca (Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents: 89904
diff changeset
2348 val = Fcons (AREF (val, 0), AREF (val, 5));
713a4f4140ca (Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents: 89904
diff changeset
2349 if (NILP (all))
713a4f4140ca (Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents: 89904
diff changeset
2350 return val;
713a4f4140ca (Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents: 89904
diff changeset
2351 list = Fcons (val, list);
713a4f4140ca (Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents: 89904
diff changeset
2352 }
713a4f4140ca (Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents: 89904
diff changeset
2353 if (EQ (fontset, Vdefault_fontset))
713a4f4140ca (Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents: 89904
diff changeset
2354 break;
713a4f4140ca (Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents: 89904
diff changeset
2355 fontset = Vdefault_fontset;
713a4f4140ca (Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents: 89904
diff changeset
2356 }
713a4f4140ca (Fset_fontset_font): Docstring fixed.
Kenichi Handa <handa@m17n.org>
parents: 89904
diff changeset
2357 return (Fnreverse (list));
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
2358 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
2359
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
2360 DEFUN ("fontset-list", Ffontset_list, Sfontset_list, 0, 0, 0,
41001
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
2361 doc: /* Return a list of all defined fontset names. */)
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
2362 ()
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
2363 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
2364 Lisp_Object fontset, list;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
2365 int i;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
2366
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
2367 list = Qnil;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
2368 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
2369 {
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
2370 fontset = FONTSET_FROM_ID (i);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
2371 if (!NILP (fontset)
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
2372 && BASE_FONTSET_P (fontset))
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
2373 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
2374 }
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
2375
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
2376 return list;
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
2377 }
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
2378
89610
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
2379
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
2380 #ifdef FONTSET_DEBUG
53353
b085f18ebcf0 (Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 53072
diff changeset
2381
89610
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
2382 Lisp_Object
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
2383 dump_fontset (fontset)
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
2384 Lisp_Object fontset;
53353
b085f18ebcf0 (Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 53072
diff changeset
2385 {
89610
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
2386 Lisp_Object vec;
53353
b085f18ebcf0 (Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 53072
diff changeset
2387
89610
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
2388 vec = Fmake_vector (make_number (3), Qnil);
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
2389 ASET (vec, 0, FONTSET_ID (fontset));
53353
b085f18ebcf0 (Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 53072
diff changeset
2390
89610
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
2391 if (BASE_FONTSET_P (fontset))
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
2392 {
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
2393 ASET (vec, 1, FONTSET_NAME (fontset));
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
2394 }
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
2395 else
53353
b085f18ebcf0 (Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 53072
diff changeset
2396 {
89610
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
2397 Lisp_Object frame;
53353
b085f18ebcf0 (Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 53072
diff changeset
2398
89610
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
2399 frame = FONTSET_FRAME (fontset);
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
2400 if (FRAMEP (frame))
53353
b085f18ebcf0 (Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 53072
diff changeset
2401 {
89610
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
2402 FRAME_PTR f = XFRAME (frame);
53353
b085f18ebcf0 (Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 53072
diff changeset
2403
89610
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
2404 if (FRAME_LIVE_P (f))
90802
bfafc889caa9 (fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents: 90737
diff changeset
2405 ASET (vec, 1,
bfafc889caa9 (fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents: 90737
diff changeset
2406 Fcons (FONTSET_NAME (FONTSET_BASE (fontset)), f->name));
89610
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
2407 else
90802
bfafc889caa9 (fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents: 90737
diff changeset
2408 ASET (vec, 1,
bfafc889caa9 (fontset_find_font): New function.
Kenichi Handa <handa@m17n.org>
parents: 90737
diff changeset
2409 Fcons (FONTSET_NAME (FONTSET_BASE (fontset)), Qnil));
53353
b085f18ebcf0 (Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 53072
diff changeset
2410 }
89805
35a0a24752d3 (FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents: 89711
diff changeset
2411 if (!NILP (FONTSET_DEFAULT (fontset)))
35a0a24752d3 (FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents: 89711
diff changeset
2412 ASET (vec, 2, FONTSET_ID (FONTSET_DEFAULT (fontset)));
53353
b085f18ebcf0 (Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 53072
diff changeset
2413 }
89610
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
2414 return vec;
53353
b085f18ebcf0 (Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 53072
diff changeset
2415 }
b085f18ebcf0 (Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 53072
diff changeset
2416
89610
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
2417 DEFUN ("fontset-list-all", Ffontset_list_all, Sfontset_list_all, 0, 0, 0,
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
2418 doc: /* Return a brief summary of all fontsets for debug use. */)
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
2419 ()
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
2420 {
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
2421 Lisp_Object val;
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
2422 int i;
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
2423
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
2424 for (i = 0, val = Qnil; i < ASIZE (Vfontset_table); i++)
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
2425 if (! NILP (AREF (Vfontset_table, i)))
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
2426 val = Fcons (dump_fontset (AREF (Vfontset_table, i)), val);
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
2427 return (Fnreverse (val));
53353
b085f18ebcf0 (Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 53072
diff changeset
2428 }
89610
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
2429 #endif /* FONTSET_DEBUG */
53353
b085f18ebcf0 (Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 53072
diff changeset
2430
21514
fa9ff387d260 Fix -Wimplicit warnings.
Andreas Schwab <schwab@suse.de>
parents: 21127
diff changeset
2431 void
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
2432 syms_of_fontset ()
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
2433 {
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
2434 if (!load_font_func)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
2435 /* Window system initializer should have set proper functions. */
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
2436 abort ();
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
2437
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
2438 DEFSYM (Qfontset, "fontset");
89805
35a0a24752d3 (FONTSET_DEFAULT): New macro.
Kenichi Handa <handa@m17n.org>
parents: 89711
diff changeset
2439 Fput (Qfontset, Qchar_table_extra_slots, make_number (9));
89349
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
2440 DEFSYM (Qfontset_info, "fontset-info");
9a305cf42688 Give 8 extra slots to fontset objects.
Kenichi Handa <handa@m17n.org>
parents: 89337
diff changeset
2441 Fput (Qfontset_info, Qchar_table_extra_slots, make_number (1));
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
2442
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
2443 DEFSYM (Qprepend, "prepend");
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
2444 DEFSYM (Qappend, "append");
90642
92baf98563e4 (Qlatin): New variable.
Kenichi Handa <handa@m17n.org>
parents: 90509
diff changeset
2445 DEFSYM (Qlatin, "latin");
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
2446
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
2447 Vcached_fontset_data = Qnil;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
2448 staticpro (&Vcached_fontset_data);
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
2449
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
2450 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
2451 staticpro (&Vfontset_table);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
2452
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
2453 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
2454 staticpro (&Vdefault_fontset);
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
2455 FONTSET_ID (Vdefault_fontset) = make_number (0);
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
2456 FONTSET_NAME (Vdefault_fontset)
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
2457 = build_string ("-*-*-*-*-*-*-*-*-*-*-*-*-fontset-default");
91668
aeadaa72f7b1 (free_face_fontset): Use FONTSET_FROM_ID.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 91513
diff changeset
2458 ASET (Vfontset_table, 0, Vdefault_fontset);
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
2459 next_fontset_id = 1;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
2460
89610
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
2461 auto_fontset_alist = Qnil;
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
2462 staticpro (&auto_fontset_alist);
53353
b085f18ebcf0 (Voverriding_fontspec_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 53072
diff changeset
2463
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
2464 DEFVAR_LISP ("font-encoding-alist", &Vfont_encoding_alist,
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
2465 doc: /*
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
2466 Alist of fontname patterns vs the corresponding encoding and repertory info.
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
2467 Each element looks like (REGEXP . (ENCODING . REPERTORY)),
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
2468 where ENCODING is a charset or a char-table,
89483
2f877ed80fa6 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88123 89428
diff changeset
2469 and REPERTORY is a charset, a char-table, or nil.
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
2470
91266
3cd59392b3ec (Vfont_encoding_charset_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 91250
diff changeset
2471 If ENCDING and REPERTORY are the same, the element can have the form
3cd59392b3ec (Vfont_encoding_charset_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 91250
diff changeset
2472 \(REGEXP . ENCODING).
3cd59392b3ec (Vfont_encoding_charset_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 91250
diff changeset
2473
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
2474 ENCODING is for converting a character to a glyph code of the font.
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
2475 If ENCODING is a charset, encoding a character by the charset gives
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
2476 the corresponding glyph code. If ENCODING is a char-table, looking up
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
2477 the table by a character gives the corresponding glyph code.
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
2478
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
2479 REPERTORY specifies a repertory of characters supported by the font.
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
2480 If REPERTORY is a charset, all characters beloging to the charset are
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
2481 supported. If REPERTORY is a char-table, all characters who have a
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
2482 non-nil value in the table are supported. It REPERTORY is nil, Emacs
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
2483 gets the repertory information by an opened font and ENCODING. */);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
2484 Vfont_encoding_alist = Qnil;
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
2485
91266
3cd59392b3ec (Vfont_encoding_charset_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 91250
diff changeset
2486 DEFVAR_LISP ("font-encoding-charset-alist", &Vfont_encoding_charset_alist,
3cd59392b3ec (Vfont_encoding_charset_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 91250
diff changeset
2487 doc: /*
3cd59392b3ec (Vfont_encoding_charset_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 91250
diff changeset
2488 Alist of charsets vs the charsets to determine the preferred font encoding.
3cd59392b3ec (Vfont_encoding_charset_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 91250
diff changeset
2489 Each element looks like (CHARSET . ENCDOING-CHARSET),
3cd59392b3ec (Vfont_encoding_charset_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 91250
diff changeset
2490 where ENCODING-CHARSET is a charset registered in the variable
3cd59392b3ec (Vfont_encoding_charset_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 91250
diff changeset
2491 `font-encoding-alist' as ENCODING.
3cd59392b3ec (Vfont_encoding_charset_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 91250
diff changeset
2492
3cd59392b3ec (Vfont_encoding_charset_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 91250
diff changeset
2493 When a text has a property `charset' and the value is CHARSET, a font
3cd59392b3ec (Vfont_encoding_charset_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 91250
diff changeset
2494 whose encoding corresponds to ENCODING-CHARSET is preferred. */);
3cd59392b3ec (Vfont_encoding_charset_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 91250
diff changeset
2495 Vfont_encoding_charset_alist = Qnil;
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
2496
17112
5c48ff325655 (syms_of_fontset): Intern Qfontset. Declare new lisp
Kenichi Handa <handa@m17n.org>
parents: 17071
diff changeset
2497 DEFVAR_LISP ("use-default-ascent", &Vuse_default_ascent,
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
2498 doc: /*
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
2499 Char table of characters whose ascent values should be ignored.
41001
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
2500 If an entry for a character is non-nil, the ascent value of the glyph
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
2501 is assumed to be what specified by _MULE_DEFAULT_ASCENT property of a font.
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
2502
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
2503 This affects how a composite character which contains
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
2504 such a character is displayed on screen. */);
19282
09a1536debb4 (Vignore_relative_composition): New variable.
Kenichi Handa <handa@m17n.org>
parents: 19172
diff changeset
2505 Vuse_default_ascent = Qnil;
09a1536debb4 (Vignore_relative_composition): New variable.
Kenichi Handa <handa@m17n.org>
parents: 19172
diff changeset
2506
09a1536debb4 (Vignore_relative_composition): New variable.
Kenichi Handa <handa@m17n.org>
parents: 19172
diff changeset
2507 DEFVAR_LISP ("ignore-relative-composition", &Vignore_relative_composition,
88903
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
2508 doc: /*
d32a3736c4fe (Qprepend, Qappend): New variables.
Kenichi Handa <handa@m17n.org>
parents: 88857
diff changeset
2509 Char table of characters which is not composed relatively.
41001
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
2510 If an entry for a character is non-nil, a composition sequence
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
2511 which contains that character is displayed so that
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
2512 the glyph of that character is put without considering
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
2513 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
2514 Vignore_relative_composition = Qnil;
17112
5c48ff325655 (syms_of_fontset): Intern Qfontset. Declare new lisp
Kenichi Handa <handa@m17n.org>
parents: 17071
diff changeset
2515
19450
895dc2520755 (Valternate_fontname_alist): Name changed from
Kenichi Handa <handa@m17n.org>
parents: 19282
diff changeset
2516 DEFVAR_LISP ("alternate-fontname-alist", &Valternate_fontname_alist,
41001
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
2517 doc: /* Alist of fontname vs list of the alternate fontnames.
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
2518 When a specified font name is not found, the corresponding
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
2519 alternate fontnames (if any) are tried instead. */);
19450
895dc2520755 (Valternate_fontname_alist): Name changed from
Kenichi Handa <handa@m17n.org>
parents: 19282
diff changeset
2520 Valternate_fontname_alist = Qnil;
17193
dc4562b0152a (Valternative_fontname_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17190
diff changeset
2521
17730
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
2522 DEFVAR_LISP ("fontset-alias-alist", &Vfontset_alias_alist,
41001
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
2523 doc: /* Alist of fontset names vs the aliases. */);
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
2524 Vfontset_alias_alist = Fcons (Fcons (FONTSET_NAME (Vdefault_fontset),
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
2525 build_string ("fontset-default")),
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
2526 Qnil);
17730
4bbcc6804b5d (Vfontset_alias_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 17331
diff changeset
2527
26858
7cc081b4e084 (Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents: 26164
diff changeset
2528 DEFVAR_LISP ("vertical-centering-font-regexp",
7cc081b4e084 (Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents: 26164
diff changeset
2529 &Vvertical_centering_font_regexp,
41001
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
2530 doc: /* *Regexp matching font names that require vertical centering on display.
a17c8b15ef1b Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents: 40771
diff changeset
2531 When a character is displayed with such fonts, the character is displayed
41987
34952771ae85 Fix typos, remove unnecessary space.
Pavel Janík <Pavel@Janik.cz>
parents: 41052
diff changeset
2532 at the vertical center of lines. */);
26858
7cc081b4e084 (Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents: 26164
diff changeset
2533 Vvertical_centering_font_regexp = Qnil;
7cc081b4e084 (Vvertical_centering_font_regexp): New variable.
Kenichi Handa <handa@m17n.org>
parents: 26164
diff changeset
2534
90509
c1ec6b950928 (Votf_script_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 90475
diff changeset
2535 DEFVAR_LISP ("otf-script-alist", &Votf_script_alist,
c1ec6b950928 (Votf_script_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 90475
diff changeset
2536 doc: /* Alist of OpenType script tags vs the corresponding script names. */);
c1ec6b950928 (Votf_script_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 90475
diff changeset
2537 Votf_script_alist = Qnil;
c1ec6b950928 (Votf_script_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents: 90475
diff changeset
2538
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
2539 defsubr (&Squery_fontset);
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
2540 defsubr (&Snew_fontset);
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
2541 defsubr (&Sset_fontset_font);
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
2542 defsubr (&Sfont_info);
28963
24af4ff8f7b6 Include "buffer.h".
Kenichi Handa <handa@m17n.org>
parents: 28766
diff changeset
2543 defsubr (&Sinternal_char_font);
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
2544 defsubr (&Sfontset_info);
28223
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
2545 defsubr (&Sfontset_font);
b888c69e8bf0 All codes rewritten or adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 26858
diff changeset
2546 defsubr (&Sfontset_list);
89610
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
2547 #ifdef FONTSET_DEBUG
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
2548 defsubr (&Sfontset_list_all);
3aa74296be55 (fontset_face): Create a fallback fontset on demand
Kenichi Handa <handa@m17n.org>
parents: 89607
diff changeset
2549 #endif
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
2550 }
52401
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 51033
diff changeset
2551
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 51033
diff changeset
2552 /* arch-tag: ea861585-2f5f-4e5b-9849-d04a9c3a3537
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 51033
diff changeset
2553 (do not change this comment) */