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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to