From 0691af08c6645aede26028fd44f2be8802e256f0 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Mon, 1 Feb 2016 14:59:13 +0300 Subject: [PATCH] dwrite: Implement GetTextBeforePosition() for layout analysis source. Signed-off-by: Nikolay Sivov Signed-off-by: Alexandre Julliard --- dlls/dwrite/layout.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/dlls/dwrite/layout.c b/dlls/dwrite/layout.c index 8847c976b02..86eab090eb3 100644 --- a/dlls/dwrite/layout.c +++ b/dlls/dwrite/layout.c @@ -4130,8 +4130,20 @@ static HRESULT WINAPI dwritetextlayout_source_GetTextAtPosition(IDWriteTextAnaly static HRESULT WINAPI dwritetextlayout_source_GetTextBeforePosition(IDWriteTextAnalysisSource1 *iface, UINT32 position, WCHAR const** text, UINT32* text_len) { - FIXME("%u %p %p: stub\n", position, text, text_len); - return E_NOTIMPL; + struct dwrite_textlayout *layout = impl_from_IDWriteTextAnalysisSource1(iface); + + TRACE("(%p)->(%u %p %p)\n", layout, position, text, text_len); + + if (position > 0 && position < layout->len) { + *text = layout->str; + *text_len = position; + } + else { + *text = NULL; + *text_len = 0; + } + + return S_OK; } static DWRITE_READING_DIRECTION WINAPI dwritetextlayout_source_GetParagraphReadingDirection(IDWriteTextAnalysisSource1 *iface)