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 <[email protected]> wrote:
>
>
>> On Apr 10, 2017, at 7:41 AM, Navneet Kumar <[email protected]
>> <mailto:[email protected]>> 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 ([email protected])
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 [email protected]