• 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: lineFragmentRectForProposedRect question ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: lineFragmentRectForProposedRect question ?


  • Subject: Re: lineFragmentRectForProposedRect question ?
  • From: Douglas Davidson <email@hidden>
  • Date: Wed, 10 Apr 2002 11:25:47 -0700

On Wednesday, April 10, 2002, at 06:43 AM, RFM wrote:

Does anyone know if there is an example available on how to use the
NSTextContainer method lineFragmentRectForProposedRect: ? That is how to
calculate an actual line fragment rectangle for a particular word or
line in text ? I've had no luck subclassing this to do some special
operations that I would like to implement such as clean page breaking on
both horizontal and vertical page boundaries for words and lines that
are split across these boundaries ? Is that even possible using this
method ? is there some other way to achieve this ?

The point of NSTextContainer is to model the geometry of a region in which text is to be laid out. A given layout manager will have a list of such regions, representing such things as the columns on a page, or the pages in a document, and will lay the text out into them sequentially. To see a simple example, run TextEdit and put it in "wrap to page" mode. The pages you will see are individual text containers.

Most text containers are simple rectangles, and that is the behavior provided by the basic NSTextContainer class. Usually you would subclass NSTextContainer if you wanted to model some other type of region, especially a non-rectangular one. In that case, the way it works is that the typesetter will propose a particular line rectangle, and the text container will be asked to approve, modify, or reject it. For example, if your text container were a rectangle with holes, you would decide whether the proposed line intersected any of the holes, and if so truncate it into a piece to the left of the hole, plus a remainder to the right of the hole.

I'm not sure what you mean by "words and lines that are split across these boundaries", but perhaps you could supply some examples, and then maybe we could better advise you.

Douglas Davidson
_______________________________________________
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.

  • Follow-Ups:
    • Re: lineFragmentRectForProposedRect question ?
      • From: RFM <email@hidden>
References: 
 >lineFragmentRectForProposedRect question ? (From: RFM <email@hidden>)

  • Prev by Date: Quick PB localization question
  • Next by Date: Re: lineFragmentRectForProposedRect question ?
  • Previous by thread: lineFragmentRectForProposedRect question ?
  • Next by thread: Re: lineFragmentRectForProposedRect question ?
  • Index(es):
    • Date
    • Thread