• 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
Text Layout problems
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Text Layout problems


  • Subject: Text Layout problems
  • From: Ben Lachman <email@hidden>
  • Date: Sun, 5 Mar 2006 14:37:17 -0500

I'm having some trouble with a hand rolled text system. I'm using a custom subclass of NSTextContainer that defines a non-rectangular text container (it is set down from the top of the text view and has other chunks taken out of it, etc.) and a custom subclass of NSTextView. My layout manager is the normal NSLayoutManager with it's normal typesetter. The problem comes when I set the resizing up. According to <http://developer.apple.com/documentation/Cocoa/ Conceptual/TextStorageLayer/index.html>

Whether it tracks the size of its NSTextView or not, an NSTextContainer doesn’t grow or shrink as text is added or deleted; instead, the NSLayoutManager resizes the NSTextView based on the portion of the NSTextContainer actually filled with text. To allow an NSTextView to be resized in this manner, use NSTextView’s setVerticallyResizable: or setHorizontallyResizable: methods (which are inherited from NSText) as needed, set the text container not to track the size of its text view, and set the text container’s size in the appropriate dimension large enough to accommodate a great amount of text—for example, 10,000,000 points (this incurs no cost whatever in processing or storage).

So I set up the text view to be vertically resized by the layout manager via setVerticallyResizable:YES and set the text container to resize horizontally with setWidthTracksTextView:YES per the documentation. However when I size the window down to where the text view must resize, the blank space at left at the top of my text container gets ignored and the text which was drawn 10 units from the top of the view is mashed up against it.

I think this might be a "feature" of the layout manager since calling the usedRectForTextContainer: returns a rectangle that doesn't include the top portion of the text container (I'm not saying this is necessarily wrong behavior since that portion of the container is empty, its just not what I want it to do) and the layout manager is what resizes the text view (according to the docs). So my basic question is, how do I stop this from happening? Is there a function in the layout manager that I can override? In looking through the class docs I can't figure out what it would be.

Anyway, any help would be great.

Thanks,

->Ben

--
The user's going to pick dancing pigs over security every time. — Bruce Schneier




_______________________________________________
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: Text Layout problems
      • From: Douglas Davidson <email@hidden>
  • Prev by Date: Re: Flickering Scrollbar [Resolved]
  • Next by Date: Re: GDB: without symbol name?
  • Previous by thread: Re: NSArrayController's contentArray and selectedIndexes don't match when sorted
  • Next by thread: Re: Text Layout problems
  • Index(es):
    • Date
    • Thread