• 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
No NSTextContainer being returned for glyph range
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

No NSTextContainer being returned for glyph range


  • Subject: No NSTextContainer being returned for glyph range
  • From: "Mike R. Manzano" <email@hidden>
  • Date: Wed, 6 Sep 2006 15:44:51 -0700

Hi all,

Consider this code snippet:

NSLayoutManager* lm = [ [ _textStorage layoutManagers ] objectAtIndex: 0 ] ;
// Find the glyph range for this range
NSRange glyphRange = [ lm
glyphRangeForCharacterRange:_currentCursorPosition
actualCharacterRange:nil ] ;
// Get the container for this glyph range
if( [ lm isValidGlyphIndex:glyphRange.location ] )
{
NSTextContainer* container = [ lm
textContainerForGlyphAtIndex:glyphRange.location effectiveRange:nil
withoutAdditionalLayout:NO ] ;
NSAssert1( container != nil , @"container is nil for char range %@" ,
NSStringForRange( [ lm characterRangeForGlyphRange:glyphRange actualGlyphRange:nil ] ) ) ;

[…]



The assertion (NSAssert1) is being thrown every now and then during program execution. The if statement validates that the glyphRange in question is valid. The call to textContainerForGlyphAtIndex:effectiveRange:withoutAdditionalLayout: should finish the layout so that a valid response can be returned.


My question is, if the glyph range is a valid one, and the layout is ensured to be finished, then can't I assume a valid container to be returned every time?

Thanks in advance,

Mike Manzano
alephx01 (at) mac (dot) com


_______________________________________________ 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
  • Follow-Ups:
    • Re: No NSTextContainer being returned for glyph range
      • From: Douglas Davidson <email@hidden>
  • Prev by Date: Re: Screen device name?
  • Next by Date: Re: Unconventional memory leak problem
  • Previous by thread: Re: Processes vs. Threads in Cocoa software architectures
  • Next by thread: Re: No NSTextContainer being returned for glyph range
  • Index(es):
    • Date
    • Thread