Possible Duplicate:
UITextView : get text with wrap info
I have been scouting the NSString library and numerous libraries for a function that can take a long string like this :
Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui.
and together with a CGSize or float indicating the width, and the font being used, and return me a string with \n breaks and the words wrapped.
Result (roughly) :
Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac\n
egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet.\n
Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. \n
placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra.\n
Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi.\n
Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci,\n
sagittis tempus lacus enim ac dui.
I already know that UITextViews and such do this, but this is not helpful since I need to render the text in a raw OpenGL landscape, so I am using no regular UI elements.
I know this either exists as a framework, or a public class somewhere. I just simply can't find any unified way of handling this.
I imagine it is close to [NSString sizeWithFont:forWidth:lineBreakMode:], but i do not need the size, I need the string itself.