Re: finding text to be drawn in NSTextView drawRect
Re: finding text to be drawn in NSTextView drawRect
- Subject: Re: finding text to be drawn in NSTextView drawRect
- From: Scott Royston <email@hidden>
- Date: Thu, 23 May 2002 01:30:29 -0500
sweet, thanks. looks better, I see:
- (NSRange)glyphRangeForBoundingRect:(NSRect)aRect
inTextContainer:(NSTextContainer *)aTextContainer
and
glyphRangeForBoundingRectWithoutAdditionalLayout
I think I want the WithoutAdditionalLayout one, but the comments scare
me:
"this method doesn't perform glyph generation or layout. Its results,
though faster, can be incorrect."
does anybody know if this will get me what I want? incorrect how?
thanks again
On Thursday, May 23, 2002, at 12:49 AM, Andy Lee wrote:
>
At 12:31 AM -0500 5/23/02, Scott Royston wrote:
>
> I'm currently trying to figure out the range of text that needs to be
>
> redrawn (in drawRect) in an NSTextView.
>
[...]
>
> the only function I could find to get me there was
>
> characterIndexForPoint (in screen coord, no less, ugh). problem is
>
> using a point is very hit or miss. knowing that the text is left to
>
> right helps a little, because I have a better chance of 'hitting' a
>
> character down the left side of the page, but it still doesn't work
>
> very well. before I go further down this path I was hoping somebody
>
> had an easier way.
>
>
Just a stab: maybe the methods in NSLayoutManager would give you better
>
accuracy? I see -characterIndexForGlyphIndex: and a bunch of
>
-glyphIndexFor... methods.
>
>
I don't have deep knowledge of this stuff, but I did have to fiddle
>
with it a while back to get precise scrolling behavior I wanted.
>
>
--Andy
>
_______________________________________________
>
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.
_______________________________________________
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.