https://bugs.winehq.org/show_bug.cgi?id=50494
Bug ID: 50494 Summary: ID2D1RenderTarget::DrawText(): The position and size of the drawn text is incorrect Product: Wine Version: 6.0-rc1 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: d2d Assignee: wine-bugs@winehq.org Reporter: chenhaoyang@uniontech.com CC: bunglehead@gmail.com Distribution: ---
Created attachment 69147 --> https://bugs.winehq.org/attachment.cgi?id=69147 demo
The test result of this demo in wine is different from win7.The position and size of some text is strange.
https://bugs.winehq.org/show_bug.cgi?id=50494
Nikolay Sivov bunglehead@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC|bunglehead@gmail.com |
https://bugs.winehq.org/show_bug.cgi?id=50494
--- Comment #1 from Haoyang Chen chenhaoyang@uniontech.com --- //Draw again using DrawTextLayout to illustrate the problem. void draw_text(ID2D1SolidColorBrush *brush, D2D1_RECT_F layoutRect, WCHAR *text) { if (!text ||!g_pRenderTarget || !g_pTextFormat )return;
//draw text g_pRenderTarget->DrawTextW(text, wcslen(text), g_pTextFormat, layoutRect, brush);
//draw again using DrawTextLayout D2D_POINT_2F origin = {.0f,.0f}; HRESULT hr = S_OK; IDWriteTextLayout *textLayout = NULL; d2d_point_set(&origin,layoutRect.left > layoutRect.right ? layoutRect.right : layoutRect.left , layoutRect.top > layoutRect.bottom ? layoutRect.bottom : layoutRect.top);
hr = g_pDWriteFactory->CreateTextLayout(text,wcslen(text),g_pTextFormat, layoutRect.left > layoutRect.right ? (layoutRect.right - layoutRect.left) : layoutRect.right, layoutRect.top > layoutRect.bottom ? (layoutRect.bottom - layoutRect.top ) : layoutRect.bottom, &textLayout); if (SUCCEEDED(hr)) { g_pRenderTarget->DrawTextLayout(origin, textLayout, brush); textLayout->Release(); } }
https://bugs.winehq.org/show_bug.cgi?id=50494
--- Comment #2 from Nikolay Sivov bunglehead@gmail.com --- Created attachment 69148 --> https://bugs.winehq.org/attachment.cgi?id=69148 C demo
Same demo converted to C.
https://bugs.winehq.org/show_bug.cgi?id=50494
--- Comment #3 from Nikolay Sivov bunglehead@gmail.com --- Created attachment 69149 --> https://bugs.winehq.org/attachment.cgi?id=69149 patch
I don't think layout rectangle should be adjusted before passing it to dwrite. On Windows 10 another important difference besides text origin for inverted rectangle is that everything is wrapped to layout rectangle, that might be a dwrite issue, wrapping mode has to be tested separately. Attached patch fixes both problems for me.
Does the demo work differently on Windows 7 vs Windows 10?
https://bugs.winehq.org/show_bug.cgi?id=50494
--- Comment #4 from Haoyang Chen chenhaoyang@uniontech.com --- Yes, d2d may just be a position problem, and there are some problems with font width handling in dwrite. It has the same effect on windows 7 and windows 10.
https://bugs.winehq.org/show_bug.cgi?id=50494
--- Comment #5 from Nikolay Sivov bunglehead@gmail.com --- Bug 50501 is to track directwrite wrapping issue.
https://bugs.winehq.org/show_bug.cgi?id=50494
Nikolay Sivov bunglehead@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 Status|UNCONFIRMED |NEW
--- Comment #6 from Nikolay Sivov bunglehead@gmail.com --- Confirming.
https://bugs.winehq.org/show_bug.cgi?id=50494
Nikolay Sivov bunglehead@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution|--- |FIXED Fixed by SHA1| |f37c83452ebd909275b896bdc37 | |f36155e1800ee
--- Comment #7 from Nikolay Sivov bunglehead@gmail.com --- Fixed with f37c83452ebd909275b896bdc37f36155e1800ee, 9521c6a1eb781ff7cb75a83544bf9b78f889a9e2.
https://bugs.winehq.org/show_bug.cgi?id=50494
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #8 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 6.1.