Re: adding space for 'annotations' with a typesetter subclass
Re: adding space for 'annotations' with a typesetter subclass
- Subject: Re: adding space for 'annotations' with a typesetter subclass
- From: Bill Dudney <email@hidden>
- Date: Tue, 05 Jun 2012 07:41:23 -0600
Thanks Ross,
That appears to be doing the trick!
Still trikes me as odd though that the other approach of tweaking the willSetLineFragmentRect: wouldn't work. I'll have to ask around at WWDC next week.
Thanks again,
-bd
On Jun 4, 2012, at 12:45 PM, Ross Carter wrote:
> On Jun 1, 2012, at 9:36 AM, Bill Dudney wrote:
>> I'm able to add additional space around a paragraph in my subclass of NSATSTypesetter's implementation of willSetLineFragmentRect:forGlyphRange:usedRect:baselineOffset:. However, I am not getting what I expect as I tweak the parameters to this method. I was hoping for some insight on what these parameters really mean from the group to help me understand why I'm not getting what I expect.
>>
>> When I increase the height of the lineFragmentRect and the usedRect the space for the paragraph does grow and I get the space I expect.
>>
>> What is confusing me is where the line of text is drawn in the lineFragmentRect. Based on experimentation the line of text is always drawn near the top. When I first encountered this I assumed that tweaking the baselineOffset would allow me control over where the text is drawn. I was unable to change where the text is drawn by tweaking baselineOffset.
>>
>> My next attempt was to tweak the origin of the lineFragmentRect. That did move the line of text, but not in ways I expected it to. My thinking was that moving the origin.y 3 would move the text by 3. That does not appear to be the case.
>>
>> Based my reading of the docs it looks to me as if the changes I make in willSetLineFrag… are passed on to setLineFragmentRect:forGlyphRange:usedRect:baselineOffset:. During the implementation of setLineFrag… the layout manager must be called with setLocation:forStartOfGlyphRange:
>
> Bill, I had a similar problem, and I handled it by overriding -paragraphSpacingBeforeGlyphAtIndex: withProposedLineFragmentRect:.
>
> Ross
>
>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please 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