• 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
Line height of drawWithRect:options: seems a bit messed up
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Line height of drawWithRect:options: seems a bit messed up


  • Subject: Line height of drawWithRect:options: seems a bit messed up
  • From: Yung-Luen Lan <email@hidden>
  • Date: Thu, 2 Apr 2009 07:31:33 +0800

Hi,

I have some code that draws attributed string to a given location
using given fonts/sizes/styles with [NSAttributedString
drawWithRect:options:].

However, I found that the string were not aways aligned to top on some
fonts when I supply NSStringDrawingUsesLineFragmentOrigin option,
which should use the rect origin as the top left corner of line
fragments.

http://www.flickr.com/photos/yllan/3405764516/
Here is the figure that explains what I encountered: I don't want the
extra red space in this picture.

What option/attribute should I supply to make my string align to the
top edge of bounding box just like how TextEdit does?
The string may contains different fonts/sizes.

I'm also curious about why some fonts have these extra space, but some
fonts don't. Is this because the metric/feature of fonts or the bug of
NSStringDrawing method that calculate the wrong line height?

Any suggestions are welcome.

Regards,
yllan
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden

  • Prev by Date: Double Clicks in an NSTextView.
  • Next by Date: Re: Double Clicks in an NSTextView.
  • Previous by thread: Re: Double Clicks in an NSTextView.
  • Next by thread: Re: How to detect curly quotes
  • Index(es):
    • Date
    • Thread