• 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
rectArrayForCharacterRange and lineSpacing (was: text highlighting with CALayer and NSTextView)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

rectArrayForCharacterRange and lineSpacing (was: text highlighting with CALayer and NSTextView)


  • Subject: rectArrayForCharacterRange and lineSpacing (was: text highlighting with CALayer and NSTextView)
  • From: Koen van der Drift <email@hidden>
  • Date: Mon, 03 Sep 2012 14:02:48 -0400

On Aug 25, 2012, at 6:10 AM, Koen van der Drift <email@hidden> wrote:

>     NSRectArray    rectArray = [[self layoutManager] rectArrayForCharacterRange: aRange
>                                                    withinSelectedCharacterRange: selectedRange
>                                                                 inTextContainer: [self textContainer]
>                                                                       rectCount: &rectCount];


For some reason, the height of the last rect in the NSRectArray is smaller than the other ones, and therefore the CALayer I draw behind the corresponding range of text looks wrong.

My font size is 16, and the line spacing is set to 12.   For most rects, the height returned is 31 (= 16 + 12 + 3), but for the last one, the height is 19 ( = 16 + 3).

So it seems for the last rect, the linespace is ignored.  I can test for that, and correct it, but I was wondering what is going on.  And where does the '3' come from?

- Koen.


_______________________________________________

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: rectArrayForCharacterRange and lineSpacing (was: text highlighting with CALayer and NSTextView)
      • From: Kyle Sluder <email@hidden>
    • Re: rectArrayForCharacterRange and lineSpacing (was: text highlighting with CALayer and NSTextView)
      • From: Graham Cox <email@hidden>
  • Prev by Date: Re: UIDocument openWithCompletionHandler: called on what thread?
  • Next by Date: Re: Create custom NSTableView with a button inside
  • Previous by thread: Re: UIDocument openWithCompletionHandler: called on what thread?
  • Next by thread: Re: rectArrayForCharacterRange and lineSpacing (was: text highlighting with CALayer and NSTextView)
  • Index(es):
    • Date
    • Thread