Re: NSAttributedString boundingRectWithSize vs. paragraph margins

2013-01-25 Thread Kyle Sluder
I just made a demo project to explore what the heck values NSStringDrawing is returning: https://github.com/kylesluder/NSStringDrawer The line fragment results seem sensible to me, and both the glyph origin and line fragment results make sense when using device metrics, but asking for the baselin

Re: NSAttributedString boundingRectWithSize vs. paragraph margins

2013-01-24 Thread Kyle Sluder
On Thu, Jan 24, 2013, at 11:52 AM, Kyle Sluder wrote: > > I expect this method to tell me the size of a rectangle (e.g. a bitmap > > context) such that if I draw my attributed string into that rectangle, it > > will all fit. When I say "all" I mean "all", including the margins. > > Considering the

Re: NSAttributedString boundingRectWithSize vs. paragraph margins

2013-01-24 Thread Kyle Sluder
On Thu, Jan 24, 2013, at 06:14 AM, Matt Neuburg wrote: > > On Jan 23, 2013, at 11:01 PM, Kyle Sluder wrote: > > >> It may be that the height is right despite the narrowed width, but since > >> the narrowed width is unexpected, it would be nice to be assured of this. > >> m. > > > > Why is th

Re: NSAttributedString boundingRectWithSize vs. paragraph margins

2013-01-24 Thread Matt Neuburg
UILabel sizeToFit shows the same problem. If I start with a tall UILabel and set its attributedText to my string, and then tell the label to sizeToFit, the label gets narrower and the text no longer fits. This is because the sizeToFit algorithm is ignoring the margins (in fact it is probably usi

Re: NSAttributedString boundingRectWithSize vs. paragraph margins

2013-01-24 Thread Matt Neuburg
On Jan 23, 2013, at 11:01 PM, Kyle Sluder wrote: >> It may be that the height is right despite the narrowed width, but since the >> narrowed width is unexpected, it would be nice to be assured of this. m. > > Why is the narrowed width unexpected? You told the text system to use 20pt > margin

Re: NSAttributedString boundingRectWithSize vs. paragraph margins

2013-01-23 Thread Kyle Sluder
On Jan 23, 2013, at 8:17 PM, Matt Neuburg wrote: > It may be that the height is right despite the narrowed width, but since the > narrowed width is unexpected, it would be nice to be assured of this. m. Why is the narrowed width unexpected? You told the text system to use 20pt margins on each

Re: NSAttributedString boundingRectWithSize vs. paragraph margins

2013-01-23 Thread Matt Neuburg
I should have been explicit that this is iOS. Sorry. It may be that the height is right despite the narrowed width, but since the narrowed width is unexpected, it would be nice to be assured of this. m. - Sent from my iPad, but I am not a dork. Really. On Jan 23, 2013, at 7:18 PM, Keary S

Re: NSAttributedString boundingRectWithSize vs. paragraph margins

2013-01-23 Thread Keary Suska
On Jan 23, 2013, at 7:29 PM, Matt Neuburg wrote: > 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

NSAttributedString boundingRectWithSize vs. paragraph margins

2013-01-23 Thread Matt Neuburg
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