Re: Making NSTextView draw like NSString's -drawInRect:withAttributes:?
Re: Making NSTextView draw like NSString's -drawInRect:withAttributes:?
- Subject: Re: Making NSTextView draw like NSString's -drawInRect:withAttributes:?
- From: Keith Blount <email@hidden>
- Date: Thu, 16 Feb 2006 10:46:41 -0800 (PST)
Many thanks - that is exactly what I needed. Calling
the following solved the problem:
[[editorTextView layoutManager]
setTypesetterBehavior:NSTypesetterBehavior_10_2_WithCompatibility];
[[editorTextView textContainer]
setLineFragmentPadding:0.0];
Now the text view looks identical to what is drawn by
NSString's -drawInRect:attributes:.
Many thanks again,
Keith
--- Douglas Davidson <email@hidden> wrote:
>
> On Feb 16, 2006, at 9:55 AM, Keith Blount wrote:
>
> > I have a custom view which draws various boxes of
> text
> > using NSString's -drawInRect:withAttributes:. I am
> > currently improving this view so that each box is
> > editable. This part isn't too difficult - I just
> add
> > an NSTextView as a subview at the location of the
> > edited box when a box is double-clicked.
> >
> > My problem is that no matter what I do, I cannot
> get
> > the text as it is drawn in the text view to match
> the
> > text as it is drawn by NSString's methods. In the
> text
> > view, each line of text is about 1 pixel smaller
> than
> > when it is drawn by NSString. (I have called
> > -setLineFragmentPadding: on the text container and
> set
> > it to 0.0 so that it matches horizontally). I have
> > tried everything I can think of, including using
> > paragraph attributes such as
> setMinimumLineSpacing:
> > (though I want the text view as plain text), and
> > setting the text view as the field editor using
> > -setFieldEditor:YES.
> >
>
> Look for Aki's recent post on NSTypesetterBehavior
> settings, and try
> that.
>
> Douglas Davidson
>
>
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden