• 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: How do I soft-wrap text at a specific line length?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How do I soft-wrap text at a specific line length?


  • Subject: Re: How do I soft-wrap text at a specific line length?
  • From: Chris Kenny <email@hidden>
  • Date: Mon, 16 Feb 2004 14:08:48 -0500

On Feb 16, 2004, at 4:04 AM, Allan Odgaard wrote:

On 9. Feb 2004, at 4:31, Chris Kenny wrote:

I'd like to create an NSTextField which soft-wraps text at 80 characters, regardless of whether a monospaced or proportional font is being used. So far, my experiments with the text system haven't been very productive. Is there a reasonable way to do this?

hmm... you might replace all spaces with non-breaking spaces and insert non-spacing break marks at every 80th character.

I'd really like to try to avoid that sort of thing, if at all possible.

Alternatively you can create a non-rectangular NSTextContainer which measures the text and shapes itself to the width of each line (of 80 characters).

Right, I've tried that, but I can't seem to figure out how many characters are on the current line from my NSTextContainer subclass's lineFragmentRectForProposedRect:sweepDirection:movementDirection: remainingRect: method, which is were I seem to need to be to change the wrapping behavior. When I try to ask the layout manager from that method, about what's presently contained within the current line fragment, using methods like glyphRangeForBoundingRect:inTextContainer:, the app crashes.
_______________________________________________
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: How do I soft-wrap text at a specific line length?
      • From: Allan Odgaard <email@hidden>
    • Re: How do I soft-wrap text at a specific line length?
      • From: "Louis C. Sacha" <email@hidden>
References: 
 >How do I soft-wrap text at a specific line length? (From: Chris Kenny <email@hidden>)
 >Re: How do I soft-wrap text at a specific line length? (From: Allan Odgaard <email@hidden>)

  • Prev by Date: performKeyEquivalent & key events
  • Next by Date: Re: Self contained MetaPackages
  • Previous by thread: Re: How do I soft-wrap text at a specific line length?
  • Next by thread: Re: How do I soft-wrap text at a specific line length?
  • Index(es):
    • Date
    • Thread