Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTextView Linked Text Font Attribute Issues




On Dec 29, 2007, at 2:19 PM, Ricky Sharp wrote:


On Dec 29, 2007, at 4:05 PM, Robb Albright wrote:

On Dec 28, 2007, at 12:01 PM, email@hidden wrote:

I'm having issued with a subclassed NSTextView displaying linked text
as I'd like it to. The link text attributes I specify are working,
except for the font name attribute. The link text appears to be
rendered in the Helvetica font, while my default attributes call for
Monaco.


<snip>


myDefaultLinkTextAttributes =
[[NSDictionary alloc] initWithObjectsAndKeys:
[NSFont fontWithName: @"Monaco" size: 12.0], NSFontNameAttribute,
[NSColor lightGrayColor], NSForegroundColorAttributeName,
[NSColor clearColor], NSBackgroundColorAttributeName,
[NSNumber numberWithInt: NSUnderlineStyleNone], NSUnderlineStyleAttributeName,
[NSCursor pointingHandCursor], NSCursorAttributeName,
nil];



<snip incorrect advice>

NSFontNameAttribute (and others that have a pattern of NSFont*Attribute] are for working with NSFontDescriptor.


The original code was almost correct; just change the key name to NSFontAttributeName. As with other keys that can be used, the pattern is NS*AttributeName. And, for this particular key, you do in fact want to provide the actual font instance.


D'oh! Thanks for the correction... guess I jumped in too quickly without checking my work.

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
robb albright
software engineer – Macintosh and cross-platform
Vernier Software & Technology


_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >Re: NSTextView Linked Text Font Attribute Issues (From: Robb Albright <email@hidden>)
 >Re: NSTextView Linked Text Font Attribute Issues (From: Ricky Sharp <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.