comparison src/fontset.h @ 91375:4bb19b57806d

Merge unicode branch Revision: emacs@sv.gnu.org/emacs--devo--0--patch-1037
author Miles Bader <miles@gnu.org>
date Fri, 01 Feb 2008 16:01:31 +0000
parents 606f2d163a64
children 1a920d0cdcb9
comparison
equal deleted inserted replaced
88119:70ca9e418f5d 91375:4bb19b57806d
3 2006, 2007, 2008 Free Software Foundation, Inc. 3 2006, 2007, 2008 Free Software Foundation, Inc.
4 Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 4 Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
5 2005, 2006, 2007, 2008 5 2005, 2006, 2007, 2008
6 National Institute of Advanced Industrial Science and Technology (AIST) 6 National Institute of Advanced Industrial Science and Technology (AIST)
7 Registration Number H14PRO021 7 Registration Number H14PRO021
8 Copyright (C) 2003, 2006
9 National Institute of Advanced Industrial Science and Technology (AIST)
10 Registration Number H13PRO009
8 11
9 This file is part of GNU Emacs. 12 This file is part of GNU Emacs.
10 13
11 GNU Emacs is free software; you can redistribute it and/or modify 14 GNU Emacs is free software; you can redistribute it and/or modify
12 it under the terms of the GNU General Public License as published by 15 it under the terms of the GNU General Public License as published by
42 char *name; 45 char *name;
43 46
44 /* Full name of the font given by a window system. */ 47 /* Full name of the font given by a window system. */
45 char *full_name; 48 char *full_name;
46 49
47 /* Charset of characters displayed by the font. */ 50 /* Charset to encode a character code into a glyph code of the
51 font. */
48 int charset; 52 int charset;
49 53
50 #ifdef WINDOWSNT 54 #ifdef WINDOWSNT
51 /* Codepage of characters that will be displayed by the font. */ 55 /* Codepage of characters that will be displayed by the font. */
52 int codepage; 56 int codepage;
69 /* 1 if `vertical-centering-font-regexp' matches this font name. 73 /* 1 if `vertical-centering-font-regexp' matches this font name.
70 In this case, we render characters at vartical center positions 74 In this case, we render characters at vartical center positions
71 of lines. */ 75 of lines. */
72 int vertical_centering; 76 int vertical_centering;
73 77
74 /* Encodings of the font indexed by CHARSET. The value is one of 78 /* Encoding type of the font. The value is one of
75 0, 1, 2, or 3: 79 0, 1, 2, or 3:
76 0: code points 0x20..0x7F or 0x2020..0x7F7F are used 80 0: code points 0x20..0x7F or 0x2020..0x7F7F are used
77 1: code points 0xA0..0xFF or 0xA0A0..0xFFFF are used 81 1: code points 0xA0..0xFF or 0xA0A0..0xFFFF are used
78 2: code points 0x20A0..0x7FFF are used 82 2: code points 0x20A0..0x7FFF are used
79 3: code points 0xA020..0xFF7F are used 83 3: code points 0xA020..0xFF7F are used
80 For instance, ASCII and Latin-1 characters may use the same font
81 but different code points (ASCII uses 0x20..0x7F and Latin-1 uses
82 0xA0..0xFF).
83
84 If the value can't be decided from information of the font, we
85 consult `font-encoding-alist' to get of the corresponding charset
86 whose default value is defined in lisp/fontset.el. Since there's
87 no charset whose id is 1, we use encoding[1] to store the
88 encoding information decided by the font itself.
89
90 If the member `font_encoder' is not NULL, this member is ignored. 84 If the member `font_encoder' is not NULL, this member is ignored.
91 */ 85 */
92 unsigned char encoding[MAX_CHARSET + 1]; 86 unsigned char encoding_type;
93 87
94 /* The baseline position of a font is normally `ascent' value of the 88 /* The baseline position of a font is normally `ascent' value of the
95 font. However, there exists many fonts which don't set `ascent' 89 font. However, there exists many fonts which don't set `ascent'
96 an appropriate value to be used as baseline position. This is 90 an appropriate value to be used as baseline position. This is
97 typical in such ASCII fonts which are designed to be used with 91 typical in such ASCII fonts which are designed to be used with
147 /* A value which may appear in the member `encoding' of struch 141 /* A value which may appear in the member `encoding' of struch
148 font_info indicating that a font itself doesn't tell which encoding 142 font_info indicating that a font itself doesn't tell which encoding
149 to be used. */ 143 to be used. */
150 #define FONT_ENCODING_NOT_DECIDED 255 144 #define FONT_ENCODING_NOT_DECIDED 255
151 145
146 enum FONT_SPEC_INDEX
147 {
148 FONT_SPEC_FAMILY_INDEX,
149 FONT_SPEC_WEIGHT_INDEX,
150 FONT_SPEC_SLANT_INDEX,
151 FONT_SPEC_SWIDTH_INDEX,
152 FONT_SPEC_ADSTYLE_INDEX,
153 FONT_SPEC_REGISTRY_INDEX,
154 FONT_SPEC_MAX_INDEX
155 };
156
152 /* Forward declaration for prototypes. */ 157 /* Forward declaration for prototypes. */
153 struct frame; 158 struct frame;
154 159
155 /* The following six are window system dependent functions. 160 /* The following six are window system dependent functions.
156 Initialization routine of each window system should set appropriate 161 Initialization routine of each window system should set appropriate
186 /* To find a CCL program, fs_load_font calls this function. 191 /* To find a CCL program, fs_load_font calls this function.
187 The argument is a pointer to the struct font_info. 192 The argument is a pointer to the struct font_info.
188 This function set the memer `encoder' of the structure. */ 193 This function set the memer `encoder' of the structure. */
189 extern void (*find_ccl_program_func) P_ ((struct font_info *)); 194 extern void (*find_ccl_program_func) P_ ((struct font_info *));
190 195
196 extern Lisp_Object (*get_font_repertory_func) P_ ((struct frame *,
197 struct font_info *));
198
191 /* Check if any window system is used now. */ 199 /* Check if any window system is used now. */
192 extern void (*check_window_system_func) P_ ((void)); 200 extern void (*check_window_system_func) P_ ((void));
193 201
194 struct face; 202 struct face;
195 203
196 extern void free_face_fontset P_ ((FRAME_PTR, struct face *)); 204 extern void free_face_fontset P_ ((FRAME_PTR, struct face *));
197 extern Lisp_Object fontset_font_pattern P_ ((FRAME_PTR, int, int)); 205 extern Lisp_Object fontset_font_pattern P_ ((FRAME_PTR, struct face *, int));
198 extern int face_suitable_for_char_p P_ ((struct face *, int)); 206 extern int face_suitable_for_char_p P_ ((struct face *, int));
199 extern int face_for_char P_ ((FRAME_PTR, struct face *, int)); 207 extern int face_for_char P_ ((FRAME_PTR, struct face *, int,
200 extern int make_fontset_for_ascii_face P_ ((FRAME_PTR, int)); 208 int, Lisp_Object));
209 extern int make_fontset_for_ascii_face P_ ((FRAME_PTR, int, struct face *));
210 extern int new_fontset_from_font_name P_ ((Lisp_Object));
201 extern void set_default_ascii_font P_ ((Lisp_Object)); 211 extern void set_default_ascii_font P_ ((Lisp_Object));
202 extern struct font_info *fs_load_font P_ ((struct frame *, int, char *, int, 212 extern struct font_info *fs_load_font P_ ((struct frame *, char *, int));
203 struct face *));
204 extern int fs_query_fontset P_ ((Lisp_Object, int)); 213 extern int fs_query_fontset P_ ((Lisp_Object, int));
205 EXFUN (Fquery_fontset, 2); 214 EXFUN (Fquery_fontset, 2);
206 extern Lisp_Object list_fontsets P_ ((struct frame *, Lisp_Object, int)); 215 extern Lisp_Object list_fontsets P_ ((struct frame *, Lisp_Object, int));
207 216
208 extern Lisp_Object Qfontset;
209 extern Lisp_Object Vuse_default_ascent; 217 extern Lisp_Object Vuse_default_ascent;
210 extern Lisp_Object Vignore_relative_composition; 218 extern Lisp_Object Vignore_relative_composition;
211 extern Lisp_Object Valternate_fontname_alist; 219 extern Lisp_Object Valternate_fontname_alist;
212 extern Lisp_Object Vfontset_alias_alist; 220 extern Lisp_Object Vfontset_alias_alist;
213 extern Lisp_Object Vvertical_centering_font_regexp; 221 extern Lisp_Object Vvertical_centering_font_regexp;
214 222 extern Lisp_Object Votf_script_alist;
215 /* Load a font named FONTNAME for displaying character C. All fonts 223
216 for frame F is stored in a table pointed by FONT_TABLE. Return a 224 /* Load a font named FONTNAME on frame F. All fonts for frame F is
217 pointer to the struct font_info of the loaded font. If loading 225 stored in a table pointed by FONT_TABLE. Return a pointer to the
218 fails, return 0; If FONTNAME is NULL, the name is taken from the 226 struct font_info of the loaded font. If loading fails, return
219 information of FONTSET. If FONTSET is given, try to load a font 227 NULL. */
220 whose size matches that of FONTSET, and, the font index is stored 228
221 in the table for FONTSET. */ 229 #define FS_LOAD_FONT(f, fontname) fs_load_font (f, fontname, -1)
222 230
223 #define FS_LOAD_FONT(f, c, fontname, fontset) \
224 fs_load_font (f, c, fontname, fontset, NULL)
225
226 #define FS_LOAD_FACE_FONT(f, c, fontname, face) \
227 fs_load_font (f, c, fontname, -1, face)
228 231
229 /* Return an immutable id for font_info FONT_INFO on frame F. The 232 /* Return an immutable id for font_info FONT_INFO on frame F. The
230 reason for this macro is hat one cannot hold pointers to font_info 233 reason for this macro is hat one cannot hold pointers to font_info
231 structures in other data structures, because the table is 234 structures in other data structures, because the table is
232 reallocated in x_list_fonts. */ 235 reallocated in x_list_fonts. */
240 #define FONT_INFO_FROM_ID(F, ID) \ 243 #define FONT_INFO_FROM_ID(F, ID) \
241 (((ID) >= 0 && (ID) < FRAME_X_DISPLAY_INFO ((F))->font_table_size) \ 244 (((ID) >= 0 && (ID) < FRAME_X_DISPLAY_INFO ((F))->font_table_size) \
242 ? (FRAME_X_DISPLAY_INFO ((F))->font_table + (ID)) \ 245 ? (FRAME_X_DISPLAY_INFO ((F))->font_table + (ID)) \
243 : 0) 246 : 0)
244 247
248 #ifdef USE_FONT_BACKEND
249 #define FONT_INFO_FROM_FACE(F, FACE) \
250 (enable_font_backend ? (FACE)->font_info \
251 : FONT_INFO_FROM_ID ((F), (FACE)->font_info_id))
252 #else /* not USE_FONT_BACKEND */
253 #define FONT_INFO_FROM_FACE(F, FACE) \
254 FONT_INFO_FROM_ID ((F), (FACE)->font_info_id)
255 #endif /* not USE_FONT_BACKEND */
256
245 extern Lisp_Object fontset_name P_ ((int)); 257 extern Lisp_Object fontset_name P_ ((int));
246 extern Lisp_Object fontset_ascii P_ ((int)); 258 extern Lisp_Object fontset_ascii P_ ((int));
247 extern int fontset_height P_ ((int)); 259 extern int fontset_height P_ ((int));
248 260
261 #ifdef USE_FONT_BACKEND
262 struct font;
263 extern int face_for_font P_ ((struct frame *, struct font *, struct face *));
264 extern int new_fontset_from_font P_ ((Lisp_Object));
265 extern struct font *fontset_ascii_font P_ ((FRAME_PTR, int));
266 #endif /* USE_FONT_BACKEND */
267
249 #endif /* EMACS_FONTSET_H */ 268 #endif /* EMACS_FONTSET_H */
250 269
251 /* arch-tag: c27cef7b-3cab-488a-8398-7a4daa96bb77 270 /* arch-tag: c27cef7b-3cab-488a-8398-7a4daa96bb77
252 (do not change this comment) */ 271 (do not change this comment) */