Mercurial > hg > xemacs-beta
comparison src/faces.h @ 5118:e0db3c197671 ben-lisp-object
merge up to latest default branch, doesn't compile yet
author | Ben Wing <ben@xemacs.org> |
---|---|
date | Sat, 26 Dec 2009 21:18:49 -0600 |
parents | 3ef0aaf3dc34 |
children | d1247f3cc363 |
comparison
equal
deleted
inserted
replaced
5117:3742ea8250b5 | 5118:e0db3c197671 |
---|---|
23 | 23 |
24 #ifndef INCLUDED_faces_h_ | 24 #ifndef INCLUDED_faces_h_ |
25 #define INCLUDED_faces_h_ | 25 #define INCLUDED_faces_h_ |
26 | 26 |
27 #include "charset.h" /* for NUM_LEADING_BYTES */ | 27 #include "charset.h" /* for NUM_LEADING_BYTES */ |
28 #include "specifier.h" | |
28 | 29 |
29 /* a Lisp_Face is the C object corresponding to a face. There is one | 30 /* a Lisp_Face is the C object corresponding to a face. There is one |
30 of these per face. It basically contains all of the specifiers for | 31 of these per face. It basically contains all of the specifiers for |
31 the built-in face properties, plus the plist of user-specified | 32 the built-in face properties, plus the plist of user-specified |
32 properties. */ | 33 properties. */ |
115 #define NUM_STATIC_CACHEL_FACES 4 | 116 #define NUM_STATIC_CACHEL_FACES 4 |
116 | 117 |
117 typedef struct face_cachel face_cachel; | 118 typedef struct face_cachel face_cachel; |
118 struct face_cachel | 119 struct face_cachel |
119 { | 120 { |
121 #ifdef NEW_GC | |
122 struct lrecord_header header; | |
123 #endif /* NEW_GC */ | |
120 /* There are two kinds of cachels; those created from a single face | 124 /* There are two kinds of cachels; those created from a single face |
121 and those created by merging more than one face. In the former | 125 and those created by merging more than one face. In the former |
122 case, the FACE element specifies the face used. In the latter | 126 case, the FACE element specifies the face used. In the latter |
123 case, the MERGED_FACES_STATIC and MERGED_FACES elements specify | 127 case, the MERGED_FACES_STATIC and MERGED_FACES elements specify |
124 the faces used for merging by giving the indices of the | 128 the faces used for merging by giving the indices of the |
159 /* There are currently 128 or 129 possible charsets under Mule. For the | 163 /* There are currently 128 or 129 possible charsets under Mule. For the |
160 moment we just take the easy way out and allocate space for each | 164 moment we just take the easy way out and allocate space for each |
161 of them. This avoids messing with Dynarrs. | 165 of them. This avoids messing with Dynarrs. |
162 | 166 |
163 #### We should look into this and probably clean it up | 167 #### We should look into this and probably clean it up |
164 to use Dynarrs. This may be a big space hog as is. */ | 168 to use Dynarrs. This may be a big space hog as is. |
169 sjt sez: doesn't look like it, my total face cache is 170KB. | |
170 Could be reduced to maybe 50KB. */ | |
165 Lisp_Object font[NUM_LEADING_BYTES]; | 171 Lisp_Object font[NUM_LEADING_BYTES]; |
166 | 172 |
167 Lisp_Object display_table; | 173 Lisp_Object display_table; |
168 Lisp_Object background_pixmap; | 174 Lisp_Object background_pixmap; |
169 | 175 |
174 unsigned int blinking :1; | 180 unsigned int blinking :1; |
175 unsigned int reverse :1; | 181 unsigned int reverse :1; |
176 | 182 |
177 /* Used when merging to tell if the above field represents an actual | 183 /* Used when merging to tell if the above field represents an actual |
178 value of this face or a fallback value. */ | 184 value of this face or a fallback value. */ |
179 /* #### Of course we should use a bit array or something. */ | 185 DECLARE_INLINE_LISP_BIT_VECTOR(NUM_LEADING_BYTES) font_specified; |
180 unsigned char font_specified[NUM_LEADING_BYTES]; | 186 |
181 unsigned int foreground_specified :1; | 187 unsigned int foreground_specified :1; |
182 unsigned int background_specified :1; | 188 unsigned int background_specified :1; |
183 unsigned int display_table_specified :1; | 189 unsigned int display_table_specified :1; |
184 unsigned int background_pixmap_specified :1; | 190 unsigned int background_pixmap_specified :1; |
185 | 191 |
216 whole program will just crash. For the moment, this is | 222 whole program will just crash. For the moment, this is |
217 OK (for debugging purposes) but we should fix this by | 223 OK (for debugging purposes) but we should fix this by |
218 storing a "blank font" if the instantiation fails. */ | 224 storing a "blank font" if the instantiation fails. */ |
219 unsigned int dirty :1; | 225 unsigned int dirty :1; |
220 unsigned int updated :1; | 226 unsigned int updated :1; |
221 /* #### Of course we should use a bit array or something. */ | 227 |
222 unsigned char font_updated[NUM_LEADING_BYTES]; | 228 DECLARE_INLINE_LISP_BIT_VECTOR(NUM_LEADING_BYTES) font_updated; |
229 | |
230 /* Whether the font for the charset in question was determined in the | |
231 "final stage"; that is, the last stage Lisp code could specify it, | |
232 after the initial stage and before the fallback. */ | |
233 DECLARE_INLINE_LISP_BIT_VECTOR(NUM_LEADING_BYTES) font_final_stage; | |
223 }; | 234 }; |
224 | 235 |
225 DECLARE_LRECORD (face, Lisp_Face); | 236 #ifdef NEW_GC |
237 typedef struct face_cachel Lisp_Face_Cachel; | |
238 | |
239 DECLARE_LISP_OBJECT (face_cachel, Lisp_Face_Cachel); | |
240 | |
241 #define XFACE_CACHEL(x) \ | |
242 XRECORD (x, face_cachel, Lisp_Face_Cachel) | |
243 #define wrap_face_cachel(p) wrap_record (p, face_cachel) | |
244 #define FACE_CACHEL_P(x) RECORDP (x, face_cachel) | |
245 #define CHECK_FACE_CACHEL(x) CHECK_RECORD (x, face_cachel) | |
246 #define CONCHECK_FACE_CACHEL(x) CONCHECK_RECORD (x, face_cachel) | |
247 #endif /* NEW_GC */ | |
248 | |
249 DECLARE_LISP_OBJECT (face, Lisp_Face); | |
226 #define XFACE(x) XRECORD (x, face, Lisp_Face) | 250 #define XFACE(x) XRECORD (x, face, Lisp_Face) |
227 #define wrap_face(p) wrap_record (p, face) | 251 #define wrap_face(p) wrap_record (p, face) |
228 #define FACEP(x) RECORDP (x, face) | 252 #define FACEP(x) RECORDP (x, face) |
229 #define CHECK_FACE(x) CHECK_RECORD (x, face) | 253 #define CHECK_FACE(x) CHECK_RECORD (x, face) |
230 | 254 |
245 void mark_face_cachels_as_not_updated (struct window *w); | 269 void mark_face_cachels_as_not_updated (struct window *w); |
246 void reset_face_cachel (struct face_cachel *inst); | 270 void reset_face_cachel (struct face_cachel *inst); |
247 void reset_face_cachels (struct window *w); | 271 void reset_face_cachels (struct window *w); |
248 face_index get_builtin_face_cache_index (struct window *w, | 272 face_index get_builtin_face_cache_index (struct window *w, |
249 Lisp_Object face); | 273 Lisp_Object face); |
274 /* WARNING: this interface may change. */ | |
275 face_index merge_face_list_to_cache_index (struct window *w, | |
276 Lisp_Object *face_list, int count); | |
277 | |
250 #ifdef MEMORY_USAGE_STATS | 278 #ifdef MEMORY_USAGE_STATS |
251 int compute_face_cachel_usage (face_cachel_dynarr *face_cachels, | 279 int compute_face_cachel_usage (face_cachel_dynarr *face_cachels, |
252 struct overhead_stats *ovstats); | 280 struct overhead_stats *ovstats); |
253 #endif /* MEMORY_USAGE_STATS */ | 281 #endif /* MEMORY_USAGE_STATS */ |
254 | 282 |
278 void default_face_height_and_width_1 (Lisp_Object domain, | 306 void default_face_height_and_width_1 (Lisp_Object domain, |
279 int *height, int *width); | 307 int *height, int *width); |
280 | 308 |
281 #define FACE_CACHEL_FONT(cachel, charset) \ | 309 #define FACE_CACHEL_FONT(cachel, charset) \ |
282 (cachel->font[XCHARSET_LEADING_BYTE (charset) - MIN_LEADING_BYTE]) | 310 (cachel->font[XCHARSET_LEADING_BYTE (charset) - MIN_LEADING_BYTE]) |
311 | |
312 #define FACE_CACHEL_FONT_UPDATED(x) \ | |
313 ((struct Lisp_Bit_Vector *)(&((x)->font_updated))) | |
314 #define FACE_CACHEL_FONT_SPECIFIED(x) \ | |
315 ((struct Lisp_Bit_Vector *)(&((x)->font_specified))) | |
316 #define FACE_CACHEL_FONT_FINAL_STAGE(x) \ | |
317 ((struct Lisp_Bit_Vector *)(&((x)->font_final_stage))) | |
283 | 318 |
284 #define WINDOW_FACE_CACHEL(window, index) \ | 319 #define WINDOW_FACE_CACHEL(window, index) \ |
285 Dynarr_atp ((window)->face_cachels, index) | 320 Dynarr_atp ((window)->face_cachels, index) |
286 | 321 |
287 #define FACE_CACHEL_FINDEX_UNSAFE(cachel, offset) \ | 322 #define FACE_CACHEL_FINDEX_UNSAFE(cachel, offset) \ |
328 | 363 |
329 #define FACE_PROPERTY_INSTANCE(face, property, domain, no_fallback, depth) \ | 364 #define FACE_PROPERTY_INSTANCE(face, property, domain, no_fallback, depth) \ |
330 FACE_PROPERTY_INSTANCE_1 (face, property, domain, ERROR_ME_DEBUG_WARN, \ | 365 FACE_PROPERTY_INSTANCE_1 (face, property, domain, ERROR_ME_DEBUG_WARN, \ |
331 no_fallback, depth) | 366 no_fallback, depth) |
332 | 367 |
333 Lisp_Object face_property_matching_instance (Lisp_Object face, | 368 Lisp_Object face_property_matching_instance |
334 Lisp_Object property, | 369 (Lisp_Object face, |
335 Lisp_Object charset, | 370 Lisp_Object property, |
336 Lisp_Object domain, | 371 Lisp_Object charset, |
337 Error_Behavior errb, | 372 Lisp_Object domain, |
338 int no_fallback, | 373 Error_Behavior errb, |
339 Lisp_Object depth); | 374 int no_fallback, |
375 Lisp_Object depth, | |
376 enum font_specifier_matchspec_stages stages); | |
340 | 377 |
341 #define FACE_PROPERTY_SPEC_LIST(face, property, locale) \ | 378 #define FACE_PROPERTY_SPEC_LIST(face, property, locale) \ |
342 Fspecifier_spec_list (FACE_PROPERTY_SPECIFIER (face, property), \ | 379 Fspecifier_spec_list (FACE_PROPERTY_SPECIFIER (face, property), \ |
343 locale, Qnil, Qnil) | 380 locale, Qnil, Qnil) |
344 #define SET_FACE_PROPERTY(face, property, value, locale, tag, how_to_add) \ | 381 #define SET_FACE_PROPERTY(face, property, value, locale, tag, how_to_add) \ |
347 | 384 |
348 #define FACE_FOREGROUND(face, domain) \ | 385 #define FACE_FOREGROUND(face, domain) \ |
349 FACE_PROPERTY_INSTANCE (face, Qforeground, domain, 0, Qzero) | 386 FACE_PROPERTY_INSTANCE (face, Qforeground, domain, 0, Qzero) |
350 #define FACE_BACKGROUND(face, domain) \ | 387 #define FACE_BACKGROUND(face, domain) \ |
351 FACE_PROPERTY_INSTANCE (face, Qbackground, domain, 0, Qzero) | 388 FACE_PROPERTY_INSTANCE (face, Qbackground, domain, 0, Qzero) |
389 | |
390 /* Calling this function on the default face with the ASCII character set | |
391 may delete any X11 frames; see the code at the end of | |
392 x_find_charset_font. */ | |
352 #define FACE_FONT(face, domain, charset) \ | 393 #define FACE_FONT(face, domain, charset) \ |
353 face_property_matching_instance (face, Qfont, charset, domain, \ | 394 face_property_matching_instance (face, Qfont, charset, domain, \ |
354 ERROR_ME_DEBUG_WARN, 0, Qzero) | 395 ERROR_ME_DEBUG_WARN, 0, Qzero, \ |
396 initial) | |
355 #define FACE_DISPLAY_TABLE(face, domain) \ | 397 #define FACE_DISPLAY_TABLE(face, domain) \ |
356 FACE_PROPERTY_INSTANCE (face, Qdisplay_table, domain, 0, Qzero) | 398 FACE_PROPERTY_INSTANCE (face, Qdisplay_table, domain, 0, Qzero) |
357 #define FACE_BACKGROUND_PIXMAP(face, domain) \ | 399 #define FACE_BACKGROUND_PIXMAP(face, domain) \ |
358 FACE_PROPERTY_INSTANCE (face, Qbackground_pixmap, domain, 0, Qzero) | 400 FACE_PROPERTY_INSTANCE (face, Qbackground_pixmap, domain, 0, Qzero) |
359 #define FACE_UNDERLINE_P(face, domain) \ | 401 #define FACE_UNDERLINE_P(face, domain) \ |