AttributedString drawing

  • Hello

    I am trying to draw an NSAttributedString to the screen. I can do that
    just fine, but when I draw it in my rect, I want to line it up on the
    right side of the rectangle.

    What I would like to do is to draw it at: (rect.size.width -
    myAttributedString.length).  The length, however, needs to be the
    number of pixels it will take to render the attributed string on the
    screen.

    I've looked through the docs, and found an NSAttibutedString extension
    called "size" which should return an NSRect, but when I use that it's
    just giving me random huge numbers instead of the size of the string.

    So basically, I need to figure out a way to calculate the length (in
    pixels), of the attributed string.  Does anyone have any suggestions,

    Thank you,
    AA
  • On Oct 11, 2006, at 9:31 AM, Aychamo Aychamo wrote:

    > I am trying to draw an NSAttributedString to the screen. I can do that
    > just fine, but when I draw it in my rect, I want to line it up on the
    > right side of the rectangle.

    The easiest way to do this is by adding a paragraph style attribute
    that is right aligned.

    Douglas Davidson
previous month october 2006 next month
MTWTFSS
            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31          
Go to today