[Win32] Remove obsolete fallback for drawing text without GDI+#3100
[Win32] Remove obsolete fallback for drawing text without GDI+#3100HeikoKlare wants to merge 1 commit into
Conversation
|
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: With this change on 150% monitor: 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%: And this is how it looks with this change on 100%: 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 |
4ccca1a to
6ff4768
Compare
20e6c08 to
fbd9f98
Compare
5835e66 to
7269ed0
Compare
A check in GC.drawText() makes 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. The fallback code is preserved but only executed if a newly introduced system property is enabled. This allows to switch back to previous behavior in case unexpected regressions are found. The property is to be removed in a future release in case no regressions are found. While adding regression tests for this change it was found that the GDI+ based drawText() path computed the DRAW_TAB tab stop width from the width of a single space glyph as measured by GDI+, while the legacy GDI-based path and plain (non-advanced) GDI both use the GDI text metric's average character width. These two metrics can differ substantially, which made tab stops shrink visibly (roughly by half) compared to plain GDI and the legacy fallback whenever GDI+ rendering was used. The GDI+ path is changed to reuse the same GDI text metric already computed by its caller, so tab stops are now sized consistently across all three rendering paths (plain GDI, default GDI+, and legacy GDI+ fallback). Extend GCWin32Tests with additional regression tests covering not only the previously fixed underline/strikeout invisibility issue, but also style-decoration combinations, mnemonic underlining, mirrored/RTL text, complex scripts and charsets (Arabic, Hebrew, CJK, Cyrillic, Greek, combining diacritics), kerning-sensitive text width, and tab stop expansion; all comparing the default and legacy (system property enabled) rendering paths end-to-end. Add Snippet395 as a manual/visual companion to the automated tests: it renders the same set of text properties side-by-side and offers two checkboxes to toggle at runtime, without restarting, between plain GDI and GDI+ (advanced) rendering, and - while GDI+ is active - between the default and legacy text rendering path, to visually compare the resulting output. May fix eclipse-platform#3091 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>





❗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