Bug 572805

Summary: [Cocoa] GC.drawString(), GC.drawText() and FontMetrics ignore leading
Product: [Eclipse Project] Platform Reporter: Stefan Mücke <s.muecke>
Component: SWTAssignee: Platform-SWT-Inbox <platform-swt-inbox>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P3 CC: ts-swt
Version: 4.19   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS X   
Whiteboard:
Attachments:
Description Flags
Snippet to reproduce
none
Screenshot on macOS and Windows 7 none

Description Stefan Mücke CLA 2021-04-13 09:24:12 EDT
Created attachment 286092 [details]
Snippet to reproduce

On macOS, FontMetrics.getLeading() always returns zero. GC.drawString() and GC.drawText() don't seem to take leading into account. Tested with Eclipse 4.19 and the very old 4.8.

I first noticed this problem with the "SBL Hebrew" font that has a large leading value (font is available here: https://www.sbl-site.org/Fonts/SBL_Hbrw.ttf).

To reproduce, run the attached snippet. For comparison with Windows, see attached sceenshot.

This is a serious problem because text is drawn outside the computed bounds. When clipping is used (e.g. in Draw2D), text will be partially cut off. I would be very grateful if this could be fixed for 4.20 M2.
Comment 1 Stefan Mücke CLA 2021-04-13 09:28:21 EDT
Created attachment 286093 [details]
Screenshot on macOS  and Windows 7

This problem doesn't seem to depend on the macOS version and is at least present on 10.13 (High Sierra) and 11.0 (Big Sur).