• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Text height for printing (fixed width)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Text height for printing (fixed width)


  • Subject: Text height for printing (fixed width)
  • From: Jérôme Jaglale <email@hidden>
  • Date: Tue, 3 Jan 2006 11:13:07 +0400

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:

This email sent to email@hidden

  • Prev by Date: Re: Authenticating without UI
  • Next by Date: Re: MVC Alternatives?
  • Previous by thread: Re: Authenticating without UI
  • Next by thread: Re: Text height for printing (fixed width)
  • Index(es):
    • Date
    • Thread