Thanks Fritz,

After trying out various values, this worked for me:

    CGSize frameSize = 
CTFramesetterSuggestFrameSizeWithConstraints(framesetter, 
                                                                                
        CFRangeMake(0, 0), 
                                                                                
        NULL, 
                                                                                
        CGSizeMake(self.bounds.size.width, CGFLOAT_MAX), 
                                                                                
        &fitRange);

    CGFloat lineHeight = CTFontGetSize( ctFont ) * 2.0;
    frameSize.height += lineHeight;


I'm using CGFLOAT_MAX, since the text can be longer than the bounds of the view.


- Koen.



On May 17, 2013, at 10:37 AM, Fritz Anderson <fri...@manoverboard.org> wrote:

> Also, I had another app that didn't need the kludge. I don't have time to 
> experiment, but I think the operative line was:
> 
>    // boundingRect.size was {columwidth, CGFLOAT_MAX}
>    suggestion = CTFramesetterSuggestFrameSizeWithConstraints(setter,
>                                                              CFRangeMake(0, 
> 0),
>                                                              NULL,
>                                                              
> boundingRect.size,
>                                                              &actualRange);
> 
> Note the range of {0,0}, which allows the framesetter to run until it runs 
> out of space or string. That app worked properly.
> 
>       — F
> 
> 
> -- 
> Fritz Anderson
> Xcode 4 Unleashed: 4.5 supplement for free!
> http://www.informit.com/store/xcode-4-unleashed-9780672333279
> 


_______________________________________________

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

Reply via email to