How font size managed without affecting the font? Please help
How font size managed without affecting the font? Please help
- Subject: How font size managed without affecting the font? Please help
- From: rethish <email@hidden>
- Date: Wed, 14 Jan 2009 12:20:55 +0530
Hi all,
problem:
I have some text(in textview) with different combination of fonts. If i
select some range of text (combination of different fonts) to change its
size , the size changes with a change in font (which was last selected from
the popupbutton pop1).
I want to change the fontsize without affecting the font . (AS IN
TEXTEDIT AND WORD)
I use all the fonts and fontsize through a popupbutton:
pop1 : font
pop2 : fontsize
NSArray *path=[[NSFontManager alloc] availableFonts];
[pop1 addItemsWithTitles:path];
I use this code to change the fontsize:
NSFont *font1 = [NSFont fontWithName:[pop1 titleOfSelectedItem] size:[[pop2
titleOfSelectedItem] doubleValue]];
if([[txt string] isEqualToString:@""])
{
[txt setFont:font1];
}
else
{
NSRange range= [txt rangeForUserCharacterAttributeChange];
NSDictionary *attrs=[NSDictionary
dictionaryWithObjectsAndKeys:font1, NSFontAttributeName ,txt ,
NSTextViewDidChangeTypingAttributesNotification, nil];
[txt setTypingAttributes:attrs];
[txt setFont:font1 range: range];
}
Thank you
regards
_______________________________________________
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