Skip navigation.
 
mlRe: Scaling Fonts;
FROM : Douglas Davidson
DATE : Fri Apr 01 19:54:59 2005

On Apr 1, 2005, at 9:43 AM, Matt Budd (Madentec) wrote:

> Hello,
>
> Is there a way to determine the largest font size for a given font 
> that will fit in a rect?
>
> I know that NSAttributedString has a - (NSSize)size method, and I 
> could iteratively increase the font size until I hit one that was 
> too large and then use the last size, but is there a better/quicker 
> way?


This is basically a root-finding algorithm.  The function in question 
should be pretty close to linear, however, so you should be able to 
find it pretty quickly.

Douglas Davidson

Related mailsAuthorDate
mlScaling Fonts; Matt Budd (Madente… Apr 1, 19:43
mlRe: Scaling Fonts; Douglas Davidson Apr 1, 19:54