• 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
drawing text
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

drawing text


  • Subject: drawing text
  • From: Chris Meyer <email@hidden>
  • Date: Fri, 30 Jan 2004 00:32:22 -0800

I'm trying to draw text using NSAttributedString's method drawInRect. I want to draw within a box so that justification works properly. I also need to draw without using a NSTextView (I'm drawing into a custom view).

I get the size of the text using [text size] and then drawInRect to a rectangle with that size. Unfortunately, if the font is italic and large enough (36pt, for instance) it will cut off the right side of the text.

I've tried to use the text system (NSLayoutManager, NSTextContainer, NSTextStorage) but with no success due to the weird requirement of having a flipped coordinate system, among numerous other complications...

So I have two questions:

1) Is there any way of reliable, efficient way determining the bounding size for an attributed string?

2) How does drawInRect manage to draw in non-flipped coordinate systems?

P.S. The answer to #1 is not 'add a space to the end of the string' or something like that. The text can be multi-line text with various font sizes in various directions. Where would the space be added? Also, boundingRectForGlyphRange doesn't work either; it has the same problem as [text size].
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
  • Prev by Date: UndoManager Notifications
  • Next by Date: Playing sound effect in thread
  • Previous by thread: UndoManager Notifications
  • Next by thread: Playing sound effect in thread
  • Index(es):
    • Date
    • Thread