http://bugs.winehq.org/show_bug.cgi?id=59018
Bug ID: 59018 Summary: Font artifacts on glyphs with overhangs Product: Wine Version: 10.17 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: trivial Priority: P2 Component: win32u Assignee: wine-bugs@list.winehq.org Reporter: gamelaster@outlook.com Distribution: ---
Created attachment 79757 --> http://bugs.winehq.org/attachment.cgi?id=79757 Images of the issue + PoC patch
In the game MTA San Andreas (multiplayer modification for GTA San Andreas), in game chat and other parts using relevant API, some glyphs have leftover artifacts (images in attachment). ---------- User vahook from MTA:SA community was so kind that he investigated this issue and found the root cause, with hacky PoC fix provided. Quoting his explanation:
The DrawText methods in Microsoft's d3dx9 implementation expect the ExtTextOut functions in GDI to opaque overhangs as well (TTF glyphs with a negative abcC value) when invoked with the ETO_OPAQUE option, as DrawText will use abcA + abcB as the glyph width when copying the rasterized glyphs from a (reused) temporary buffer to a texture. However, the current implementation in NtGdiExtTextOutW opaques out an abcA + abcB + abcC wide box, meaning the background behind overhangs won't be cleared, resulting in artifacts in the font texture from previously rasterized glyphs.
In the attachment archive, there are images of the bug, also with image of PoC fix applied. PoC Fix patch is there as well. Additionally, there is font texture dump from the game, which shows that the artifacts are present in the texture.
Vahook provided reproduction code as well, which I modified a bit to forcefully use d3dx9_42.dll for successful reproduction. The code can be found here: https://github.com/gamelaster/wine-gdi-font-artifact-repro with prebuilt binaries (built by me) available to be downloaded here: https://github.com/gamelaster/wine-gdi-font-artifact-repro/releases/tag/v1.0... .