• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
adding space for 'annotations' with a typesetter subclass
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

adding space for 'annotations' with a typesetter subclass


  • Subject: adding space for 'annotations' with a typesetter subclass
  • From: Bill Dudney <email@hidden>
  • Date: Fri, 01 Jun 2012 07:36:32 -0600

Hello,

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:

I'm trying to follow a sample from Doug Davidson's WWDC 2003 NSText talk, however the sample is not on the ADC site. I found this post where Doug pasted in part of the sample:

http://lists.apple.com/archives/cocoa-dev/2006/Dec/msg00096.html

My end goal is similar but not the same. I have multiple paragraphs that will be marked with an additional attribute. I only want the first and last lines to be expanded/moved.

Thanks for your time!

-bd
_______________________________________________

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


  • Follow-Ups:
    • Re: adding space for 'annotations' with a typesetter subclass
      • From: Ross Carter <email@hidden>
  • Prev by Date: Re: NSOperationQueue
  • Next by Date: Re: NSOperationQueue
  • Previous by thread: Re: Sandboxing. WTF?
  • Next by thread: Re: adding space for 'annotations' with a typesetter subclass
  • Index(es):
    • Date
    • Thread