Re: How do you get the font used in a menu item?
Re: How do you get the font used in a menu item?
- Subject: Re: How do you get the font used in a menu item?
- From: Graham Cox <email@hidden>
- Date: Wed, 22 Apr 2009 13:19:21 +1000
On 22/04/2009, at 1:10 PM, Jerry Krinock wrote:
I need to calculate how wide it will be when drawn with whatever
font it is going to be drawn with.
***
But anyhow, I followed your advice. Since I need to setTitle: on my
menu items anyhow, I created an attributed string and
setAttributedTitle: instead. So, obviously now I know what the font
is.
Wouldn't it be simpler to just measure the string itself? i.e.
[NSAttributedString size]; ? Anytime you are having to delve into the
font to do that sort of things usually indicates you're missing a
trick ;-)
Problem solved. Odd that there is no getter for fonts in menus.
Hmmm, well I suppose it's in the spirit of not relying on arbitrary
appearances of user interface elements to drive your code. I'd call
that good (or at least reasonable) practice.
--Graham
_______________________________________________
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