Re:Fill text in a circle path - NSVIEW
Re:Fill text in a circle path - NSVIEW
- Subject: Re:Fill text in a circle path - NSVIEW
- From: Gordon Apple <email@hidden>
- Date: Fri, 18 May 2007 11:31:24 -0500
You need to write your own subclass of NStextcontainer. For a specific
mathematically known shape like a circle, it is quite easy. You only have
to override two methods:
- (BOOL)isSimpleRectangularTextContainer
{
return NO;
}
- (NSRect)lineFragmentRectForProposedRect:(NSRect)proposedRect
sweepDirection:(NSLineSweepDirection)sweepDirection
movementDirection:(NSLineMovementDirection)movementDirection
remainingRect:(NSRectPointer)remainingRect
{
// Your own shape code here.
// Trim proposedRect to the circle bounds
// Set remainingRect == NSZeroRect
// return your trimmed version of proposedRect
}
You then have to replace the text container with yours. Check out the
documentation on textcontainers.
I have a solution for generic Bezier shapes, but you don't want to get
into that. You can see results at <www.ed4u.com/textflow>
> Message: 2
> Date: Fri, 18 May 2007 16:02:38 +0530
> From: "saj c" <email@hidden>
> Subject: Fill text in a circle path - NSVIEW
> To: email@hidden
> Message-ID:
> <email@hidden>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> I need to fill some text in a circle. the circle is in a nsview.
>
> I placed some text using NStextcontainer and NSLayoutmanager but its
> dispalyed in rectangle. pls help me
>
>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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