• 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
Re: What's wrong with this font thing?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: What's wrong with this font thing?


  • Subject: Re: What's wrong with this font thing?
  • From: Randall Meadows <email@hidden>
  • Date: Wed, 29 Oct 2008 17:37:21 -0600

On Oct 29, 2008, at 5:15 PM, Peter Ammon wrote:

Trying to find the right font size to just fit the text seems a bit archaic. Here is a different approach:

- Measure the string with some font
- Divide the space available by the measured width to find the scale factor
- Use CGContextScaleCTM() to apply the scale to the current transform
- Draw the string with that font. It will scale nicely and fit into the available space.

Doing that also shifts the rect that I'm trying to draw into. I'm doing multiple NSString drawInRect:withAttributes: calls, all within a single view.
_______________________________________________


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


  • Follow-Ups:
    • Re: What's wrong with this font thing?
      • From: Aki Inoue <email@hidden>
    • Re: What's wrong with this font thing?
      • From: Graham Cox <email@hidden>
References: 
 >What's wrong with this font thing? (From: Randall Meadows <email@hidden>)
 >Re: What's wrong with this font thing? (From: Peter Ammon <email@hidden>)

  • Prev by Date: Re: What's wrong with this font thing?
  • Next by Date: Re: Problem with NSData to NSString to NSData
  • Previous by thread: Re: What's wrong with this font thing?
  • Next by thread: Re: What's wrong with this font thing?
  • Index(es):
    • Date
    • Thread