NSTextView - changing font size
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.