here is a patch for GSRTFcolorfg() to allow parsing of RTF streams created on  
OpenStep.
OpenStep doesn't add a color list to rtf streams, if the color is just black.  
The attached patch simply sets the color to black, if the color index is out of  
bounds.

Georg


2001-07-24  Georg Fleischmann

        * gui/Source/Parsers/attributedStringConsumer.m
        attributedStringConsumer.m, GSRTFcolorfg():
        set color to black if index is out of bounds


diff -u gui/Source/Parsers/attributedStringConsumer.m.old  
gui/Source/Parsers/attributedStringConsumer.m


--- gui/Source/Parsers/attributedStringConsumer.m.old   Tue Oct 24 01:23:34 2000
+++ gui/Source/Parsers/attributedStringConsumer.m       Tue Jul 24 23:09:44 2001
@@ -764,7 +764,10 @@

 void GSRTFcolorfg(void *ctxt, int color)
 {
-  ASSIGN(FGCOLOUR, [COLOURS objectAtIndex: color]);
+  if ([COLOURS count] <= color)
+    ASSIGN(FGCOLOUR, [NSColor blackColor]);
+  else
+    ASSIGN(FGCOLOUR, [COLOURS objectAtIndex: color]);
 }

 void GSRTFsubscript(void *ctxt, int script)

_______________________________________________
Bug-gnustep mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-gnustep

Reply via email to