shadows are not displayed with CoreText and NSAttributedString

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

Code Block
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);

Shadow is not supported by macOS version earlier than Big Sur or iOS 14. You will need to use TextKit to get that.

With iOS 14 or macOS Big Sur it is supported, please file a bug report with a test project if you don’t see it working.
shadows are not displayed with CoreText and NSAttributedString
 
 
Q