Forums
New posts
Articles
Product Reviews
Policies
FAQ
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Menu
Log in
Register
Install the app
Install
Forums
macOS & iOS Developer Playground
macOS - Development and Darwin
setting font size
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="rethish" data-source="post: 840142" data-attributes="member: 99370"><p>Hi,</p><p></p><p>I am developing a text editor in which I use to set the font name and font size by selecting it from popup buttons.</p><p></p><p>Fonts obtained using the code:</p><p>NSArray *path=[[NSFontManager alloc] availableFonts];</p><p>[fontList addItemsWithTitlesath];</p><p></p><p>I use to set font using :</p><p>NSFont *font = [NSFont fontWithName<img src="/mac_images/images/smilies/Embarrassed.png" class="smilie" loading="lazy" alt=":[" title="Embarrassed :[" data-shortname=":[" />fontList titleOfSelectedItem] size<img src="/mac_images/images/smilies/Embarrassed.png" class="smilie" loading="lazy" alt=":[" title="Embarrassed :[" data-shortname=":[" />[fontSize titleOfSelectedItem] doubleValue]];</p><p></p><p>NSRange selectedRange= [textView rangeForUserCharacterAttributeChange];</p><p>[textView setFont:font range:selectedRange ];</p><p></p><p>This works properly if the selected text is composed of single font.</p><p>But if i select the text which is composed of multiple fonts, then font of entire text is set to the font, that is last selected from the popupbutton.</p><p></p><p></p><p>How can I resize the font size without affecting the fonts in it?</p><p></p><p>Thank you in advance</p><p></p><p>Rethish</p></blockquote><p></p>
[QUOTE="rethish, post: 840142, member: 99370"] Hi, I am developing a text editor in which I use to set the font name and font size by selecting it from popup buttons. Fonts obtained using the code: NSArray *path=[[NSFontManager alloc] availableFonts]; [fontList addItemsWithTitlesath]; I use to set font using : NSFont *font = [NSFont fontWithName:[fontList titleOfSelectedItem] size:[[fontSize titleOfSelectedItem] doubleValue]]; NSRange selectedRange= [textView rangeForUserCharacterAttributeChange]; [textView setFont:font range:selectedRange ]; This works properly if the selected text is composed of single font. But if i select the text which is composed of multiple fonts, then font of entire text is set to the font, that is last selected from the popupbutton. How can I resize the font size without affecting the fonts in it? Thank you in advance Rethish [/QUOTE]
Verification
Post reply
Forums
macOS & iOS Developer Playground
macOS - Development and Darwin
setting font size
Top