Re: How do you determine where picture is in an rtfd view?
Re: How do you determine where picture is in an rtfd view?
- Subject: Re: How do you determine where picture is in an rtfd view?
- From: Douglas Davidson <email@hidden>
- Date: Mon, 7 Apr 2003 10:11:15 -0700
On Sunday, April 6, 2003, at 11:41 AM, Mark Ogilvie wrote:
When you create an rftd file with an image in it, how can you tell
where the image is in relation to the text?
Determining the location of an attachment in an NSTextView is similar
to determining the location of an ordinary glyph. Use the
NSLayoutManager to determine the glyph corresponding to the attachment
character, and which text container it is laid out in (if there is more
than one). Then you can ask the NSLayoutManager for the rect of the
line fragment in which that glyph lies, and for the location of the
glyph in that line fragment. Bear in mind that the location of the
line fragment is relative to the origin of the container (which is
offset from the origin of the view by the view's textContainerOrigin)
and that the location of the glyph is relative to the origin of the
line fragment rect. Try looking at the LayoutManagerDemo example on
developer.apple.com for this.
Douglas Davidson
_______________________________________________
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.