Posts

Post not yet marked as solved
1 Replies
527 Views
when i try to draw a NSAttributedString with CoreText it won't display the NSShadow attribute. it will however work when i set the shadow with CoreGraphics before i draw but just not embedded in the attributed string. am i doing it wrong, or is it just not implemented in CoreText? CFAttributedString doesn't seem to have a shadow attribute. might that be the problem? see the code below i use for drawing with CoreText. best joerg NSShadow *shadow = [[NSShadow alloc] init]; shadow.shadowBlurRadius = 10; shadow.shadowOffset = NSMakeSize(0, 0); shadow.shadowColor = NSColor.redColor; NSAttributedString *attrString = [[NSAttributedString alloc] initWithString:@"this is a test" attributes:@{ NSForegroundColorAttributeName: NSColor.blueColor, NSShadowAttributeName: shadow, }];   CTLineRef line = CTLineCreateWithAttributedString((CFAttributedStringRef)attrString); CTLineDraw(line, currentContext); CFRelease(line);
Posted
by jroge.
Last updated
.