Module: wine Branch: master Commit: b4592cbc7c0cfc718b723eb93f8e6110bed25775 URL: http://source.winehq.org/git/wine.git/?a=commit;h=b4592cbc7c0cfc718b723eb93f...
Author: Nikolay Sivov nsivov@codeweavers.com Date: Thu Jun 18 16:01:34 2015 +0300
dwrite: Count last cluster length too when building a line.
---
dlls/dwrite/layout.c | 18 ++++++++++++------ dlls/dwrite/tests/layout.c | 1 - 2 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/dlls/dwrite/layout.c b/dlls/dwrite/layout.c index a8adb2a..8a5915c 100644 --- a/dlls/dwrite/layout.c +++ b/dlls/dwrite/layout.c @@ -1026,7 +1026,7 @@ static HRESULT layout_compute_effective_runs(struct dwrite_textlayout *layout) s[0] = s[1] = layout_get_strikethrough_from_pos(layout, 0);
for (i = 0, start = 0, textpos = 0, width = 0.0; i < layout->cluster_count; i++) { - BOOL can_wrap_after = layout->clustermetrics[i].canWrapLineAfter; + BOOL overflow;
s[1] = layout_get_strikethrough_from_pos(layout, textpos);
@@ -1041,12 +1041,18 @@ static HRESULT layout_compute_effective_runs(struct dwrite_textlayout *layout) start = i; }
- /* check if we got new line */ - if (((can_wrap_after && (width + layout->clustermetrics[i].width > layout->maxwidth)) || - layout->clustermetrics[i].isNewline || /* always wrap on new line */ - i == layout->cluster_count - 1)) /* end of the text */ { + overflow = layout->clustermetrics[i].canWrapLineAfter && + (width + layout->clustermetrics[i].width > layout->maxwidth); + /* check if we got new */ + if (overflow || + layout->clustermetrics[i].isNewline || /* always wrap on new line */ + i == layout->cluster_count - 1) /* end of the text */ {
- UINT32 strlength = metrics.length, index = i; + UINT32 strlength, index = i; + + if (!overflow) + metrics.length += layout->clustermetrics[i].length; + strlength = metrics.length;
if (i >= start) { hr = layout_add_effective_run(layout, run, start, i - start + 1, origin_x, s[0]); diff --git a/dlls/dwrite/tests/layout.c b/dlls/dwrite/tests/layout.c index e8450df..d1374b6 100644 --- a/dlls/dwrite/tests/layout.c +++ b/dlls/dwrite/tests/layout.c @@ -2745,7 +2745,6 @@ static void test_GetLineMetrics(void) memset(&metrics, 0, sizeof(metrics)); hr = IDWriteTextLayout_GetLineMetrics(layout, &metrics, 1, &count); ok(hr == S_OK, "got 0x%08x\n", hr); -todo_wine ok(metrics.length == 5, "got %u\n", metrics.length); ok(metrics.trailingWhitespaceLength == 1, "got %u\n", metrics.trailingWhitespaceLength);