• 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
How font size managed without affecting the font? Please help
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: How font size managed without affecting the font? Please help
      • From: Benjamin Stiglitz <email@hidden>
  • Prev by Date: Re: Constructing class names dynamically
  • Next by Date: Capture video from core animation (QC)
  • Previous by thread: Re: UTIs and type codes and extensions
  • Next by thread: Re: How font size managed without affecting the font? Please help
  • Index(es):
    • Date
    • Thread