Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - (NSSize)sizeWithSize:(NSSize)size {
- if([self length] < 1) return NSZeroSize;
- NSTextContainer *textContainer = [[[NSTextContainer alloc] initWithContainerSize:size] autorelease];
- NSTextStorage *textStorage = [[[NSTextStorage alloc] initWithAttributedString:self] autorelease];
- NSLayoutManager *layoutManager = [[[NSLayoutManager alloc] init] autorelease];
- [layoutManager addTextContainer:textContainer];
- [textStorage addLayoutManager:layoutManager];
- [layoutManager setHyphenationFactor:0.0];
- // NSLayoutManager is lazy so for it to layout
- (void) [layoutManager glyphRangeForTextContainer:textContainer];
- return [layoutManager usedRectForTextContainer:textContainer].size;
- }
Add Comment
Please, Sign In to add comment