• 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
layoutManager drawGlyphs is moving lines up? (WAS: Watch for overflow when drawing...)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

layoutManager drawGlyphs is moving lines up? (WAS: Watch for overflow when drawing...)


  • Subject: layoutManager drawGlyphs is moving lines up? (WAS: Watch for overflow when drawing...)
  • From: Justin Hawkwood <email@hidden>
  • Date: Wed, 22 Jun 2005 18:02:06 -0700

I have a textStorage that I am trying to display during the drawRect function of an NSView (for printing). The documentation gives an example of using the NSLayoutManager's function "drawGlyphsForGlyphRange:atPoint:" but when I do this the lines print from bottom to top. The documentation also said that it will expect a flipped view, but I cannot figure out how to flip the NSView, or correct this some other way. I also tried using an NSTextView, but I could not get it to display at all!

Suggestions?  Help?

~ Justin


On Jun 13, 2005, at 8:27 PM, Fritz Anderson wrote:

On 13 Jun 2005, at 9:56 PM, Justin Hawkwood wrote:


I have an NSString that I would like to draw (using drawInRect: withAttributes:?) to an NSView for printing. As this string was entered using a NSTextView, it could be very long, and I want to know if it overflows the rect that I set it to draw in, and if so where in the string it was clipped, so that I can continue the rest of the string on an other page (rinse and repeat).
PLUS how to do this in pre-10.3?



Once you get into measuring text layouts and multiple text containers, you are officially out of the realm of NSString convenience methods, and into NSLayoutManager and NSTextContainer. Stop for a couple of hours and learn the Cocoa text stack.


You want to read: <http://developer.apple.com/documentation/Cocoa/ Conceptual/TextLayout/index.html>.
Possible prerequisite: <http://developer.apple.com/documentation/ Cocoa/Conceptual/TextArchitecture/index.html>


Examples at /Developer/Examples/TextEdit and /Developer/Examples/ TextSizingExample

I'm sorry, but your head will hurt for a little while (technically, it _is_ brain damage...), but it's the only way to do everything you say you want to do.

    -- F





_______________________________________________ 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: layoutManager drawGlyphs is moving lines up? (WAS: Watch for overflow when drawing...)
      • From: Douglas Davidson <email@hidden>
    • Re: layoutManager drawGlyphs is moving lines up? (WAS: Watch for overflow when drawing...)
      • From: Justin Hawkwood <email@hidden>
References: 
 >Watch for overflow when drawing string to NSView for printing? (From: Justin Hawkwood <email@hidden>)
 >Re: Watch for overflow when drawing string to NSView for printing? (From: Fritz Anderson <email@hidden>)

  • Prev by Date: Re: Problem overriding newObject in NSTreeController
  • Next by Date: Re: Problem overriding newObject in NSTreeController
  • Previous by thread: Re: Watch for overflow when drawing string to NSView for printing?
  • Next by thread: Re: layoutManager drawGlyphs is moving lines up? (WAS: Watch for overflow when drawing...)
  • Index(es):
    • Date
    • Thread