https://bugs.winehq.org/show_bug.cgi?id=57309
Bug ID: 57309 Summary: [Regression] Text wrapping issue with DrawTextA/DrawTextW Product: Wine Version: 9.0 Hardware: aarch64 OS: MacOS Status: UNCONFIRMED Severity: normal Priority: P2 Component: win32u Assignee: wine-bugs@winehq.org Reporter: andrews05@gmail.com
Created attachment 77255 --> https://bugs.winehq.org/attachment.cgi?id=77255 Text not wrapping at the correct position
In the game EV Nova, current versions of Wine appear to incorrectly render multiline text, with text sometimes extending beyond the right edge of the bounding box and getting clipped. I have observed this issue in Wine 9.0 and 9.17, as well as WineCX 22.1 and 23.7. I believe it did work correctly in WineCX 22.0 and I ended up copying "win32u.dll.so" from that version into WineCX 22.1 to get it to work there too (I can attach this file if it would be helpful).
To reproduce this issue you can download EV Nova from here: https://github.com/andrews05/EV-Nova-CE/releases/tag/r3 Press the "x" key at the main menu to display a text dialog where you should see the issue.
I'd be happy to investigate and attempt to fix the issue myself if someone could give me a pointer on where to start.
https://bugs.winehq.org/show_bug.cgi?id=57309
--- Comment #1 from andrews05@gmail.com --- Created attachment 77256 --> https://bugs.winehq.org/attachment.cgi?id=77256 Correct text wrapping in an older version of Wine
https://bugs.winehq.org/show_bug.cgi?id=57309
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- URL| |https://github.com/andrews0 | |5/EV-Nova-CE/releases/tag/r | |3 Keywords| |download, regression
--- Comment #2 from Austin English austinenglish@gmail.com --- Please run a regression test: https://gitlab.winehq.org/wine/wine/-/wikis/Regression-Testing
https://bugs.winehq.org/show_bug.cgi?id=57309
--- Comment #3 from andrews05@gmail.com --- Hi Austin, I'm afraid I can't really do that as the older versions of Wine (non-CX) don't run on my Mac due to being 64-bit only.
https://bugs.winehq.org/show_bug.cgi?id=57309
--- Comment #4 from Rafał Mużyło galtgendo@o2.pl --- Do you have any idea which versions of wine those versions map to ?
https://bugs.winehq.org/show_bug.cgi?id=57309
--- Comment #5 from andrews05@gmail.com --- Both WineCX 22.0 and 22.1 purport to be Wine 7.7, but I'm not sure this is correct.
I've been digging through the sources and have found this commit which occurred between 22.0 and 22.1 that could possibly be related. https://gitlab.winehq.org/wine/wine/-/commit/bca9df8db26206ddd9c615d274d8ff0... I'll try to build with this change reverted to see if it helps...
https://bugs.winehq.org/show_bug.cgi?id=57309
Fabian Maurer dark.shadow4@web.de changed:
What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 Status|UNCONFIRMED |NEW CC| |dark.shadow4@web.de Regression SHA1| |bca9df8db26206ddd9c615d274d | |8ff0c5652e17a
--- Comment #6 from Fabian Maurer dark.shadow4@web.de --- Confirming.
The game must be run with WINEDLLOVERRIDES=ddraw=n
The issue first appeared in wine-7.17, bisected to commit bca9df8db26206ddd9c615d274d8ff0c5652e17a Author: Zhiyi Zhang zzhang@codeweavers.com Date: Mon Aug 15 23:13:54 2022 +0800
win32u: Only cache font glyph metrics from GGO_METRICS.
https://bugs.winehq.org/show_bug.cgi?id=57309
--- Comment #7 from Fabian Maurer dark.shadow4@web.de ---
I've been digging through the sources and have found this commit which occurred between 22.0 and 22.1 that could possibly be related. https://gitlab.winehq.org/wine/wine/-/commit/ bca9df8db26206ddd9c615d274d8ff0c5652e17a I'll try to build with this change reverted to see if it helps...
Good guess. I noticed the game is a lot slower with wine-9.19 compared to 7.x, I'll try to figure that out as well.
https://bugs.winehq.org/show_bug.cgi?id=57309
--- Comment #8 from Fabian Maurer dark.shadow4@web.de --- I recorded the performance issue here: bug 57313
https://bugs.winehq.org/show_bug.cgi?id=57309
--- Comment #9 from andrews05@gmail.com --- @Fabien thanks heaps for investigating and confirming this! I'm not having much luck building on my arm Mac sadly.
What should I do from here, is it okay to submit a PR reverting that commit? The description indicated it was fixing an incredibly minor issue: "Fix Steam installer next button text moving to the left for 1 pixel when hovered".
https://bugs.winehq.org/show_bug.cgi?id=57309
Fabian Maurer dark.shadow4@web.de changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |zzhang@codeweavers.com
--- Comment #10 from Fabian Maurer dark.shadow4@web.de --- Not sure, it's trading UI glitches vs UI glitches.. Zhiyi would you mind taking a look?
https://bugs.winehq.org/show_bug.cgi?id=57309
Zhiyi Zhang zzhang@codeweavers.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Assignee|wine-bugs@winehq.org |zzhang@codeweavers.com
--- Comment #11 from Zhiyi Zhang zzhang@codeweavers.com --- I will take a look when I have time.
https://bugs.winehq.org/show_bug.cgi?id=57309
--- Comment #12 from Zhiyi Zhang zzhang@codeweavers.com --- Taking a look.
https://bugs.winehq.org/show_bug.cgi?id=57309
--- Comment #13 from Zhiyi Zhang zzhang@codeweavers.com --- Created attachment 77641 --> https://bugs.winehq.org/attachment.cgi?id=77641 smaller test program that can reproduce the bug
https://bugs.winehq.org/show_bug.cgi?id=57309
--- Comment #14 from Zhiyi Zhang zzhang@codeweavers.com --- Created attachment 77642 --> https://bugs.winehq.org/attachment.cgi?id=77642 patch 1/2
https://bugs.winehq.org/show_bug.cgi?id=57309
--- Comment #15 from Zhiyi Zhang zzhang@codeweavers.com --- Created attachment 77643 --> https://bugs.winehq.org/attachment.cgi?id=77643 patch 2/2
https://bugs.winehq.org/show_bug.cgi?id=57309
--- Comment #16 from Zhiyi Zhang zzhang@codeweavers.com --- The root cause is that FreeType reports different font metrics for GGO_METRICS and GGO_BITMAP. The game uses DrawText(..., DT_CALCRECT), which in turn uses GetTextExtentExPoint() and eventually freetype_get_glyph_outline(GGO_METRICS) to calculate text extent. However, the game draws the text using a bitmap font so glyphs from GGO_METRICS, which is from FT_LOAD_TARGET_MONO get used. The font metrics difference causes the text to be truncated because the calculated text extent is from FT_LOAD_TARGET_NORMAL instead of FT_LOAD_TARGET_MONO. On Windows, an anti-aliased font and bitmap font of the same font face report the same font metrics so such problems don't occur. The ultimate fix is to let FreeType hint the bitmap fonts with the same font metrics as anti-aliased fonts but there are no settings that can achieve it unless we write a new FreeType hinter. Eventually, I resorted to calculating font metrics with GGO_METRICS using the actual font format to work around this. I don't think this change is safe to submit during code freeze so I will do it after.
https://bugs.winehq.org/show_bug.cgi?id=57309
--- Comment #17 from andrews05@gmail.com --- Thanks so much @Zhiyi! Happy to wait for a future release.
https://bugs.winehq.org/show_bug.cgi?id=57309
Zhiyi Zhang zzhang@codeweavers.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Attachment #77642|0 |1 is obsolete| |
--- Comment #18 from Zhiyi Zhang zzhang@codeweavers.com --- Created attachment 77647 --> https://bugs.winehq.org/attachment.cgi?id=77647 v2 patch 1/2
https://bugs.winehq.org/show_bug.cgi?id=57309
Zhiyi Zhang zzhang@codeweavers.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Attachment #77643|0 |1 is obsolete| |
--- Comment #19 from Zhiyi Zhang zzhang@codeweavers.com --- Created attachment 77648 --> https://bugs.winehq.org/attachment.cgi?id=77648 v2 patch 2/2
https://bugs.winehq.org/show_bug.cgi?id=57309
--- Comment #20 from Rafał Mużyło galtgendo@o2.pl --- If we're tinkering with how font metrics are handled, I'd like to remind you about bug 44963, where wine's 'fake_bold' leads to another case of inconsistent metrics.