• 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
Re: Subclassing NSTypesetter: NSRunStorage exception (solved)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Subclassing NSTypesetter: NSRunStorage exception (solved)


  • Subject: Re: Subclassing NSTypesetter: NSRunStorage exception (solved)
  • From: Jérôme Laurens <email@hidden>
  • Date: Thu, 3 Oct 2002 09:33:40 +0200

Le mardi, 1 oct 2002, ` 18:50 Europe/Zurich, Douglas Davidson a icrit :

On Tuesday, October 1, 2002, at 03:45 AM, Jirtme Laurens wrote:

glyphRange = NSMakeRange(0, end);

I'm not sure exactly what is going wrong here, but one thing that stands out is that you seem to be assuming a one-to-one correspondence of characters to glyphs. That may actually be the case for your text, but you need to at least ask the layout manager to convert between character and glyph indexes. The layout manager is lazy about its glyph generation, so if you never ask then it may never have generated the glyphs you need.


The problem of NSRunStorage exception seems to be "lazyness", and the layoutManager does not expand its NSRunStorage's to the proper size before asking the typesetter to layout lines (because it does not know this size in advance I presume). The solution can be to ask for isValidGlyph index for the last index of the glyph range being laid out by the typesetter, which has the side effect to ensure that all the NSRunStorage have memory allocated up to this index at least.

BTW, for a one to one mapping between chars and glyphs, there is apparently no need to map char index and glyph index.

I feared for a while I could not solve this problem but once again, I got valuable help from the list members. Thanks Douglas.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
References: 
 >Re: Subclassing NSTypesetter: NSRunStorage exception (From: Douglas Davidson <email@hidden>)

  • Prev by Date: Re: How to organize an app
  • Next by Date: Re: Bochs - Free PC emulator
  • Previous by thread: Re: Subclassing NSTypesetter: NSRunStorage exception
  • Next by thread: Re: C++ mixed with Cocoa
  • Index(es):
    • Date
    • Thread