Re: Fixed font width
Re: Fixed font width
- Subject: Re: Fixed font width
- From: Ken Thomases <email@hidden>
- Date: Wed, 06 Jun 2012 09:46:57 -0500
On Jun 6, 2012, at 9:25 AM, Rajendran P wrote:
> How do i specify fixed font width for an nsattributedstring (used to set string to nstextfield) ?
First, perhaps you just want to use a fixed-width font instead of setting a fixed width on a non-fixed-width font.
Anyway, I think you use the font attribute NSFontFixedAdvanceAttribute. So, you either construct a NSFontDescriptor from scratch and include that attribute, or you start from an NSFont, get its fontDescriptor, and then use -fontDescriptorByAddingAttributes: to create a new font descriptor with that attribute. Then, you use +[NSFont fontWithDescriptor:size:] to get an NSFont and set it on the attributed string with NSFontAttributeName.
Regards,
Ken
_______________________________________________
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:
This email sent to email@hidden