Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Calculating the size of NSFont...




On Mar 4, 2007, at 12:52 AM, Rachel Blackman wrote:

Alright, one more query, as long as I'm diving back into the cocoadev folder... :)

I've got a monospaced font. I need to calculate the 'width' of a given character, so that I can figure out certain things.

Not knowing what "certain things" need figuring out, I wonder if instead you might be able to exploit NSStrings sizeWithAttributes: method. sizeWithAttributes "returns the bounding box size the receiver occupies when drawn with the given attributes."


You can pass it a dictionary to specify the font and figure out the size a string will be drawn.

_murat
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >Calculating the size of NSFont... (From: Rachel Blackman <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.