Re: NSLayoutManager looping with custom NSTextContainer
Re: NSLayoutManager looping with custom NSTextContainer
- Subject: Re: NSLayoutManager looping with custom NSTextContainer
- From: "Martin" <email@hidden>
- Date: Fri, 29 Sep 2006 12:41:26 -0700
I ran into a problem where layout stalls for an NSTextContainer that has a hole cropped out of it. Checking the list archives, I've found this:
>> FROM : Sergei Borodavkin
>> DATE : Thu Jun 02 15:14:27 2005
>>
>> In my project I've overridden NSTextContainer to provide text
>> wrapping around miscellaneous vector shapes
>> ...
>> Everything works ok, but sometimes the text system gets into some
>> kind of an infinite loop, and it calls my
>> lineFragmentRectForProposedRect, passing to it proposedRect, which
>> has _the same_ origin.y at each call.
>> So, the key symptoms of this situation are:
>> 1. proposedRect.origin.y has the same value at the beginning of each
>> lineFragmentRectForProposedRect call
>> 2. proposedRect.size.height vary from call to call between some two
>> values
I have experienced the exact same issue. It appears to occur when the hole in the NSTextContainer intersects the region used by the paragraph spacing. I would guess that the typesetter is continually trying the same line fragment with and without the paragraph spacing. Without the spacing the line fits complete, otherwise the fragment intersects with the hole and cannot fully fit.
Douglas Davidson wrote:
> If you have a reproducible case of this, it would be interesting to
> see it. It might then be possible (a) to fix this within AppKit, and
> (b) to supply criteria you could use to work around it.
I've filed this as radar://4757853, with a project that reproduces the problem. However, in the meantime I would be very grateful if anyone has any workarounds for 10.3.9 and up. Thanks!
~Martin
_______________________________________________
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