• 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: CoreText & NSMutableParagraphStyle maximumLineHeight
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CoreText & NSMutableParagraphStyle maximumLineHeight


  • Subject: Re: CoreText & NSMutableParagraphStyle maximumLineHeight
  • From: Peter C <email@hidden>
  • Date: Wed, 21 Aug 2013 10:00:32 +0800

Just tested NSParagraphStyle lineHeightMultiple,  the line space expands only.  It is similar to NSParagraphStyle lineSpacing, no negative value possible.

Below is the method what I intended to do,

// lspace - 0.0 neutral , negative value the line height contracts and positive value line height expands
- (NSMutableParagraphStyle *)adjustLineSpacing:(CGFloat)lspace
{
    NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
    NSLayoutManager *lm;
    NSFont *fontObj;
    CGFloat defLineHeight;
    CGFloat calc;

    if (lspace > 0.0)
        paragraphStyle.lineSpacing = lspace;
    else if (lspace < 0.0) {
            fontObj = [NSFont fontWithName:_fontNameStr size:_fontSize];
            lm = [[NSLayoutManager alloc] init];
            defLineHeight = [lm defaultLineHeightForFont:fontObj];
            [lm release];
            calc = (lspace + 1.0) + defLineHeight;
            if (calc < 1.0)
                calc = 1.0;
            paragraphStyle.maximumLineHeight = calc;
    }
    return [paragraphStyle autorelease];
}

-- Peter Chan

_______________________________________________

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


References: 
 >CoreText & NSMutableParagraphStyle maximumLineHeight (From: Peter C <email@hidden>)
 >Re: CoreText & NSMutableParagraphStyle maximumLineHeight (From: Graham Cox <email@hidden>)
 >Re: CoreText & NSMutableParagraphStyle maximumLineHeight (From: Peter C <email@hidden>)
 >Re: CoreText & NSMutableParagraphStyle maximumLineHeight (From: Graham Cox <email@hidden>)
 >Re: CoreText & NSMutableParagraphStyle maximumLineHeight (From: Peter C <email@hidden>)

  • Prev by Date: Re: handleGetURLEvent getting called after applicationDidFinishLaunching
  • Next by Date: Nav stack creating a bunch of UIImageViews on top of my view
  • Previous by thread: Re: CoreText & NSMutableParagraphStyle maximumLineHeight
  • Next by thread: Re: CoreText & NSMutableParagraphStyle maximumLineHeight
  • Index(es):
    • Date
    • Thread