• 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: NSTextView text changes size
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTextView text changes size


  • Subject: Re: NSTextView text changes size
  • From: Chris Ridd <email@hidden>
  • Date: Thu, 28 Nov 2002 09:45:30 +0000

On 27/11/02 9:06 pm, Douglas Davidson <email@hidden> wrote:
> On Wednesday, November 27, 2002, at 12:46 PM, Chris Ridd wrote:
>
>> My app is basically plunking a different NSString into a non-editable
>> (multiple fonts not allowed) NSTextView when the user clicks on rows
>> in a
>> NSTableView.
>>
>> All's fine and dandy, except that I've noticed that after I put one
>> particular string into the view, all subsequent strings get displayed
>> in a
>> *slightly* bigger font. By bigger I mean slightly less condensed,
>> perhaps a
>> slightly bigger font size. The guilty string is this (gibberish, and by
>> \uxxxx I mean Unicode character xxxx):
>>
>> "\u2662\u2663\u2661\u2660\n\u2022 point\n\u20AC89"
>>
>> I'm just using setString: to drop each NSString into the text view,
>> and I'm
>> not using attributed strings anywhere so I am not expecting any font
>> changes.
>>
>> Has anyone else seen anything like this?
>
> setString: applies the typing attributes to the string. The typing
> attributes are normally derived from existing text. In this case, your
> text requires a different font to display it, and this is getting into
> the typing attributes.

Ahhh, that explains it. It seems surprising that a font change just to
display an unusual character is considered a "real" font change and so
changes the display of the next string.

I've just logged a bug for this using bugreporter: 3113838.

> If you really don't care what font is used, you can do what you are
> doing, i.e. never specify a font and let the text view figure one out
> for itself. If you do care, then set the font yourself, either via the
> NSTextView, by calling setTypingAttributes: or setFont:, or else by
> operating on the NSTextStorage and setting a font attribute there.

I used [view setString: @""] just prior to calling setString with my real
string, and it seems to work fine.

Is this also going to happen on plain NSTextFields as well as NSTextViews?

> Multiple fonts not allowed merely means that the user is not allowed to
> set multiple fonts. Programmatic changes are a different matter.

OK. It was a long shot :-)

> Douglas Davidson

Thanks for all the help!

Cheers,

Chris
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: NSTextView text changes size (From: Douglas Davidson <email@hidden>)

  • Prev by Date: Re: replacing self in initWithCoder method? {advanced}
  • Next by Date: Re: Foolish question about NSStrings
  • Previous by thread: Re: NSTextView text changes size
  • Next by thread: replacing self in initWithCoder method? {advanced}
  • Index(es):
    • Date
    • Thread