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

Newlines + quartz text?


  • Subject: Newlines + quartz text?
  • From: "Maryanna Rogers" <email@hidden>
  • Date: Sat, 4 Aug 2007 22:05:40 -0400

Hi,

I've been struggling with trying to figure out how to have Quartz
display newline characters as actual line breaks.

NSString* newScript = [[NSString alloc] initWithString:@""];
NSString *sep = [NSString stringWithFormat: @"%C", NSLineSeparatorCharacter];

NSString*  rCont = [[NSString alloc] initWithContentsOfFile:rootPath
encoding: NSUnicodeStringEncoding error:&error];

NSArray *lines = [rCont componentsSeparatedByString:@"\n"];

for(NSString *line in lines) {
  newScript = [newScript stringByAppendingString:line];
  newScript = [newScript stringByAppendingString:@"\n"];
}

NSLog(@"new script %@", newScript);

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!


~m
_______________________________________________

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

  • Follow-Ups:
    • Re: Newlines + quartz text?
      • From: Douglas Davidson <email@hidden>
    • Re: Newlines + quartz text?
      • From: Marcel Weiher <email@hidden>
  • Prev by Date: Secure-Text-Field-Like Field Editor Initialization
  • Next by Date: Re: Newlines + quartz text?
  • Previous by thread: Re: Associate, NSView in main window, and disable objects on panel
  • Next by thread: Re: Newlines + quartz text?
  • Index(es):
    • Date
    • Thread