updateLayer vs not?  By implementing drawRect: it automagically disables 
updateLayer for that view so the drawing mechanics are different under the 
hood.  NSTextField may be using updateLayer while your manual implementation is 
not resulting in a different rendering of the text.  Also try printing out the 
NSAttributedString from the NSTextField and see if there is a difference 
between it and your descAttribs.  Good luck...

—Rob


> On Apr 10, 2017, at 9:59 AM, Navneet Kumar <navnee...@me.com> wrote:
> 
> Yes, the text field seems to draw bold font, but I have set the same bold 
> font in drawInRect: as well.
> Here’s the code snippet.
> ———————————————————
> For text field:
>    bgColor = [[NSColor orangeColor] blendedColorWithFraction:0.25 
> ofColor:[NSColor yellowColor]];
>    [bgColor retain];
>    [textField setTextColor:[bgColor shadowWithLevel:0.25]];
>    [textField setFont:[NSFont boldSystemFontOfSize:11.0]];
>    [textField setStringValue:string];
> For drawInRect:
>    NSMutableParagraphStyle * aParagraphStyle = [[[NSMutableParagraphStyle 
> alloc] init] autorelease];
>    [aParagraphStyle setLineBreakMode:NSLineBreakByWordWrapping];
>    NSDictionary *descAttribs = [NSDictionary 
> dictionaryWithObjectsAndKeys:[NSFont boldSystemFontOfSize:11.0], 
> NSFontAttributeName, [bgColor shadowWithLevel:0.25], 
> NSForegroundColorAttributeName, aParagraphStyle, 
> NSParagraphStyleAttributeName,nil];
> 
>    [string drawInRect:rectDrw withAttributes:descAttribs];
> ———————————————————
> After trying CGContextSetShouldSmoothFonts(ctx,YES);,
> the result is same as before, the text field seems to display bolder, darker 
> font.
> 
> I have macOS Sierra. Latest Xcode, and latest build settings.
> 
> Thanks,
> Navneet
> 
> 
>> On 10-Apr-2017, at 9:06 PM, Jens Alfke <j...@mooseyard.com> wrote:
>> 
>> 
>>> On Apr 10, 2017, at 7:41 AM, Navneet Kumar <navnee...@me.com 
>>> <mailto:navnee...@me.com>> wrote:
>>> 
>>> The image URL to a sample image: http://i63.tinypic.com/xbe0bc.jpg 
>>> <http://i63.tinypic.com/xbe0bc.jpg>
>>> The top text is using a text field and bottom text is using drawInRect:.
>> 
>> What are the exact text attributes? It looks as though the top line is bold 
>> and the bottom isn't.
>> 
>> —Jens
> 
> _______________________________________________
> 
> 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:
> https://lists.apple.com/mailman/options/cocoa-dev/petrock%40mac.com
> 
> This email sent to petr...@mac.com

_______________________________________________

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to