• 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: Problem with setting fonts in NSTextView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem with setting fonts in NSTextView


  • Subject: Re: Problem with setting fonts in NSTextView
  • From: Graham Cox <email@hidden>
  • Date: Fri, 9 Jan 2009 22:31:26 +1100


On 9 Jan 2009, at 10:07 pm, rethish wrote:

NSArray *path=[[NSFontManager alloc] availableFonts];


I take it this is merely a typo; you surely mean:

[[NSFontManager sharedFontManager] availableFonts];

Using:     [textview setFont:fontobj];

Where fontobj is an object of nsfont.

But the problem is ,if we select any item from the popupbutton ,the entire
text's font is changed from the textview.


I really want to set font whenever we select an item


This is exactly what the documentation says it will do.

Instead try:

[myTextView setFont:fontObj range:[myTextView rangeForUserCharacterAttributeChange]];

Bear in mind the comments in the docs for that method regarding undo. Also, you might need to use:

-setTypingAttributes: to seta font ready for typing when the text or selection range is empty.

hth,

Graham


_______________________________________________

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


References: 
 >Problem with setting fonts in NSTextView (From: rethish <email@hidden>)

  • Prev by Date: Re: CALayer not displaying masked CGImage properly
  • Next by Date: PDF Problem
  • Previous by thread: Problem with setting fonts in NSTextView
  • Next by thread: [XCode] Generating method stubs
  • Index(es):
    • Date
    • Thread