Re: NSTextView and setString
Re: NSTextView and setString
- Subject: Re: NSTextView and setString
- From: Brock Brandenberg <email@hidden>
- Date: Fri, 22 Mar 2002 10:11:37 -0600
Hi Douglas.
The gdb command is
fb -[NSException raise]
Thanks for the GDB tip. Being a CodeWarrior guy until now, I feel like I
need to break open the docs on GDB and get used to the command line
usage in PB.
But, bracketing the calls may be necessary at a different level. I am
using a textContainer with bounds of 10,000,000 in both dimensions so
that the layoutManager doesn't wrap the type (with the appropriate
setHeightTracksTextView: etc.). I'm then getting the bounding rects
for the glyphs with layoutManager boundingRectForGlyphRange: and
adjusting the bounds rect and frame rect accordingly. If I simply
no-op the layout manager call to boundingRectForGlyphRange:, the
setString works fine, so the problem may lie with something the
layoutManager is doing. There is almost no documentation on the
application of these layoutManager APIs, so it may be possible that
the "glyph generation" that the minimal docs does mention needs to be
bracketed with some set-up and tear-down calls.
I'm not sure exactly what you're aiming for here, but if you just want
the text view to track the width of the text in the container,
setHorizontallyResizable:YES should do it. You shouldn't have to do it
yourself. See
http://developer.apple.com/techpubs/macosx/Cocoa/TasksAndConcepts/ProgrammingTopics/
TextStorageLayer/Tasks/TrackingSize.html.
Unfortunately, we're doing something a little too advanced for a
NSTextView. We're building an automated sign layout application that is,
in effect, doing automated polygon alignment and containment where the
polygons are font glyphs. The NSTextView and accompanying
NSLayoutManager has been the main means of displaying the glyphs and
gaining access to their bounding rects, but it seems to have too much
baggage associated with it for our usage. The NSTextView is not
intelligent enough to properly layout glyphs like in Zapfino (if you put
a large, lowercase "f" as the first character, you'll notice the glyph
hang outside the textview, and in order to fix it, you have to adjust
the glyph start point, but that's only one of many problems we have).
I will most likely build a custom NSView with a properly oriented y-axis
that maintains a NSTextStorage, NSLayoutManager and NSTextContainer,
then use a drawAttributedString: method to simply lay the glyphs onto
the view. The live editing of the type needs to go away anyway. Our
application is data driven from a database, and after more UI work, we
don't have a need for live editing in an NSTextView. We can provide an
alternate text entry field and push the data to the custom view as
needed since the user won't be able to apply font attributes to
individual characters anyway.
Thanks,
Brock Brandenberg
----- industrial design @ bergdesign ------
web site: www.bergdesign.com
email: email@hidden
--------------------------------------------
_______________________________________________
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.