NSTextField with tabs in text displays incorrectly in 10.12.2
|Product:||macOS + SDK
An NSTextField contains text with tabs in order to display a data table. The text has an NSParagraphStyle with its tabStops property set to an array containing a number of right-aligned NSTextTabs. The text field was drawn as intended (with the text aligned to the tab stops) before upgrading to 10.12.2. After upgraded, the text was no longer aligned to the tab stops, and when using monospacedDigitsSystemFont there were cosmetic glitches displayed as well. See the attached screen shots.
Steps to Reproduce:
Build and run the attached test project with Xcode 8 (any version) under macOS 10.12.2. Use the popup button to select the font for the text field (system font; system font with monospaced digits; and user font).
The window should display a data table with the numbers in right-aligned columns, no matter which font is selected.
With the system font selected, the text in the table appears as though the tabs were spaces, without any alignment. If the font is changed to the monospaced digits variation, cosmetic graphic glitches appear where the tab characters are located (see the attached screenshots). Neither of these are desirable.
[Switching to the user font displays the text in aligned columns as intended.]
macOS 10.12.2 (16C67)
This problem did not exist before 10.12.2 (including earlier OS releases; I tested back as far as 10.9.5).
Workarounds (see the attached "Additional Notes" file for more discussion):
1) Don't use the system font (use the user font instead, e.g.)
2) Use an NSTextView instead of an NSTextField
3) Ensure that wantsLayer is set on the window's content view
16 GB RAM
512 GB SSD
macOS 10.12.2 (16C67)
Additional note: When running the application in Xcode, at the point at which the erroneous text field display occurs, the system displays repeated copies of the following message in the console:
CoreText: *** Unmapped "\t" ".SFNSText 11.00 pt. P  (0x10486a490) fobj=0x10486a490, spc=3.17"
The hexadecimal number (address?) can vary. Typically there are ten copies of this message, with the address staying the same for four messages, then changing for the next four, etc. (I have no insight as to why ten messages appear.)
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!