Community
Participate
Working Groups
Apparently, when the text is short, and `transparent` is set to true, GC.drawText(..) reuses the last used font for the same text. Reproduced on Mac with Mojave and Big Sur. An attached snippet draws "3" using a small font and then "3" and "6" using a bigger font. When transparent flag is true, both "3" looks identical if run against 2020-12 M2 SWT. If one makes all digits different or sets transparent flag to false (right column), everything is fine again. Attached is the snippet and a screenshot.
Created attachment 284753 [details] Snippet to show the problem
Created attachment 284754 [details] Screenshot of the problem The left column draws two identical "3"s, which is wrong
The legacy draw2d uses transparent=true for all drawText's in SWTGraphics, so with the described problem, all single-digit labels on my diagrams look the same.
This is a showstopper for us, it's blocking us from releasing a Big Sur compatible build of our product, unfortunately. As Michael mentions it's not limited to Big Sur though, I've tested on Catalina & High Sierra which are also affected, so probably occurs on all supported macOS builds.
This behaviour is introduced by Bug 366471. Specifically https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/92329 @Lakshmi Can we revert this?
New Gerrit change created: https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/172205
(In reply to Eclipse Genie from comment #6) > New Gerrit change created: > https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/172205 This is a revert of https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/92329 The problem here is the end user is trying to draw a single and same character twice but changing font in between. The cache mechanism implemented in the above commit does not take into account of changing font. So same font is being used to draw second call as well. This will happen every time we use same letter.
New Gerrit change created: https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/172207
(In reply to Eclipse Genie from comment #8) > New Gerrit change created: > https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/172207 This patch resets textCache. @Lakshmi Can you please let me know which is better. My preference would be https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/172207 Both these patches work. The differentiating factor would be performance.
(In reply to Sravan Kumar Lakkimsetti from comment #9) > (In reply to Eclipse Genie from comment #8) > > New Gerrit change created: > > https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/172207 > > This patch resets textCache. > > @Lakshmi Can you please let me know which is better. My preference would be > https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/172207 > > Both these patches work. The differentiating factor would be performance. @Sravan, I agree, it's better to reset the cache. Can you please check if there are other cases where a cache reset is required such setForeground() and setForegroundPattern()?
(In reply to Lakshmi P Shanmugam from comment #10) > (In reply to Sravan Kumar Lakkimsetti from comment #9) > > (In reply to Eclipse Genie from comment #8) > > > New Gerrit change created: > > > https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/172207 > > > > This patch resets textCache. > > > > @Lakshmi Can you please let me know which is better. My preference would be > > https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/172207 > > > > Both these patches work. The differentiating factor would be performance. > > @Sravan, I agree, it's better to reset the cache. Can you please check if > there are other cases where a cache reset is required such setForeground() > and setForegroundPattern()? The cache works only on the text. Basically we need to see what are the parameters affect the object created by GC.createString(). Apart from Font I can see foregroundpattern. So we need to do cache reset for setForegroundPattern as well.
(In reply to Sravan Kumar Lakkimsetti from comment #11) > (In reply to Lakshmi P Shanmugam from comment #10) > > (In reply to Sravan Kumar Lakkimsetti from comment #9) > > > (In reply to Eclipse Genie from comment #8) > > > > New Gerrit change created: > > > > https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/172207 > > > > > > This patch resets textCache. > > > > > > @Lakshmi Can you please let me know which is better. My preference would be > > > https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/172207 > > > > > > Both these patches work. The differentiating factor would be performance. > > > > @Sravan, I agree, it's better to reset the cache. Can you please check if > > there are other cases where a cache reset is required such setForeground() > > and setForegroundPattern()? > > The cache works only on the text. Basically we need to see what are the > parameters affect the object created by GC.createString(). > > Apart from Font I can see foregroundpattern. So we need to do cache reset > for setForegroundPattern as well. Updated the patch now. Can you please review?
Gerrit change https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/172207 was merged to [master]. Commit: http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=1213267627fe969886411f3d53b47c363ad2d77d
Merged to master
Verified in Eclipse SDK Version: 2020-12 (4.18) Build id: I20201116-1800 OS: Mac OS X, v.10.16, x86_64 / cocoa Java version: 15.0.1
New Gerrit change created: https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/173195
(In reply to Eclipse Genie from comment #16) > New Gerrit change created: > https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/173195 Reverting as this fix caused a regression bug 569367
During the test I noticed the whitespace character turning to bold briefly. This is resulting in cache reset causing regression We will take a look again in 4.19
there are no plans currently. Removing the target
This bug is affecting the TM Terminal - see Bug 574271 and the screenshot https://bugzillaattachments.eclipsecontent.org/bugs/attachment.cgi?id=286612 which shows how some characters are drawn in the wrong color.