Commit 7dd75003 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

d2d1: Support different measuring modes in DrawText().

parent 858ea7a7
...@@ -888,6 +888,7 @@ static void STDMETHODCALLTYPE d2d_d3d_render_target_DrawText(ID2D1RenderTarget * ...@@ -888,6 +888,7 @@ static void STDMETHODCALLTYPE d2d_d3d_render_target_DrawText(ID2D1RenderTarget *
const WCHAR *string, UINT32 string_len, IDWriteTextFormat *text_format, const D2D1_RECT_F *layout_rect, const WCHAR *string, UINT32 string_len, IDWriteTextFormat *text_format, const D2D1_RECT_F *layout_rect,
ID2D1Brush *brush, D2D1_DRAW_TEXT_OPTIONS options, DWRITE_MEASURING_MODE measuring_mode) ID2D1Brush *brush, D2D1_DRAW_TEXT_OPTIONS options, DWRITE_MEASURING_MODE measuring_mode)
{ {
struct d2d_d3d_render_target *render_target = impl_from_ID2D1RenderTarget(iface);
IDWriteTextLayout *text_layout; IDWriteTextLayout *text_layout;
IDWriteFactory *dwrite_factory; IDWriteFactory *dwrite_factory;
D2D1_POINT_2F origin; D2D1_POINT_2F origin;
...@@ -898,9 +899,6 @@ static void STDMETHODCALLTYPE d2d_d3d_render_target_DrawText(ID2D1RenderTarget * ...@@ -898,9 +899,6 @@ static void STDMETHODCALLTYPE d2d_d3d_render_target_DrawText(ID2D1RenderTarget *
iface, debugstr_wn(string, string_len), string_len, text_format, layout_rect, iface, debugstr_wn(string, string_len), string_len, text_format, layout_rect,
brush, options, measuring_mode); brush, options, measuring_mode);
if (measuring_mode != DWRITE_MEASURING_MODE_NATURAL)
FIXME("Ignoring measuring mode %#x.\n", measuring_mode);
if (FAILED(hr = DWriteCreateFactory(DWRITE_FACTORY_TYPE_SHARED, if (FAILED(hr = DWriteCreateFactory(DWRITE_FACTORY_TYPE_SHARED,
&IID_IDWriteFactory, (IUnknown **)&dwrite_factory))) &IID_IDWriteFactory, (IUnknown **)&dwrite_factory)))
{ {
...@@ -908,8 +906,13 @@ static void STDMETHODCALLTYPE d2d_d3d_render_target_DrawText(ID2D1RenderTarget * ...@@ -908,8 +906,13 @@ static void STDMETHODCALLTYPE d2d_d3d_render_target_DrawText(ID2D1RenderTarget *
return; return;
} }
hr = IDWriteFactory_CreateTextLayout(dwrite_factory, string, string_len, text_format, if (measuring_mode == DWRITE_MEASURING_MODE_NATURAL)
layout_rect->right - layout_rect->left, layout_rect->bottom - layout_rect->top, &text_layout); hr = IDWriteFactory_CreateTextLayout(dwrite_factory, string, string_len, text_format,
layout_rect->right - layout_rect->left, layout_rect->bottom - layout_rect->top, &text_layout);
else
hr = IDWriteFactory_CreateGdiCompatibleTextLayout(dwrite_factory, string, string_len, text_format,
layout_rect->right - layout_rect->left, layout_rect->bottom - layout_rect->top, render_target->dpi_x / 96.0f,
(DWRITE_MATRIX*)&render_target->drawing_state.transform, measuring_mode == DWRITE_MEASURING_MODE_GDI_NATURAL, &text_layout);
IDWriteFactory_Release(dwrite_factory); IDWriteFactory_Release(dwrite_factory);
if (FAILED(hr)) if (FAILED(hr))
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment