Fixed control/tab bar label shadows

NSShadowAttributeName has no effect when using CTFrame. Use
CGContextSetShadowWithColor instead.
This commit is contained in:
Adam Strzelecki
2013-01-30 01:34:42 +01:00
committed by Allan Odgaard
parent b1f19e93f2
commit 5f69592a1f

View File

@@ -1,5 +1,6 @@
#import "OakControl Private.h"
#import "NSView Additions.h"
#import <OakAppKit/NSColor Additions.h>
#import <oak/oak.h>
// The lineBreakMode parameter is here to work around a crash in CoreText <rdar://6940427> — fixed in 10.6
@@ -12,15 +13,6 @@ static CFAttributedStringRef AttributedStringWithOptions (NSString* string, uint
[paragraph setLineBreakMode:lineBreakMode];
attr[NSParagraphStyleAttributeName] = paragraph;
if(options & layer_t::shadow)
{
NSShadow* shadow = [[[NSShadow alloc] init] autorelease];
[shadow setShadowOffset:NSMakeSize(0, -1)];
[shadow setShadowBlurRadius:1.0];
[shadow setShadowColor:[NSColor colorWithCalibratedWhite:1.0 alpha:0.8]];
attr[NSShadowAttributeName] = shadow;
}
NSAttributedString* res = [[[NSAttributedString alloc] initWithString:string attributes:attr] autorelease];
return (CFAttributedStringRef)res;
}
@@ -54,6 +46,9 @@ static void DrawTextWithOptions (NSString* string, NSRect bounds, uint32_t textO
if(!frame)
return;
if(textOptions & layer_t::shadow)
CGContextSetShadowWithColor(context, NSMakeSize(0, -1), 1, [[NSColor colorWithCalibratedWhite:1 alpha:0.6] tmCGColor]);
CTFrameDraw(frame, context);
CFRelease(frame);