NSTextField baseline inconsistency

Number:rdar://36672952 Date Originated:19-Jan-2018 05:15 PM
Status:Open Resolved:
Product:macOS + SDK Product Version:macOS 10.12.6 (16G1114) / Xcode Version 9.2 (9C40b)
Classification:UI/Usability Reproducible:Always
Dear AppKitterinos,

NSTextField’s baseline is inconsistent/wrong for some border/bezel styles.

Let’s consider the no-border, no-bezel (“bare”) style as the reference. This is sensible because the first baseline offset in this style does in fact line up with the visual baseline of the text.

A bordered text field puts its first baseline at the reference baseline. Yay!

A square-bezeled text field puts its first baseline one point above the reference baseline. Boo!

A round-bezeled text field puts its first baseline one point above the reference baseline. Boo!

I have attached a project to demonstrate the problem. At the bottom of the window, you’ll find one text field for each border/bezel style. These text fields are constrained to have the same first baseline. There is also an orange one-point-tall NSBox whose top is constrained to the first baseline of the bare text field. This orange line makes it easy to see that in the square-bezeled and round-bezeled text fields, the apparent visual baseline of the text is offset from the baselines of the bare and bordered text fields.

Please make text field baselines line up.


Steps to Reproduce:
1. See attached project.

Expected Results:
Baseline alignment accurate enough to satisfy even the most anal-retentive designer.

Actual Results:
A plague of misaligned baselines.

macOS 10.12.6 (16G1114) / Xcode Version 9.2 (9C40b)



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!