• 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: Newlines + quartz text?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Newlines + quartz text?


  • Subject: Re: Newlines + quartz text?
  • From: Douglas Davidson <email@hidden>
  • Date: Mon, 13 Aug 2007 16:46:20 -0700


On Aug 4, 2007, at 7:05 PM, Maryanna Rogers wrote:

CGContextShowTextAtPoint (myOverlayContext, 0, 0, [newScript
cStringUsingEncoding: NSUnicodeStringEncoding g], [newScript length]);

I've tried all sorts of different encodings, ASCII, unicode, UTF8, and
none work Little rectangles are displayed where the breaks should be.
Can someone help me figure out why the text I draw through
CGContextShowTextAtPoint keeps refusing to break when I give it a
newline? I don't understand!

You shouldn't use CG APIs directly for text drawing like this. They do not perform layout (as you have discovered) and will not correctly display Unicode text. If you have already obtained glyphs and layout from some other source (the Cocoa text system, ATSUI, etc.) then you can use CG APIs to draw the glyphs, but it may be more convenient to just use a higher-level API to do the drawing as well. The documentation has warnings to this effect, but they are rather understated; they might well be much stronger.


Douglas Davidson

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Newlines + quartz text? (From: "Maryanna Rogers" <email@hidden>)

  • Prev by Date: Re: drawing a simple string with NSFont
  • Next by Date: [Fwd: NSMenuItem question]
  • Previous by thread: Re: Newlines + quartz text?
  • Next by thread: Resolution independent cursor
  • Index(es):
    • Date
    • Thread