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

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2017-03-30 15:07:02 +03:00 committed by Alexandre Julliard
parent 7371325c04
commit 3d7fabf627
2 changed files with 4 additions and 5 deletions

View File

@ -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

View File

@ -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);