• 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
Re: How to apply a new font to NSTextField after a font change
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to apply a new font to NSTextField after a font change


  • Subject: Re: How to apply a new font to NSTextField after a font change
  • From: John Stiles <email@hidden>
  • Date: Fri, 07 Dec 2007 10:18:53 -0800

Is this a text field that is currently being edited?
If so, you will need to work with the window's field editor, since that is standing in for the NSTextField while it is being edited.



Satoshi Nakagawa wrote:
Sure, I tried it but it didn't work.

--
Satoshi Nakagawa

On 2007/12/08, at 2:53, John Stiles wrote:

Not sure if this will fix it, but did you try [text setNeedsDisplay:YES]
?


Satoshi Nakagawa wrote:
Hi,


How can I apply a new font to NSTextField after a font change?

There is a NSTextField which doesn't have rich text style. Its font is big and it contains some texts.

Then I change the font to another one like:

 NSFont* font = [NSFont fontWithName:@"Arial" size:10.0];
 [text setFont:font];
 NSSize size = [text frame].size;
 size.height = ceil([font ascender]) - floor([font descender]) + 5;
 [text setFrameSize:size];

Though I set a new font, the text in the NSTextField remains in the old font. If I push the enter key, the style is applied to the NSTextField.

I want to apply a new font without hitting the enter key. What should I do?

Reproduce code:
 http://limechat.net/sample/TextFieldHeight.zip

--
Satoshi Nakagawa

_______________________________________________

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

_______________________________________________

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 to apply a new font to NSTextField after a font change
      • From: Satoshi Nakagawa <email@hidden>
References: 
 >How to apply a new font to NSTextField after a font change (From: Satoshi Nakagawa <email@hidden>)
 >Re: How to apply a new font to NSTextField after a font change (From: John Stiles <email@hidden>)
 >Re: How to apply a new font to NSTextField after a font change (From: Satoshi Nakagawa <email@hidden>)

  • Prev by Date: Re: How to apply a new font to NSTextField after a font change
  • Next by Date: Re: How to apply a new font to NSTextField after a font change
  • Previous by thread: Re: How to apply a new font to NSTextField after a font change
  • Next by thread: Re: How to apply a new font to NSTextField after a font change
  • Index(es):
    • Date
    • Thread