Re: Attributed strings - and bounding rects

2017-03-04 Thread Steve Mills
> On Mar 4, 2017, at 04:20, Peter Hudson wrote: > > Many thanks for this detailed help Jonathan. > I’ll work my way through it ! Don't forget to cache the row heights and reset when the table says to. That makes a huge difference as the number of cells grows. Steve via

Re: Attributed strings - and bounding rects

2017-03-04 Thread Peter Hudson
Many thanks for this detailed help Jonathan. I’ll work my way through it ! Peter > On 4 Mar 2017, at 09:54, Jonathan Mitchell wrote: > >> I’m still not out of the wood yet though. > > > Sorry. I should have provided more details. > > What I do to support table cell

Re: Attributed strings - and bounding rects

2017-03-04 Thread Jonathan Mitchell
> I’m still not out of the wood yet though. Sorry. I should have provided more details. What I do to support table cell view wrapping is this. However, I have to support back to 10.9 so it may be possible to use some of the newer auto NSTextField line wrapping stuff. 1. Create a nib

Re: Attributed strings - and bounding rects

2017-03-03 Thread Alex Zavatone
Isn't this where we set the mask so that the image is not bound by the rect? On Mar 3, 2017, at 7:18 AM, Peter Hudson wrote: > Hi All > > I have done the following to try to determine the rect required to draw an > attributed string( and thus the height of a row in a table view - on MacOS )

Attributed strings - and bounding rects

2017-03-03 Thread Peter Hudson
. Any thoughts ? Peter > -- > > Message: 2 > Date: Fri, 03 Mar 2017 14:23:40 + > From: Jonathan Mitchell <li...@mugginsoft.com> > To: "Cocoa-dev@lists.apple.com" <cocoa-dev@lists.apple.com> > Subject: Re: Attributed

Re: Attributed strings - and bounding rects

2017-03-03 Thread Peter Hudson
Thanks for that piece of code - it works a treat and produces a sensible height ! The only problem is that my attributed string does not draw correctly . The string has a number of new lines ( \n ) in it and would need to be wrapped into the space. It all works perfectly in objective-C ! But,

Re: Attributed strings - and bounding rects

2017-03-03 Thread Jonathan Mitchell
Hi I needed to do this for my pdf builder implementation: Using the NSLayoutManager directly gives the best level of control. https://github.com/ThesaurusSoftware/PDFPageBuilder/blob/master/PDFPageBuilder/TSPageTextItem.m#L95 NSRect boundingRect = self.containerRect; // if no

Re: Attributed strings - and bounding rects

2017-03-03 Thread Igor Ranieri
Hi Peter. Have you tried also passing `usesLineFragmentOrigin` as one of the options? It works here. Here’s some code I’m currently using to achieve a similar effect: let sizeLimit = CGSize(width: 80.0, height: CGFloat.greatestFiniteMagnitude) let size = attrString.boundingRect(with:

Attributed strings - and bounding rects

2017-03-03 Thread Peter Hudson
Hi All I have done the following to try to determine the rect required to draw an attributed string( and thus the height of a row in a table view - on MacOS ) I am trying to constrain my column width to 60 - and let the possible height of the row be a max of 1000. let aString =