• 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
NSTextView - changing font size
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSTextView - changing font size


  • Subject: NSTextView - changing font size
  • From: Jeremy Dronfield <email@hidden>
  • Date: Wed, 10 Jul 2002 19:17:09 +0100

I'm using the following method to change the font size in a non-editable TextView:

- (void)sizeText
{
NSFont *textFont;
NSFontManager *fontManager = [NSFontManager sharedFontManager];

textFont = [fontManager convertFont:[textView font] toSize:sizeOption];
[textView setFont:textFont];
}

The problem is that, whilst it changes the size of the entire text (which I want), it also changes ALL the attributes, wiping out italics, bold etc (which I don't want). I know this is because [textView font] only returns the font attributes of the first character in the receiver. What I need is a means of only changing the size. I've looked at the NSAttributedString (and Additions) docs but can't find anything that looks useful (although creating a string object with -initWithRTF: looks like it might be a promising start). What I DON'T want is to have to use the Font Panel, since this is a presentation app which won't look good with that kind of interface element.
- Jeremy.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
  • Prev by Date: How to launch a cocoa/java app at system startup prior to login
  • Next by Date: Re: [Q] NSSplitView
  • Previous by thread: How to launch a cocoa/java app at system startup prior to login
  • Next by thread: Re: NSTextView - changing font size
  • Index(es):
    • Date
    • Thread