Commit 3d7fabf6 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

dwrite: Fix off by one error in glyph count adjustment.

parent 7371325c
......@@ -1269,10 +1269,9 @@ static HRESULT layout_add_effective_run(struct dwrite_textlayout *layout, const
run->line = line;
if (r->u.regular.run.glyphCount) {
/* trim from the left */
/* Trim leading and trailing clusters. */
run->glyphcount = r->u.regular.run.glyphCount - r->u.regular.clustermap[start];
/* trim from the right */
if (start + length < r->u.regular.descr.stringLength - 1)
if (start + length < r->u.regular.descr.stringLength)
run->glyphcount -= r->u.regular.run.glyphCount - r->u.regular.clustermap[start + length];
}
else
......
......@@ -1626,7 +1626,7 @@ static void test_Draw(void)
flush_sequence(sequences, RENDERER_ID);
hr = IDWriteTextLayout_Draw(layout, &ctxt, &testrenderer, 0.0, 0.0);
ok(hr == S_OK, "got 0x%08x\n", hr);
ok_sequence(sequences, RENDERER_ID, draw_seq, "draw test", TRUE);
ok_sequence(sequences, RENDERER_ID, draw_seq, "draw test", FALSE);
IDWriteTextLayout_Release(layout);
/* with reduced width DrawGlyphRun() is called for every line */
......@@ -4987,7 +4987,7 @@ todo_wine
flush_sequence(sequences, RENDERER_ID);
hr = IDWriteTextLayout_Draw(layout, NULL, &testrenderer, 0.0f, 0.0f);
ok(hr == S_OK, "got 0x%08x\n", hr);
ok_sequence(sequences, RENDERER_ID, drawunderline4_seq, "draw underline test 4", TRUE);
ok_sequence(sequences, RENDERER_ID, drawunderline4_seq, "draw underline test 4", FALSE);
IDWriteTextLayout_Release(layout);
......
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