• 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: string drawing again
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: string drawing again


  • Subject: Re: string drawing again
  • From: David Elliott <email@hidden>
  • Date: Sat, 7 Feb 2004 22:37:22 -0500

On Feb 4, 2004, at 6:30 PM, Chris Meyer wrote:

I'm trying to draw a string in a sub-rectangle of a non-flipped graphics context. The string needs to be justified to the sides of the sub-rectangle.

I can't use the NSString methods drawInRect or drawAtPoint because they clip the right side of large italicized strings.

I can't use the text layout classes because they (strangely) require a flipped coordinate system.


I've had great luck in wxCocoa using them on non-flipped windows. The trick is that you have to manually adjust some things because the text system seems to account for flipped views in some places but not others.

Check this out:
http://cvs.wxwindows.org/viewcvs.cgi/wxWindows/src/cocoa/dc.mm? rev=1.19&content-type=text/vnd.viewcvs-markup

Specifically, wxDC::DoDrawText()

Note, this was written quite a long time ago now and with almost zero knowledge of the Cocoa text system aside from reading the documentation and pure trial and error.

In hindsight, it probably would have been easier to keep an NSTextView around in an offscreen window and composite the drawing onto the real view.

-Dave
_______________________________________________
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.

References: 
 >string drawing again (From: Chris Meyer <email@hidden>)

  • Prev by Date: Re: NSSlider and live resize
  • Next by Date: Converting wchar_t string to NSString
  • Previous by thread: Re: string drawing again
  • Next by thread: App crashes while loading nibs?
  • Index(es):
    • Date
    • Thread