comparison src/objects.c @ 3094:ad2f4ae9895b

[xemacs-hg @ 2005-11-26 11:45:47 by stephent] Xft merge. <87k6ev4p8q.fsf@tleepslib.sk.tsukuba.ac.jp>
author stephent
date Sat, 26 Nov 2005 11:46:25 +0000
parents 141c2920ea48
children 98af8a976fc3
comparison
equal deleted inserted replaced
3093:769dc945b085 3094:ad2f4ae9895b
292 static const struct memory_description font_instance_description[] = { 292 static const struct memory_description font_instance_description[] = {
293 { XD_INT, offsetof (Lisp_Font_Instance, font_instance_type) }, 293 { XD_INT, offsetof (Lisp_Font_Instance, font_instance_type) },
294 { XD_LISP_OBJECT, offsetof (Lisp_Font_Instance, name)}, 294 { XD_LISP_OBJECT, offsetof (Lisp_Font_Instance, name)},
295 { XD_LISP_OBJECT, offsetof (Lisp_Font_Instance, truename)}, 295 { XD_LISP_OBJECT, offsetof (Lisp_Font_Instance, truename)},
296 { XD_LISP_OBJECT, offsetof (Lisp_Font_Instance, device)}, 296 { XD_LISP_OBJECT, offsetof (Lisp_Font_Instance, device)},
297 { XD_LISP_OBJECT, offsetof (Lisp_Font_Instance, charset)},
297 { XD_UNION, offsetof (Lisp_Font_Instance, data), 298 { XD_UNION, offsetof (Lisp_Font_Instance, data),
298 XD_INDIRECT (0, 0), { &font_instance_data_description } }, 299 XD_INDIRECT (0, 0), { &font_instance_data_description } },
299 { XD_END } 300 { XD_END }
300 }; 301 };
301 302
368 finalize_font_instance, font_instance_equal, 369 finalize_font_instance, font_instance_equal,
369 font_instance_hash, font_instance_description, 370 font_instance_hash, font_instance_description,
370 Lisp_Font_Instance); 371 Lisp_Font_Instance);
371 372
372 373
373 DEFUN ("make-font-instance", Fmake_font_instance, 1, 3, 0, /* 374 /* #### Why is this exposed to Lisp? Used in:
375 x-frob-font-size, gtk-font-menu-load-font, x-font-menu-load-font-xft,
376 x-font-menu-load-font-core, mswindows-font-menu-load-font,
377 mswindows-frob-font-style-and-sizify, mswindows-frob-font-size. */
378 DEFUN ("make-font-instance", Fmake_font_instance, 1, 4, 0, /*
374 Return a new `font-instance' object named NAME. 379 Return a new `font-instance' object named NAME.
375 DEVICE specifies the device this object applies to and defaults to the 380 DEVICE specifies the device this object applies to and defaults to the
376 selected device. An error is signalled if the font is unknown or cannot 381 selected device. An error is signalled if the font is unknown or cannot
377 be allocated; however, if NOERROR is non-nil, nil is simply returned in 382 be allocated; however, if NOERROR is non-nil, nil is simply returned in
378 this case. 383 this case. CHARSET is used internally. #### make helper function?
379 384
380 The returned object is a normal, first-class lisp object. The way you 385 The returned object is a normal, first-class lisp object. The way you
381 `deallocate' the font is the way you deallocate any other lisp object: 386 `deallocate' the font is the way you deallocate any other lisp object:
382 you drop all pointers to it and allow it to be garbage collected. When 387 you drop all pointers to it and allow it to be garbage collected. When
383 these objects are GCed, the underlying X data is deallocated as well. 388 these objects are GCed, the underlying GUI data is deallocated as well.
384 */ 389 */
385 (name, device, noerror)) 390 (name, device, noerror, charset))
386 { 391 {
387 Lisp_Font_Instance *f; 392 Lisp_Font_Instance *f;
388 int retval = 0; 393 int retval = 0;
389 Error_Behavior errb = decode_error_behavior_flag (noerror); 394 Error_Behavior errb = decode_error_behavior_flag (noerror);
390 395
405 410
406 /* Stick some default values here ... */ 411 /* Stick some default values here ... */
407 f->ascent = f->height = 1; 412 f->ascent = f->height = 1;
408 f->descent = 0; 413 f->descent = 0;
409 f->width = 1; 414 f->width = 1;
415 f->charset = charset;
410 f->proportional_p = 0; 416 f->proportional_p = 0;
411 417
412 retval = MAYBE_INT_DEVMETH (XDEVICE (device), initialize_font_instance, 418 retval = MAYBE_INT_DEVMETH (XDEVICE (device), initialize_font_instance,
413 (f, name, device, errb)); 419 (f, name, device, errb));
414 420
505 */ 511 */
506 (font_instance)) 512 (font_instance))
507 { 513 {
508 CHECK_FONT_INSTANCE (font_instance); 514 CHECK_FONT_INSTANCE (font_instance);
509 return font_instance_truename_internal (font_instance, ERROR_ME); 515 return font_instance_truename_internal (font_instance, ERROR_ME);
516 }
517
518 DEFUN ("font-instance-charset", Ffont_instance_charset, 1, 1, 0, /*
519 Return the Mule charset that FONT-INSTANCE was allocated to handle.
520 */
521 (font_instance))
522 {
523 CHECK_FONT_INSTANCE (font_instance);
524 return XFONT_INSTANCE (font_instance)->charset;
510 } 525 }
511 526
512 DEFUN ("font-instance-properties", Ffont_instance_properties, 1, 1, 0, /* 527 DEFUN ("font-instance-properties", Ffont_instance_properties, 1, 1, 0, /*
513 Return the properties (an alist or nil) of FONT-INSTANCE. 528 Return the properties (an alist or nil) of FONT-INSTANCE.
514 */ 529 */
896 instance = Fgethash (instantiator, cache, Qunbound); 911 instance = Fgethash (instantiator, cache, Qunbound);
897 /* Otherwise, make a new one. */ 912 /* Otherwise, make a new one. */
898 if (UNBOUNDP (instance)) 913 if (UNBOUNDP (instance))
899 { 914 {
900 /* make sure we cache the failures, too. */ 915 /* make sure we cache the failures, too. */
901 instance = Fmake_font_instance (instantiator, device, Qt); 916 instance = Fmake_font_instance (instantiator, device, Qt, charset);
902 Fputhash (instantiator, instance, cache); 917 Fputhash (instantiator, instance, cache);
903 } 918 }
904 919
905 return NILP (instance) ? Qunbound : instance; 920 return NILP (instance) ? Qunbound : instance;
906 } 921 }
1148 DEFSUBR (Ffont_instance_p); 1163 DEFSUBR (Ffont_instance_p);
1149 DEFSUBR (Ffont_instance_name); 1164 DEFSUBR (Ffont_instance_name);
1150 DEFSUBR (Ffont_instance_ascent); 1165 DEFSUBR (Ffont_instance_ascent);
1151 DEFSUBR (Ffont_instance_descent); 1166 DEFSUBR (Ffont_instance_descent);
1152 DEFSUBR (Ffont_instance_width); 1167 DEFSUBR (Ffont_instance_width);
1168 DEFSUBR (Ffont_instance_charset);
1153 DEFSUBR (Ffont_instance_proportional_p); 1169 DEFSUBR (Ffont_instance_proportional_p);
1154 DEFSUBR (Ffont_instance_truename); 1170 DEFSUBR (Ffont_instance_truename);
1155 DEFSUBR (Ffont_instance_properties); 1171 DEFSUBR (Ffont_instance_properties);
1156 DEFSUBR (Ffont_list); 1172 DEFSUBR (Ffont_list);
1157 1173