• 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: Tue, 20 Aug 2013 14:38:14 +0800

On 20 Aug, 2013, at 1:50 PM, Graham Cox <email@hidden> wrote:
> On 20/08/2013, at 6:08 AM, Peter C <email@hidden> wrote:
>
>> A user complain my App paragraph text lines space is too much, this is because it is done by using NSString drawInRect:withAttributes:, not much of any adjustment.
>
> That's not the case. The -attributes: parameter is a dictionary of any attributes, including NSParagraphStyle, and that can have whatever line spacing you want. You can drop down to Core Text, but it's not necessary just to allow adjustment of line spacing.
>
> --Graham

Yes, it is possible to pass values with NSParagraphStyleAttributeName for NSString drawInRect:withAttributes. However by default line spacing or gap between lines is different compare to CoreText functions (CTFramesetter and etc). The gap is taller for NSString, perhaps the calculation is based on round up values rather than fraction values of the font height.

I believe the user would be probably happy with CoreText compare to NSString by default values. Print people, they are sensitive to typography measurements. According to the user, it's a common feature for apps like MS Word (line spacing) or Adobe Indesign (font leading). Putting some controls for line spacing and kern width will make them happy.

I intend do something like line spacing field, by getting values from NSTextField with NSStepper.

For example, Helvetica font size of 12.0,

*** - Text lines contracting
-15 minimumLineHeight = 0 maximumLineHeight = 1
-14 minimumLineHeight = 0 maximumLineHeight = 1, reach to maximum stays at 1
...
-5 minimumLineHeight = 0 maximumLineHeight = 10
-4 minimumLineHeight = 0 maximumLineHeight = 11
-3 minimumLineHeight = 0 maximumLineHeight = 12
-2 minimumLineHeight = 0 maximumLineHeight = 13
-1 minimumLineHeight = 0 maximumLineHeight = 14
0  default values, minimumLineHeight = 0 maximumLineHeight = 0
1  minimumLineHeight = 1 maximumLineHeight = 0
2  minimumLineHeight = 2 maximumLineHeight = 0
3  minimumLineHeight = 3 maximumLineHeight = 0
4  minimumLineHeight = 4 maximumLineHeight = 0
5  minimumLineHeight = 5 maximumLineHeight = 0
N  minimumLineHeight = N maximumLineHeight = 0
*** + Text lines expanding

The question is how to get maximum value of maximumLineHeight of a particular font ?

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


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

  • Prev by Date: Re: CoreText & NSMutableParagraphStyle maximumLineHeight
  • Next by Date: Re: IB autolayout is impossible
  • Previous by thread: Re: CoreText & NSMutableParagraphStyle maximumLineHeight
  • Next by thread: Re: CoreText & NSMutableParagraphStyle maximumLineHeight
  • Index(es):
    • Date
    • Thread