Why Does NSTextField Have Extra Vertical Space When Deployment Target is 10.13 or Earlier?

simple example project I've placed on GitHub demonstrates a strange problem I'm having with a non-editable NSTextField (i.e., static text) when compiling for an SDK earlier than 10.14.

If you compile the main branch has the deployment target set to 10.14, the text displays as one would expect.

But if you switch the branch to 10.13SDK, where the deployment target has been set to 10.13, you'll see that extra space (3 pixels) has been added to the above the text and it is now cut off by the 11 pixel high frame.

What do I need to do to consistently display the text within the 11 pixel high frame, regardless of the deployment target? I've tried every manner of subclassing NSTextField and NSTextFieldCell, referencing solutions like this one as an inspiration. But to no avail.

Thanks in advance for your help.

Replies

There seems to be a solution by subclassing NSTextFieldCell, as you mentioned.

Hope this will provide some hints:

https://stackoverflow.com/questions/11775128/set-text-vertical-center-in-nstextfield

As for reason of issue, could it be due to a change in default system font ?