When using line spacing and kerning on an NSAttributedString and UILabel with one line, extra space is added to the bottom of the label

Originator:dylanslewis
Number:rdar://31401189 Date Originated:4/3/2017
Status:Open Resolved:
Product:iOS Product Version:10.3
Classification: Reproducible:Always
 
Example gist: https://gist.github.com/dylanslewis/a6da1117cfc23bf99047ecfd48d52cc3

If a label is created with an attributed string that has two attributes (kerning and a paragraph style with line spacing) and the text for that label has one line, there is extra space added to the bottom of the label. This issue does not occur when the label has two lines, or when the kerning attribute is removed from the attributed string.

Steps to reproduce:
1. Open the playground in the attached file (see top of description for GitHub gist link)
2. Open the counterparts view to see the label

Expected behaviour:
The label's frame's height extends to the bottom of the descenders of the text.

Actual behaviour:
The label's frame's height extends beyond the descenders of the text (roughly 10px)

iPhone SE, iPhone 7 Plus, iMac (Retina 5K, 27-inch, Late 2015)

10.3, macOS Sierra

The space that is added to the label is not influenced by changing the values of either the kerning or line spacing, or by changing the font used.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!