Skip to content

[Win32] Remove obsolete fallback for drawing text without GDI+#3100

Draft
HeikoKlare wants to merge 1 commit intoeclipse-platform:masterfrom
vi-eclipse:issue-3091
Draft

[Win32] Remove obsolete fallback for drawing text without GDI+#3100
HeikoKlare wants to merge 1 commit intoeclipse-platform:masterfrom
vi-eclipse:issue-3091

Conversation

@HeikoKlare
Copy link
Contributor

@HeikoKlare HeikoKlare commented Feb 25, 2026

❗This is an experimental PR to test if the current "fallback" logic is actually obsolete.

A check in GC.drawText() make the implementation fall back to the text rendering based on glyphs and their positions calculated by GDI even when GDI+ is used in all cases except when it contains specific characters that GDI cannot handle. This was necessary more than a decade ago because specific Chinese characters were not properly rendered by GDI+. But this is quite non-intuitive as in case GDI+/advance mode is enabled the consumer will usually expected GDI+ to be used for rendering. In addition, the problematic scenario from back then works fine now.

This change thus adapts the GC.drawText() implementation to use plain GDI+ whenever it is enabled and removes all existing fallback code. It also adds a case for not drawing line delimiters when an according style flag is set, which was not considered by the GDI+ implementation yet.

May fix #3091

@github-actions
Copy link
Contributor

github-actions bot commented Feb 25, 2026

Test Results (win32)

   34 files  ±0     34 suites  ±0   4m 53s ⏱️ -56s
4 650 tests ±0  4 577 ✅ ±0  73 💤 ±0  0 ❌ ±0 
  174 runs  ±0    171 ✅ ±0   3 💤 ±0  0 ❌ ±0 

Results for commit 6ff4768. ± Comparison against base commit 2d4d435.

♻️ This comment has been updated with latest results.

@HeikoKlare
Copy link
Contributor Author

Interestingly, this change would also have an impact on some issues reported to GEF (@ptziegler fyi).

It seems like the following fix would be come obsolete as I see the behavior also fixed with this PR:

Without this change on 150% monitor:
image

With this change on 150% monitor:
image

For the underlying issue and the snippet posted there, I rather see a change that I would consider a regression caused by this PR:

This is how it looks without this change on 100%:
image

And this is how it looks with this change on 100%:
image

But comparing the position of the text on 100% monitor with its position on 150% monitor, the behavior after this change seems to be even more "correct".

Anyway, it seems like the Win32 GC.drawText() implementation has some severe flaws when using advanced mode / GDI+. I am just a bit afraid that simply removing all the code for falling back to GDI and completely relying on GDI+ for all text rendering when advanced mode is enabled may have unintended side effects. But checking some of the bugs for which this implementation has been made (such as https://bugs.eclipse.org/bugs/show_bug.cgi?id=289244 and https://bugs.eclipse.org/bugs/show_bug.cgi?id=305815) and running the snippets used back then without any issues after this change, hopefully GDI+ was improved so much throughout the years that all these workarounds are not necessary anymore.

A check in GC.drawText() make the implementation fall back to the text
rendering based on glyphs and their positions calculated by GDI even
when GDI+ is used in all cases except when it contains specific
characters that GDI cannot handle. This was necessary more than a decade
ago because specific Chinese characters were not properly rendered by
GDI+. But this is quite non-intuitive as in case GDI+/advance mode is
enabled the consumer will usually expected GDI+ to be used for
rendering. In addition, the problematic scenario from back then works
fine now.

This change thus adapts the GC.drawText() implementation to use plain
GDI+ whenever it is enabled and removes all existing fallback code. It
also adds a case for not drawing line delimiters when an according style
flag is set, which was not considered by the GDI+ implementation yet.

May fix eclipse-platform#3091
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Windows] Text is not displayed if the font has Underline or Strikeout and GC.setAdvanced(true)

1 participant