• 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: Font Size Problem in NSTableView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Font Size Problem in NSTableView


  • Subject: Re: Font Size Problem in NSTableView
  • From: "Michael J. Bergin" <email@hidden>
  • Date: Wed, 3 May 2006 22:31:28 -0400

Have you looked at http://www.cocoadev.com/index.pl?NSTextViewSizeToFit

-
  Michael J. Bergin
  email@hidden
  Odology, inc.
  www.odology.com

  Launch any app, anywhere, in under a second
  Launcher by Odology
  www.odology.com/launcher


On May 2, 2006, at 6:09 PM, David Emme wrote:

--- On 5/2/06 5:02 PM (-0400), Michael J. Bergin wrote:

How are you retrieving the ascender, descender and leading values?

// Compute and return the table row height needed for aStr. - (NSNumber *)rowHeightForString:(NSAttributedString *)attrStr { NSRange limitRange; NSRange effectiveRange; NSFont * fontAttr; float answer = 0.0;

    limitRange = NSMakeRange(0, [attrStr length]);
    while (limitRange.length > 0) {
        fontAttr = [attrStr attribute:NSFontAttributeName
                              atIndex:limitRange.location
                longestEffectiveRange:&effectiveRange
                                    inRange:limitRange];
        float thisHeight = [self computeRowHeightForFont:fontAttr];
        answer = (thisHeight > answer ? thisHeight : answer);
        limitRange = NSMakeRange(NSMaxRange(effectiveRange),
                                 NSMaxRange(limitRange) -
                                 NSMaxRange(effectiveRange));
    }
    return [NSNumber numberWithFloat:answer];
}

// Compute max. row height for given font.
- (float)computeRowHeightForFont:(NSFont *)fontAttr
{
    float answer = [fontAttr ascender] - [fontAttr descender] +
                   [fontAttr leading];
    answer = answer + 1.0;      // add white space as needed
    return answer;
}

-Dave
-- Back up my hard drive? How do I put it in reverse?
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40odology.com


This email sent to email@hidden

_______________________________________________ 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
References: 
 >Re: Font Size Problem in NSTableView (From: David Emme <email@hidden>)

  • Prev by Date: CoreData XML / SqLite differences
  • Next by Date: Re: CoreData XML / SqLite differences
  • Previous by thread: Re: Font Size Problem in NSTableView
  • Next by thread: Re: Font Size Problem in NSTableView
  • Index(es):
    • Date
    • Thread