Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Text height for printing (fixed width)



I have a NSString s, a NSFont f, a width w (float) and I want the height of
s in f font in a rect of width w. It could (very often) have more than one
line (because of "true" line breaks or lines too long).

I've tried 2 methods :
    - one from Apple Text NSLayout Programming Guide
    - one from a Matt Neuburg post in MacOSX-dev mailing-list
They both seems to give wrong results : more there are lines, too smaller is
the height returned.

I've written a small app for this problem : there is a NSTextView and a
custom view which simulates printing. You can try the two methods above.

    http://www.maestric.com/shared/cocoa/NSTextViewPrinting.zip

Am I wrong somewhere ?
Thanks.
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.