• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Fixed font width
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Fixed font width
      • From: Jens Alfke <email@hidden>
References: 
 >Fixed font width (From: Rajendran P <email@hidden>)

  • Prev by Date: Fixed font width
  • Next by Date: sending html file to safari for printing
  • Previous by thread: Fixed font width
  • Next by thread: Re: Fixed font width
  • Index(es):
    • Date
    • Thread