Mercurial > hg > xemacs-beta
comparison src/glyphs.c @ 173:8eaf7971accc r20-3b13
Import from CVS: tag r20-3b13
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:49:09 +0200 |
parents | 15872534500d |
children | 3d6bfa290dbd |
comparison
equal
deleted
inserted
replaced
172:a38aed19690b | 173:8eaf7971accc |
---|---|
1 /* Generic glyph/image implementation + display tables | 1 /* Generic glyph/image implementation + display tables |
2 Copyright (C) 1994, 1995 Board of Trustees, University of Illinois. | 2 Copyright (C) 1994, 1995 Board of Trustees, University of Illinois. |
3 Copyright (C) 1995 Tinker Systems | 3 Copyright (C) 1995 Tinker Systems |
4 Copyright (C) 1995, 1996 Ben Wing | 4 Copyright (C) 1995, 1996 Ben Wing |
5 Copyright (C) 1995 Sun Microsystems | 5 Copyright (C) 1995 Sun Microsystems |
6 | 6 |
7 This file is part of XEmacs. | 7 This file is part of XEmacs. |
8 | 8 |
9 XEmacs is free software; you can redistribute it and/or modify it | 9 XEmacs is free software; you can redistribute it and/or modify it |
10 under the terms of the GNU General Public License as published by the | 10 under the terms of the GNU General Public License as published by the |
11 Free Software Foundation; either version 2, or (at your option) any | 11 Free Software Foundation; either version 2, or (at your option) any |
235 if (!NILP (XCDR (XCDR (mapping)))) | 235 if (!NILP (XCDR (XCDR (mapping)))) |
236 { | 236 { |
237 pos = XCAR (XCDR (XCDR (mapping))); | 237 pos = XCAR (XCDR (XCDR (mapping))); |
238 CHECK_INT (pos); | 238 CHECK_INT (pos); |
239 if (XINT (pos) < 0 || | 239 if (XINT (pos) < 0 || |
240 XINT (pos) >= vector_length (XVECTOR (typevec))) | 240 XINT (pos) >= XVECTOR_LENGTH (typevec)) |
241 args_out_of_range_3 | 241 args_out_of_range_3 |
242 (pos, Qzero, make_int | 242 (pos, Qzero, make_int (XVECTOR_LENGTH (typevec) - 1)); |
243 (vector_length (XVECTOR (typevec)) - 1)); | |
244 } | 243 } |
245 | 244 |
246 newvec = Fcopy_sequence (typevec); | 245 newvec = Fcopy_sequence (typevec); |
247 if (INTP (pos)) | 246 if (INTP (pos)) |
248 vector_data (XVECTOR (newvec))[XINT (pos)] = exp; | 247 XVECTOR_DATA (newvec)[XINT (pos)] = exp; |
249 GCPRO1 (newvec); | 248 GCPRO1 (newvec); |
250 image_validate (newvec); | 249 image_validate (newvec); |
251 UNGCPRO; | 250 UNGCPRO; |
252 } | 251 } |
253 } | 252 } |
287 /* if the result is of a type that can't be instantiated | 286 /* if the result is of a type that can't be instantiated |
288 (e.g. a string when we're dealing with a pointer glyph), | 287 (e.g. a string when we're dealing with a pointer glyph), |
289 skip it. */ | 288 skip it. */ |
290 if (!(dest_mask & | 289 if (!(dest_mask & |
291 IIFORMAT_METH (decode_image_instantiator_format | 290 IIFORMAT_METH (decode_image_instantiator_format |
292 (vector_data (XVECTOR (typevec))[0], ERROR_ME), | 291 (XVECTOR_DATA (typevec)[0], ERROR_ME), |
293 possible_dest_types, ()))) | 292 possible_dest_types, ()))) |
294 continue; | 293 continue; |
295 if (fast_string_match (exp, 0, data, 0, -1, 0, ERROR_ME, 0) >= 0) | 294 if (fast_string_match (exp, 0, data, 0, -1, 0, ERROR_ME, 0) >= 0) |
296 { | 295 { |
297 if (!NILP (XCDR (XCDR (mapping)))) | 296 if (!NILP (XCDR (XCDR (mapping)))) |
298 { | 297 { |
299 int pos = XINT (XCAR (XCDR (XCDR (mapping)))); | 298 int pos = XINT (XCAR (XCDR (XCDR (mapping)))); |
300 Lisp_Object newvec = Fcopy_sequence (typevec); | 299 Lisp_Object newvec = Fcopy_sequence (typevec); |
301 vector_data (XVECTOR (newvec))[pos] = data; | 300 XVECTOR_DATA (newvec)[pos] = data; |
302 return newvec; | 301 return newvec; |
303 } | 302 } |
304 else | 303 else |
305 return typevec; | 304 return typevec; |
306 } | 305 } |
307 } | 306 } |
308 | 307 |
309 /* Oh well. */ | 308 /* Oh well. */ |
310 signal_simple_error ("Unable to interpret glyph instantiator", | 309 signal_simple_error ("Unable to interpret glyph instantiator", |
311 data); | 310 data); |
312 | 311 |
313 return Qnil; | 312 return Qnil; |
314 } | 313 } |
315 | 314 |
316 Lisp_Object | 315 Lisp_Object |
317 find_keyword_in_vector_or_given (Lisp_Object vector, Lisp_Object keyword, | 316 find_keyword_in_vector_or_given (Lisp_Object vector, Lisp_Object keyword, |
318 Lisp_Object defalt) | 317 Lisp_Object default_) |
319 { | 318 { |
320 Lisp_Object *elt; | 319 Lisp_Object *elt; |
321 int instantiator_len; | 320 int instantiator_len; |
322 | 321 |
323 elt = vector_data (XVECTOR (vector)); | 322 elt = XVECTOR_DATA (vector); |
324 instantiator_len = vector_length (XVECTOR (vector)); | 323 instantiator_len = XVECTOR_LENGTH (vector); |
325 | 324 |
326 elt++; | 325 elt++; |
327 instantiator_len--; | 326 instantiator_len--; |
328 | 327 |
329 while (instantiator_len > 0) | 328 while (instantiator_len > 0) |
332 return elt[1]; | 331 return elt[1]; |
333 elt += 2; | 332 elt += 2; |
334 instantiator_len -= 2; | 333 instantiator_len -= 2; |
335 } | 334 } |
336 | 335 |
337 return defalt; | 336 return default_; |
338 } | 337 } |
339 | 338 |
340 Lisp_Object | 339 Lisp_Object |
341 find_keyword_in_vector (Lisp_Object vector, Lisp_Object keyword) | 340 find_keyword_in_vector (Lisp_Object vector, Lisp_Object keyword) |
342 { | 341 { |
392 /* This function can call lisp */ | 391 /* This function can call lisp */ |
393 int count = specpdl_depth (); | 392 int count = specpdl_depth (); |
394 Lisp_Object temp_buffer; | 393 Lisp_Object temp_buffer; |
395 struct gcpro gcpro1; | 394 struct gcpro gcpro1; |
396 Lisp_Object data; | 395 Lisp_Object data; |
397 | 396 |
398 specbind (Qinhibit_quit, Qt); | 397 specbind (Qinhibit_quit, Qt); |
399 record_unwind_protect (Fset_buffer, Fcurrent_buffer ()); | 398 record_unwind_protect (Fset_buffer, Fcurrent_buffer ()); |
400 temp_buffer = Fget_buffer_create (build_string (" *pixmap conversion*")); | 399 temp_buffer = Fget_buffer_create (build_string (" *pixmap conversion*")); |
401 GCPRO1 (temp_buffer); | 400 GCPRO1 (temp_buffer); |
402 set_buffer_internal (XBUFFER (temp_buffer)); | 401 set_buffer_internal (XBUFFER (temp_buffer)); |
421 the normalization process.) */ | 420 the normalization process.) */ |
422 | 421 |
423 Lisp_Object | 422 Lisp_Object |
424 tagged_vector_to_alist (Lisp_Object vector) | 423 tagged_vector_to_alist (Lisp_Object vector) |
425 { | 424 { |
426 Lisp_Object *elt = vector_data (XVECTOR (vector)); | 425 Lisp_Object *elt = XVECTOR_DATA (vector); |
427 int len = vector_length (XVECTOR (vector)); | 426 int len = XVECTOR_LENGTH (vector); |
428 Lisp_Object result = Qnil; | 427 Lisp_Object result = Qnil; |
429 | 428 |
430 assert (len & 1); | 429 assert (len & 1); |
431 for (len -= 2; len >= 1; len -= 2) | 430 for (len -= 2; len >= 1; len -= 2) |
432 result = Fcons (Fcons (elt[len], elt[len+1]), result); | 431 result = Fcons (Fcons (elt[len], elt[len+1]), result); |
473 do this because it is quite possible that we will need to | 472 do this because it is quite possible that we will need to |
474 instantiate a new instance of the pixmap and the file will no | 473 instantiate a new instance of the pixmap and the file will no |
475 longer exist (e.g. w3 pixmaps are almost always from temporary | 474 longer exist (e.g. w3 pixmaps are almost always from temporary |
476 files). */ | 475 files). */ |
477 instantiator = IIFORMAT_METH_OR_GIVEN | 476 instantiator = IIFORMAT_METH_OR_GIVEN |
478 (decode_image_instantiator_format | 477 (decode_image_instantiator_format (XVECTOR_DATA (instantiator)[0], |
479 (vector_data (XVECTOR (instantiator))[0], ERROR_ME), | 478 ERROR_ME), |
480 normalize, (instantiator, contype), instantiator); | 479 normalize, (instantiator, contype), instantiator); |
481 | 480 |
482 return instantiator; | 481 return instantiator; |
483 } | 482 } |
484 | 483 |
494 ii = allocate_image_instance (device); | 493 ii = allocate_image_instance (device); |
495 | 494 |
496 GCPRO1 (ii); | 495 GCPRO1 (ii); |
497 { | 496 { |
498 struct image_instantiator_methods *meths = | 497 struct image_instantiator_methods *meths = |
499 decode_image_instantiator_format | 498 decode_image_instantiator_format (XVECTOR_DATA (instantiator)[0], |
500 (vector_data (XVECTOR (instantiator))[0], ERROR_ME); | 499 ERROR_ME); |
501 | 500 |
502 if (!HAS_IIFORMAT_METH_P (meths, instantiate)) | 501 if (!HAS_IIFORMAT_METH_P (meths, instantiate)) |
503 signal_simple_error | 502 signal_simple_error |
504 ("Don't know how to instantiate this image instantiator?", | 503 ("Don't know how to instantiate this image instantiator?", |
505 instantiator); | 504 instantiator); |
554 break; | 553 break; |
555 } | 554 } |
556 | 555 |
557 MAYBE_DEVMETH (XDEVICE (i->device), mark_image_instance, (i, markobj)); | 556 MAYBE_DEVMETH (XDEVICE (i->device), mark_image_instance, (i, markobj)); |
558 | 557 |
559 return (i->device); | 558 return i->device; |
560 } | 559 } |
561 | 560 |
562 static void | 561 static void |
563 print_image_instance (Lisp_Object obj, Lisp_Object printcharfun, | 562 print_image_instance (Lisp_Object obj, Lisp_Object printcharfun, |
564 int escapeflag) | 563 int escapeflag) |
614 !NILP (IMAGE_INSTANCE_PIXMAP_HOTSPOT_Y (ii))) | 613 !NILP (IMAGE_INSTANCE_PIXMAP_HOTSPOT_Y (ii))) |
615 { | 614 { |
616 write_c_string (" @", printcharfun); | 615 write_c_string (" @", printcharfun); |
617 if (!NILP (IMAGE_INSTANCE_PIXMAP_HOTSPOT_X (ii))) | 616 if (!NILP (IMAGE_INSTANCE_PIXMAP_HOTSPOT_X (ii))) |
618 { | 617 { |
619 sprintf (buf, "%d", XINT (IMAGE_INSTANCE_PIXMAP_HOTSPOT_X (ii))); | 618 sprintf (buf, "%ld", |
619 (long) XINT (IMAGE_INSTANCE_PIXMAP_HOTSPOT_X (ii))); | |
620 write_c_string (buf, printcharfun); | 620 write_c_string (buf, printcharfun); |
621 } | 621 } |
622 else | 622 else |
623 write_c_string ("??", printcharfun); | 623 write_c_string ("??", printcharfun); |
624 write_c_string (",", printcharfun); | 624 write_c_string (",", printcharfun); |
625 if (!NILP (IMAGE_INSTANCE_PIXMAP_HOTSPOT_Y (ii))) | 625 if (!NILP (IMAGE_INSTANCE_PIXMAP_HOTSPOT_Y (ii))) |
626 { | 626 { |
627 sprintf (buf, "%d", XINT (IMAGE_INSTANCE_PIXMAP_HOTSPOT_Y (ii))); | 627 sprintf (buf, "%ld", |
628 (long) XINT (IMAGE_INSTANCE_PIXMAP_HOTSPOT_Y (ii))); | |
628 write_c_string (buf, printcharfun); | 629 write_c_string (buf, printcharfun); |
629 } | 630 } |
630 else | 631 else |
631 write_c_string ("??", printcharfun); | 632 write_c_string ("??", printcharfun); |
632 } | 633 } |
982 image_validate (data); | 983 image_validate (data); |
983 dest_mask = decode_image_instance_type_list (dest_types); | 984 dest_mask = decode_image_instance_type_list (dest_types); |
984 data = normalize_image_instantiator (data, DEVICE_TYPE (XDEVICE (device)), | 985 data = normalize_image_instantiator (data, DEVICE_TYPE (XDEVICE (device)), |
985 make_int (dest_mask)); | 986 make_int (dest_mask)); |
986 GCPRO1 (data); | 987 GCPRO1 (data); |
987 if (VECTORP (data) | 988 if (VECTORP (data) && EQ (XVECTOR_DATA (data)[0], Qinherit)) |
988 && EQ (vector_data (XVECTOR (data))[0], Qinherit)) | |
989 signal_simple_error ("inheritance not allowed here", data); | 989 signal_simple_error ("inheritance not allowed here", data); |
990 ii = instantiate_image_instantiator (device, device, data, | 990 ii = instantiate_image_instantiator (device, device, data, |
991 Qnil, Qnil, dest_mask); | 991 Qnil, Qnil, dest_mask); |
992 RETURN_UNGCPRO (ii); | 992 RETURN_UNGCPRO (ii); |
993 } | 993 } |
1063 DEFUN ("image-instance-p", Fimage_instance_p, 1, 1, 0, /* | 1063 DEFUN ("image-instance-p", Fimage_instance_p, 1, 1, 0, /* |
1064 Return non-nil if OBJECT is an image instance. | 1064 Return non-nil if OBJECT is an image instance. |
1065 */ | 1065 */ |
1066 (object)) | 1066 (object)) |
1067 { | 1067 { |
1068 return (IMAGE_INSTANCEP (object) ? Qt : Qnil); | 1068 return IMAGE_INSTANCEP (object) ? Qt : Qnil; |
1069 } | 1069 } |
1070 | 1070 |
1071 DEFUN ("image-instance-type", Fimage_instance_type, 1, 1, 0, /* | 1071 DEFUN ("image-instance-type", Fimage_instance_type, 1, 1, 0, /* |
1072 Return the type of the given image instance. | 1072 Return the type of the given image instance. |
1073 The return value will be one of 'nothing, 'text, 'mono-pixmap, | 1073 The return value will be one of 'nothing, 'text, 'mono-pixmap, |
1083 Return the name of the given image instance. | 1083 Return the name of the given image instance. |
1084 */ | 1084 */ |
1085 (image_instance)) | 1085 (image_instance)) |
1086 { | 1086 { |
1087 CHECK_IMAGE_INSTANCE (image_instance); | 1087 CHECK_IMAGE_INSTANCE (image_instance); |
1088 return (XIMAGE_INSTANCE_NAME (image_instance)); | 1088 return XIMAGE_INSTANCE_NAME (image_instance); |
1089 } | 1089 } |
1090 | 1090 |
1091 DEFUN ("image-instance-string", Fimage_instance_string, 1, 1, 0, /* | 1091 DEFUN ("image-instance-string", Fimage_instance_string, 1, 1, 0, /* |
1092 Return the string of the given image instance. | 1092 Return the string of the given image instance. |
1093 This will only be non-nil for text image instances. | 1093 This will only be non-nil for text image instances. |
1094 */ | 1094 */ |
1095 (image_instance)) | 1095 (image_instance)) |
1096 { | 1096 { |
1097 CHECK_IMAGE_INSTANCE (image_instance); | 1097 CHECK_IMAGE_INSTANCE (image_instance); |
1098 if (XIMAGE_INSTANCE_TYPE (image_instance) == IMAGE_TEXT) | 1098 if (XIMAGE_INSTANCE_TYPE (image_instance) == IMAGE_TEXT) |
1099 return (XIMAGE_INSTANCE_TEXT_STRING (image_instance)); | 1099 return XIMAGE_INSTANCE_TEXT_STRING (image_instance); |
1100 else | 1100 else |
1101 return Qnil; | 1101 return Qnil; |
1102 } | 1102 } |
1103 | 1103 |
1104 DEFUN ("image-instance-file-name", Fimage_instance_file_name, 1, 1, 0, /* | 1104 DEFUN ("image-instance-file-name", Fimage_instance_file_name, 1, 1, 0, /* |
1150 switch (XIMAGE_INSTANCE_TYPE (image_instance)) | 1150 switch (XIMAGE_INSTANCE_TYPE (image_instance)) |
1151 { | 1151 { |
1152 case IMAGE_MONO_PIXMAP: | 1152 case IMAGE_MONO_PIXMAP: |
1153 case IMAGE_COLOR_PIXMAP: | 1153 case IMAGE_COLOR_PIXMAP: |
1154 case IMAGE_POINTER: | 1154 case IMAGE_POINTER: |
1155 return (make_int (XIMAGE_INSTANCE_PIXMAP_DEPTH (image_instance))); | 1155 return make_int (XIMAGE_INSTANCE_PIXMAP_DEPTH (image_instance)); |
1156 | 1156 |
1157 default: | 1157 default: |
1158 return Qnil; | 1158 return Qnil; |
1159 } | 1159 } |
1160 } | 1160 } |
1169 switch (XIMAGE_INSTANCE_TYPE (image_instance)) | 1169 switch (XIMAGE_INSTANCE_TYPE (image_instance)) |
1170 { | 1170 { |
1171 case IMAGE_MONO_PIXMAP: | 1171 case IMAGE_MONO_PIXMAP: |
1172 case IMAGE_COLOR_PIXMAP: | 1172 case IMAGE_COLOR_PIXMAP: |
1173 case IMAGE_POINTER: | 1173 case IMAGE_POINTER: |
1174 return (make_int (XIMAGE_INSTANCE_PIXMAP_HEIGHT (image_instance))); | 1174 return make_int (XIMAGE_INSTANCE_PIXMAP_HEIGHT (image_instance)); |
1175 | 1175 |
1176 default: | 1176 default: |
1177 return Qnil; | 1177 return Qnil; |
1178 } | 1178 } |
1179 } | 1179 } |
1188 switch (XIMAGE_INSTANCE_TYPE (image_instance)) | 1188 switch (XIMAGE_INSTANCE_TYPE (image_instance)) |
1189 { | 1189 { |
1190 case IMAGE_MONO_PIXMAP: | 1190 case IMAGE_MONO_PIXMAP: |
1191 case IMAGE_COLOR_PIXMAP: | 1191 case IMAGE_COLOR_PIXMAP: |
1192 case IMAGE_POINTER: | 1192 case IMAGE_POINTER: |
1193 return (make_int (XIMAGE_INSTANCE_PIXMAP_WIDTH (image_instance))); | 1193 return make_int (XIMAGE_INSTANCE_PIXMAP_WIDTH (image_instance)); |
1194 | 1194 |
1195 default: | 1195 default: |
1196 return Qnil; | 1196 return Qnil; |
1197 } | 1197 } |
1198 } | 1198 } |
1357 static Lisp_Object | 1357 static Lisp_Object |
1358 inherit_normalize (Lisp_Object inst, Lisp_Object console_type) | 1358 inherit_normalize (Lisp_Object inst, Lisp_Object console_type) |
1359 { | 1359 { |
1360 Lisp_Object face; | 1360 Lisp_Object face; |
1361 | 1361 |
1362 assert (XVECTOR (inst)->size == 3); | 1362 assert (XVECTOR_LENGTH (inst) == 3); |
1363 face = vector_data (XVECTOR (inst))[2]; | 1363 face = XVECTOR_DATA (inst)[2]; |
1364 if (!FACEP (face)) | 1364 if (!FACEP (face)) |
1365 inst = vector3 (Qinherit, Q_face, Fget_face (face)); | 1365 inst = vector3 (Qinherit, Q_face, Fget_face (face)); |
1366 return inst; | 1366 return inst; |
1367 } | 1367 } |
1368 | 1368 |
1526 else | 1526 else |
1527 signal_simple_error_2 ("Wrong device for image instance", | 1527 signal_simple_error_2 ("Wrong device for image instance", |
1528 instantiator, device); | 1528 instantiator, device); |
1529 } | 1529 } |
1530 else if (VECTORP (instantiator) | 1530 else if (VECTORP (instantiator) |
1531 && EQ (vector_data (XVECTOR (instantiator))[0], Qinherit)) | 1531 && EQ (XVECTOR_DATA (instantiator)[0], Qinherit)) |
1532 { | 1532 { |
1533 assert (XVECTOR (instantiator)->size == 3); | 1533 assert (XVECTOR_LENGTH (instantiator) == 3); |
1534 return (FACE_PROPERTY_INSTANCE | 1534 return (FACE_PROPERTY_INSTANCE |
1535 (Fget_face (vector_data (XVECTOR (instantiator))[2]), | 1535 (Fget_face (XVECTOR_DATA (instantiator)[2]), |
1536 Qbackground_pixmap, domain, 0, depth)); | 1536 Qbackground_pixmap, domain, 0, depth)); |
1537 } | 1537 } |
1538 else | 1538 else |
1539 { | 1539 { |
1540 Lisp_Object instance; | 1540 Lisp_Object instance; |
1629 { | 1629 { |
1630 if (IMAGE_INSTANCEP (instantiator) || STRINGP (instantiator)) | 1630 if (IMAGE_INSTANCEP (instantiator) || STRINGP (instantiator)) |
1631 return; | 1631 return; |
1632 else if (VECTORP (instantiator)) | 1632 else if (VECTORP (instantiator)) |
1633 { | 1633 { |
1634 Lisp_Object *elt = vector_data (XVECTOR (instantiator)); | 1634 Lisp_Object *elt = XVECTOR_DATA (instantiator); |
1635 int instantiator_len = XVECTOR (instantiator)->size; | 1635 int instantiator_len = XVECTOR_LENGTH (instantiator); |
1636 struct image_instantiator_methods *meths; | 1636 struct image_instantiator_methods *meths; |
1637 Lisp_Object already_seen = Qnil; | 1637 Lisp_Object already_seen = Qnil; |
1638 struct gcpro gcpro1; | 1638 struct gcpro gcpro1; |
1639 int i; | 1639 int i; |
1640 | 1640 |
1920 not need to exist at any other time (e.g. it may safely be a temporary | 1920 not need to exist at any other time (e.g. it may safely be a temporary |
1921 file). | 1921 file). |
1922 */ | 1922 */ |
1923 (object)) | 1923 (object)) |
1924 { | 1924 { |
1925 return (IMAGE_SPECIFIERP (object) ? Qt : Qnil); | 1925 return IMAGE_SPECIFIERP (object) ? Qt : Qnil; |
1926 } | 1926 } |
1927 | 1927 |
1928 | 1928 |
1929 /**************************************************************************** | 1929 /**************************************************************************** |
1930 * Glyph Object * | 1930 * Glyph Object * |
1954 ((markobj) (glyph->image)); | 1954 ((markobj) (glyph->image)); |
1955 ((markobj) (glyph->contrib_p)); | 1955 ((markobj) (glyph->contrib_p)); |
1956 ((markobj) (glyph->baseline)); | 1956 ((markobj) (glyph->baseline)); |
1957 ((markobj) (glyph->face)); | 1957 ((markobj) (glyph->face)); |
1958 | 1958 |
1959 return (glyph->plist); | 1959 return glyph->plist; |
1960 } | 1960 } |
1961 | 1961 |
1962 static void | 1962 static void |
1963 print_glyph (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag) | 1963 print_glyph (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag) |
1964 { | 1964 { |
2116 Lisp_Object locale)) | 2116 Lisp_Object locale)) |
2117 { | 2117 { |
2118 Lisp_Object obj = Qnil; | 2118 Lisp_Object obj = Qnil; |
2119 struct Lisp_Glyph *g = | 2119 struct Lisp_Glyph *g = |
2120 alloc_lcrecord (sizeof (struct Lisp_Glyph), lrecord_glyph); | 2120 alloc_lcrecord (sizeof (struct Lisp_Glyph), lrecord_glyph); |
2121 | 2121 |
2122 g->type = type; | 2122 g->type = type; |
2123 g->image = Fmake_specifier (Qimage); | 2123 g->image = Fmake_specifier (Qimage); |
2124 switch (g->type) | 2124 switch (g->type) |
2125 { | 2125 { |
2126 case GLYPH_BUFFER: | 2126 case GLYPH_BUFFER: |
2297 { | 2297 { |
2298 Lisp_Object str = XIMAGE_INSTANCE_TEXT_STRING (instance); | 2298 Lisp_Object str = XIMAGE_INSTANCE_TEXT_STRING (instance); |
2299 Lisp_Object private_face = XGLYPH_FACE(glyph); | 2299 Lisp_Object private_face = XGLYPH_FACE(glyph); |
2300 | 2300 |
2301 if (!NILP (private_face)) | 2301 if (!NILP (private_face)) |
2302 return (redisplay_frame_text_width_string (XFRAME (frame), | 2302 return redisplay_frame_text_width_string (XFRAME (frame), |
2303 private_face, | 2303 private_face, |
2304 0, str, 0, -1)); | 2304 0, str, 0, -1); |
2305 else | 2305 else |
2306 if (!NILP (frame_face)) | 2306 if (!NILP (frame_face)) |
2307 return (redisplay_frame_text_width_string (XFRAME (frame), | 2307 return redisplay_frame_text_width_string (XFRAME (frame), |
2308 frame_face, | 2308 frame_face, |
2309 0, str, 0, -1)); | 2309 0, str, 0, -1); |
2310 else | 2310 else |
2311 return (redisplay_text_width_string (XWINDOW (window), | 2311 return redisplay_text_width_string (XWINDOW (window), |
2312 window_findex, | 2312 window_findex, |
2313 0, str, 0, -1)); | 2313 0, str, 0, -1); |
2314 } | 2314 } |
2315 | 2315 |
2316 case IMAGE_MONO_PIXMAP: | 2316 case IMAGE_MONO_PIXMAP: |
2317 case IMAGE_COLOR_PIXMAP: | 2317 case IMAGE_COLOR_PIXMAP: |
2318 case IMAGE_POINTER: | 2318 case IMAGE_POINTER: |
2339 (glyph, window)) | 2339 (glyph, window)) |
2340 { | 2340 { |
2341 XSETWINDOW (window, decode_window (window)); | 2341 XSETWINDOW (window, decode_window (window)); |
2342 CHECK_GLYPH (glyph); | 2342 CHECK_GLYPH (glyph); |
2343 | 2343 |
2344 return (make_int (glyph_width (glyph, Qnil, DEFAULT_INDEX, window))); | 2344 return make_int (glyph_width (glyph, Qnil, DEFAULT_INDEX, window)); |
2345 } | 2345 } |
2346 | 2346 |
2347 #define RETURN_ASCENT 0 | 2347 #define RETURN_ASCENT 0 |
2348 #define RETURN_DESCENT 1 | 2348 #define RETURN_DESCENT 1 |
2349 #define RETURN_HEIGHT 2 | 2349 #define RETURN_HEIGHT 2 |
2399 else | 2399 else |
2400 cachel = WINDOW_FACE_CACHEL (XWINDOW (window), window_findex); | 2400 cachel = WINDOW_FACE_CACHEL (XWINDOW (window), window_findex); |
2401 ensure_face_cachel_complete (cachel, window, charsets); | 2401 ensure_face_cachel_complete (cachel, window, charsets); |
2402 | 2402 |
2403 face_cachel_charset_font_metric_info (cachel, charsets, &fm); | 2403 face_cachel_charset_font_metric_info (cachel, charsets, &fm); |
2404 | 2404 |
2405 if (function == RETURN_ASCENT) | 2405 if (function == RETURN_ASCENT) |
2406 return fm.ascent; | 2406 return fm.ascent; |
2407 else if (function == RETURN_DESCENT) | 2407 else if (function == RETURN_DESCENT) |
2408 return fm.descent; | 2408 return fm.descent; |
2409 else if (function == RETURN_HEIGHT) | 2409 else if (function == RETURN_HEIGHT) |
2468 (glyph, window)) | 2468 (glyph, window)) |
2469 { | 2469 { |
2470 XSETWINDOW (window, decode_window (window)); | 2470 XSETWINDOW (window, decode_window (window)); |
2471 CHECK_GLYPH (glyph); | 2471 CHECK_GLYPH (glyph); |
2472 | 2472 |
2473 return (make_int (glyph_ascent (glyph, Qnil, DEFAULT_INDEX, window))); | 2473 return make_int (glyph_ascent (glyph, Qnil, DEFAULT_INDEX, window)); |
2474 } | 2474 } |
2475 | 2475 |
2476 DEFUN ("glyph-descent", Fglyph_descent, 1, 2, 0, /* | 2476 DEFUN ("glyph-descent", Fglyph_descent, 1, 2, 0, /* |
2477 Return the descent value of GLYPH on WINDOW. | 2477 Return the descent value of GLYPH on WINDOW. |
2478 This may not be exact as it does not take into account all of the context | 2478 This may not be exact as it does not take into account all of the context |
2481 (glyph, window)) | 2481 (glyph, window)) |
2482 { | 2482 { |
2483 XSETWINDOW (window, decode_window (window)); | 2483 XSETWINDOW (window, decode_window (window)); |
2484 CHECK_GLYPH (glyph); | 2484 CHECK_GLYPH (glyph); |
2485 | 2485 |
2486 return (make_int (glyph_descent (glyph, Qnil, DEFAULT_INDEX, window))); | 2486 return make_int (glyph_descent (glyph, Qnil, DEFAULT_INDEX, window)); |
2487 } | 2487 } |
2488 | 2488 |
2489 /* This is redundant but I bet a lot of people expect it to exist. */ | 2489 /* This is redundant but I bet a lot of people expect it to exist. */ |
2490 DEFUN ("glyph-height", Fglyph_height, 1, 2, 0, /* | 2490 DEFUN ("glyph-height", Fglyph_height, 1, 2, 0, /* |
2491 Return the height of GLYPH on WINDOW. | 2491 Return the height of GLYPH on WINDOW. |
2495 (glyph, window)) | 2495 (glyph, window)) |
2496 { | 2496 { |
2497 XSETWINDOW (window, decode_window (window)); | 2497 XSETWINDOW (window, decode_window (window)); |
2498 CHECK_GLYPH (glyph); | 2498 CHECK_GLYPH (glyph); |
2499 | 2499 |
2500 return (make_int (glyph_height (glyph, Qnil, DEFAULT_INDEX, window))); | 2500 return make_int (glyph_height (glyph, Qnil, DEFAULT_INDEX, window)); |
2501 } | 2501 } |
2502 | 2502 |
2503 #undef RETURN_ASCENT | 2503 #undef RETURN_ASCENT |
2504 #undef RETURN_DESCENT | 2504 #undef RETURN_DESCENT |
2505 #undef RETURN_HEIGHT | 2505 #undef RETURN_HEIGHT |
2545 glyph_contrib_p (Lisp_Object glyph, Lisp_Object domain) | 2545 glyph_contrib_p (Lisp_Object glyph, Lisp_Object domain) |
2546 { | 2546 { |
2547 if (!GLYPHP (glyph)) | 2547 if (!GLYPHP (glyph)) |
2548 return 0; | 2548 return 0; |
2549 else | 2549 else |
2550 return (!NILP (specifier_instance_no_quit | 2550 return !NILP (specifier_instance_no_quit |
2551 (GLYPH_CONTRIB_P (XGLYPH (glyph)), Qunbound, domain, | 2551 (GLYPH_CONTRIB_P (XGLYPH (glyph)), Qunbound, domain, |
2552 /* #### look into ERROR_ME_NOT */ | 2552 /* #### look into ERROR_ME_NOT */ |
2553 ERROR_ME_NOT, 0, Qzero))); | 2553 ERROR_ME_NOT, 0, Qzero)); |
2554 } | 2554 } |
2555 | 2555 |
2556 static void | 2556 static void |
2557 glyph_property_was_changed (Lisp_Object glyph, Lisp_Object property, | 2557 glyph_property_was_changed (Lisp_Object glyph, Lisp_Object property, |
2558 Lisp_Object locale) | 2558 Lisp_Object locale) |
2728 get_display_table (struct window *w, face_index findex) | 2728 get_display_table (struct window *w, face_index findex) |
2729 { | 2729 { |
2730 Lisp_Object tem = Qnil; | 2730 Lisp_Object tem = Qnil; |
2731 | 2731 |
2732 tem = WINDOW_FACE_CACHEL_DISPLAY_TABLE (w, findex); | 2732 tem = WINDOW_FACE_CACHEL_DISPLAY_TABLE (w, findex); |
2733 if (VECTORP (tem) && XVECTOR (tem)->size == DISP_TABLE_SIZE) | 2733 if (VECTORP (tem) && XVECTOR_LENGTH (tem) == DISP_TABLE_SIZE) |
2734 return XVECTOR (tem); | 2734 return XVECTOR (tem); |
2735 | 2735 |
2736 tem = w->display_table; | 2736 tem = w->display_table; |
2737 if (VECTORP (tem) && XVECTOR (tem)->size == DISP_TABLE_SIZE) | 2737 if (VECTORP (tem) && XVECTOR_LENGTH (tem) == DISP_TABLE_SIZE) |
2738 return XVECTOR (tem); | 2738 return XVECTOR (tem); |
2739 | 2739 |
2740 return 0; | 2740 return 0; |
2741 } | 2741 } |
2742 | 2742 |