Skip to content

Commit

Permalink
dwrite: Fix off by one error in glyph count adjustment.
Browse files Browse the repository at this point in the history
Signed-off-by: Nikolay Sivov <[email protected]>
Signed-off-by: Alexandre Julliard <[email protected]>
  • Loading branch information
nsivov authored and julliard committed Mar 30, 2017
1 parent 7371325 commit 3d7fabf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions dlls/dwrite/layout.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions dlls/dwrite/tests/layout.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit 3d7fabf

Please sign in to comment.