diff --git a/dlls/dwrite/layout.c b/dlls/dwrite/layout.c index 27b02dca0ae..da08b393824 100644 --- a/dlls/dwrite/layout.c +++ b/dlls/dwrite/layout.c @@ -603,10 +603,10 @@ static inline void init_cluster_metrics(const struct dwrite_textlayout *layout, position = run->descr.textPosition + stop_position; if (stop_glyph == run->glyphcount) - breakcondition = get_effective_breakpoint(layout, stop_position).breakConditionAfter; + breakcondition = get_effective_breakpoint(layout, position).breakConditionAfter; else { - breakcondition = get_effective_breakpoint(layout, stop_position).breakConditionBefore; - if (stop_position) position = stop_position - 1; + breakcondition = get_effective_breakpoint(layout, position).breakConditionBefore; + if (stop_position) position -= 1; } metrics->canWrapLineAfter = breakcondition == DWRITE_BREAK_CONDITION_CAN_BREAK || diff --git a/dlls/dwrite/tests/layout.c b/dlls/dwrite/tests/layout.c index 00da357318a..c04e73aa227 100644 --- a/dlls/dwrite/tests/layout.c +++ b/dlls/dwrite/tests/layout.c @@ -1907,6 +1907,7 @@ todo_wine ok(hr == S_OK, "got 0x%08x\n", hr); ok(count == 2, "got %u\n", count); ok(metrics[0].isWhitespace == 0, "got %d\n", metrics[0].isWhitespace); + ok(metrics[0].canWrapLineAfter == 0, "got %d\n", metrics[0].canWrapLineAfter); ok(metrics[1].isWhitespace == 1, "got %d\n", metrics[1].isWhitespace); ok(metrics[1].canWrapLineAfter == 1, "got %d\n", metrics[1].canWrapLineAfter); IDWriteTextLayout_Release(layout); @@ -1990,6 +1991,10 @@ todo_wine { for (i = 0; i < count; i++) { ok(metrics[i].length == 1, "%d: got %d\n", i, metrics[i].length); ok(metrics[i].isSoftHyphen == (i == count - 1), "%d: got %d\n", i, metrics[i].isSoftHyphen); + if (metrics[i].isNewline) { + ok(metrics[i].width == 0.0f, "%u: got width %f\n", i, metrics[i].width); + ok(metrics[i].canWrapLineAfter == 1, "%u: got %d\n", i, metrics[i].canWrapLineAfter); + } } IDWriteTextLayout_Release(layout);