• 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: _NSFastFillAllLayoutHolesUpToGlyphIndex crash in NSLayoutManager
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: _NSFastFillAllLayoutHolesUpToGlyphIndex crash in NSLayoutManager


  • Subject: Re: _NSFastFillAllLayoutHolesUpToGlyphIndex crash in NSLayoutManager
  • From: Keith Blount <email@hidden>
  • Date: Thu, 2 Aug 2007 04:05:51 -0700 (PDT)

Thanks for your reply Martin (again - your name is
already in the "Thank You" section of my app's credits
:) ).

After much long, hard thought and trial and error, I
finally achieved your first suggestion of calculating
widows and orphans after all layout is finished. I
ended up caching information about the paragraphs (how
many lines in each, glyph range) in a dictionary when
the text is first loaded, then laying out the text in
the text containers and just using the cached
paragraph information to take note of the first
widow/orphan encountered in the layout delegate "did
finish" method (but without actually doing anything
other than taking note). Then, after layout is
complete, I adjust the frame of text view/container to
fix the widow/orphan, which causes more layout - which
I wait for again, and which triggers the delegate to
find the next widow/orphan and so on, until it's all
complete. It would never work for a word processor
that requires live layout, but for a printing view
such as mine at least it works now without crashing (I
hope).

So, thank you again. :)

All the best,
Keith

--- Martin Wierschin <email@hidden> wrote:

> Hi Keith,
>
> > If anyone can see what I am doing wrong in the
> above
> > method (bearing in mind that it gets called from
> the
> > NSLayoutManager delegate method), I would be very
> > grateful; I have now spent days on this to no
> avail.
>
> In my experience Bad Things can happen if you
> trigger additional
> layout from the "didCompleteLayout" delegate method.
> This is a huge
> annoyance, but basically you will need to relocate
> your validation
> code. You have two options:
>
> 1. Make it happen after NSLayoutManager has cleanly
> filled part of a
> layout hole, eg: the method
> "_fillLayoutHoleAtIndex:etc:" is no
> longer active on the stack.
> 2. Make it happen concurrently with NSTypesetter's
> line fragment
> placement. This is more complicated.
>
> ~Martin
>
>




____________________________________________________________________________________
Got a little couch potato?
Check out fun summer activities for kids.
http://search.yahoo.com/search?fr=oni_on_mail&p=summer+activities+for+kids&cs=bz
_______________________________________________

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

  • Prev by Date: Re: applicationShouldOpenUntitledFile not invoked
  • Next by Date: Re: applicationShouldOpenUntitledFile not invoked
  • Previous by thread: Re: Mixing Static and Dynamic Librararies, Multiple Definitions of Symbol, Two-Level Namespace
  • Next by thread: [OT] Re: Mixing Static and Dynamic Librararies, Multiple Definitions of Symbol, Two-Level Namespace
  • Index(es):
    • Date
    • Thread