Are there limitations on what kind of text can be drawn using CTLineDraw in a Quartz context? I'm finding it impossible to set the font color.

Here is some code I've been experimenting with:

 ...
 NSFontDescriptor *fontDesc
   = [NSFontDescriptor fontDescriptorWithFontAttributes:
      [NSDictionary dictionaryWithObjectsAndKeys:
       @"American Typewriter", NSFontFamilyAttribute,
       @"Light", NSFontFaceAttribute,
       nil]];

 NSFont *font = [NSFont fontWithDescriptor:fontDesc
                                      size:24.0];
 NSDictionary* fontAttrs
   = [NSDictionary dictionaryWithObjectsAndKeys:
      font, NSFontAttributeName,
      [NSColor redColor], NSForegroundColorAttributeName, // No effect.
      nil];

 NSMutableAttributedString* attrString
   = [[NSMutableAttributedString alloc] initWithString:mainTitle
       attributes:fontAttrs];
 [attrString addAttribute:NSForegroundColorAttributeName
                    value:[NSColor lightGrayColor] // No effect.
                    range:NSMakeRange(0, [attrString length])];
 CTLineRef line
= CTLineCreateWithAttributedString((CFAttributedStringRef)attrString);
 CGContextSetTextPosition(ctx, 10.0, 10.0);
 CTLineDraw(line, ctx);
 CFRelease(line);
 ...

Neither of the color calls have any effect. I've also tried using the 'raw' CF approach but, as expected, it made no difference.

Thanks,
Mike
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to