[Bug 50494] ID2D1RenderTarget::DrawText(): The position and size of the drawn text is incorrect
WineHQ Bugzilla
wine-bugs at winehq.org
Tue Jan 12 23:34:13 CST 2021
https://bugs.winehq.org/show_bug.cgi?id=50494
--- Comment #1 from Haoyang Chen <chenhaoyang at 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();
}
}
--
Do not reply to this email, post in Bugzilla using the
above URL to reply.
You are receiving this mail because:
You are watching all bug changes.
More information about the wine-bugs
mailing list