The docs on boundingRectWithSize:options:context: say: "Typically, the renderer preserves the width constraint and adjusts the height constraint as needed."
Yes, that's what I was hoping for. But in fact I'm getting a much narrower width than what I supplied. I suspect that the problem here has to do with differing expectations as to what "bounding rect" means, and as to what my paragraph margins mean. Here's some more complete code: NSString* sentence = @"This is a test. "; NSString* s = @""; for (int i = 0; i < 20; i++) s = [s stringByAppendingString:sentence]; NSMutableParagraphStyle* mps = [NSMutableParagraphStyle new]; mps.headIndent = 20; mps.firstLineHeadIndent = 20; mps.tailIndent = -20; NSAttributedString* as = [[NSAttributedString alloc] initWithString:s attributes:@{ NSParagraphStyleAttributeName:mps }]; CGRect r = [as boundingRectWithSize:CGSizeMake(100,10000) options:NSStringDrawingUsesLineFragmentOrigin context:nil]; NSLog(@"%@", NSStringFromCGRect(r)); The resulting width is 51.8. So it looks as if that's the width *after* the margins (20 and 20) have squeezed the text inward. What we're getting, it seems, is the minimum bounding rect containing any text. But that's not what I want to know; I want to know the height of this text as drawn within the width I supplied (100) using the paragraph margins I supplied. Is there some other way to find that out? Or is this a bug with regard to how margins are interpreted? m. -- matt neuburg, phd = m...@tidbits.com, http://www.apeth.net/matt/ pantes anthropoi tou eidenai oregontai phusei Programming iOS 5! http://shop.oreilly.com/product/0636920023562.do RubyFrontier! http://www.apeth.com/RubyFrontierDocs/default.html TidBITS, Mac news and reviews since 1990, http://www.tidbits.com _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com