How to calculate diagonal size of text?
How to calculate diagonal size of text?
- Subject: How to calculate diagonal size of text?
- From: Keith Blount <email@hidden>
- Date: Sat, 26 Aug 2006 05:41:30 -0700 (PDT)
Hello,
My application has a corkboard view which displays a
number of index cards. Each index card has a title,
text, label and status associated with it. The title
and text are the index card's contents, and the label
is a colour associated with it that is drawn as a
coloured pin.
One of my users has just made the rather excellent
suggestion that the status should be displayed as a
"stamp", that is, transparent red text drawn
diagonally across the index card. I would like to
implement this, but have a couple of questions on how
to go about it.
Presumably, I am going to use NSAffineTransform to
rotate the drawing and then draw my string in the
usual way. That part should be fine. What I am
confused about is how to calculate the size of the
string when it has to be drawn diagonally - this part
is probably just a maths failing on my part. Obviously
I can calculate the diagonal size of my index card,
but it has to take into account the height of the
string, too. What is the best way to do this?
More importantly, the strings drawn can be of varying
lengths, but they should always be shrunk to fit into
the card diagonally. How can I get the diagonal size
for my string and then shrink the string to make sure
that the font is of just the right size so that the
whole string can be drawn?
Many thanks in advance for any ideas.
Best regards,
Keith
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
_______________________________________________
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