diff src/objects.c @ 343:8bec6624d99b r21-1-1

Import from CVS: tag r21-1-1
author cvs
date Mon, 13 Aug 2007 10:52:53 +0200
parents c5d627a313b1
children cc15677e0335
line wrap: on
line diff
--- a/src/objects.c	Mon Aug 13 10:52:06 2007 +0200
+++ b/src/objects.c	Mon Aug 13 10:52:53 2007 +0200
@@ -261,8 +261,9 @@
   print_internal (f->name, printcharfun, 1);
   write_c_string (" on ", printcharfun);
   print_internal (f->device, printcharfun, 0);
-  MAYBE_DEVMETH (XDEVICE (f->device), print_font_instance,
-		 (f, printcharfun, escapeflag));
+  if (!NILP (f->device))
+    MAYBE_DEVMETH (XDEVICE (f->device), print_font_instance,
+		   (f, printcharfun, escapeflag));
   sprintf (buf, " 0x%x>", f->header.uid);
   write_c_string (buf, printcharfun);
 }
@@ -419,8 +420,16 @@
 				 Error_behavior errb)
 {
   struct Lisp_Font_Instance *f = XFONT_INSTANCE (font_instance);
-  struct device *d = XDEVICE (f->device);
-  return DEVMETH_OR_GIVEN (d, font_instance_truename, (f, errb), f->name);
+  
+  if (NILP (f->device))
+    {
+      maybe_signal_simple_error ("Couldn't determine font truename",
+				 font_instance, Qfont, errb);
+      return Qnil;
+    }
+  
+  return DEVMETH_OR_GIVEN (XDEVICE (f->device),
+			   font_instance_truename, (f, errb), f->name);
 }
 
 DEFUN ("font-instance-truename", Ffont_instance_truename, 1, 1, 0, /*
@@ -445,6 +454,9 @@
   CHECK_FONT_INSTANCE (font_instance);
   f = XFONT_INSTANCE (font_instance);
 
+  if (NILP (f->device))
+    return Qnil;
+
   return MAYBE_LISP_DEVMETH (XDEVICE (f->device),
 			     font_instance_properties, (f));
 }