diff options
author | Grigori Goronzy <greg@blackbox> | 2011-06-11 03:38:11 +0200 |
---|---|---|
committer | Grigori Goronzy <greg@blackbox> | 2011-06-11 03:47:53 +0200 |
commit | dc4e13bdab03b352825d8dbd46966fa932832d28 (patch) | |
tree | de8c9e7bf67f2016cd183e714cb3acbafcecc811 | |
parent | 1a57533be4c4298edae0ca06f3984b48c6ec5e4f (diff) | |
download | libass-dc4e13bdab03b352825d8dbd46966fa932832d28.tar.bz2 libass-dc4e13bdab03b352825d8dbd46966fa932832d28.tar.xz |
Fix whitespace trimming
Only try to remove any further whitespace in front of a line if the
first character of the line (the break character) is whitespace.
Addresses Issue 35.
-rw-r--r-- | libass/ass_render.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/libass/ass_render.c b/libass/ass_render.c index 4b1e4a3..ef888ac 100644 --- a/libass/ass_render.c +++ b/libass/ass_render.c @@ -1364,16 +1364,17 @@ static void trim_whitespace(ASS_Renderer *render_priv) } // A break itself can contain a whitespace, too cur = ti->glyphs + i; - if (cur->symbol == ' ') + if (cur->symbol == ' ') { cur->skip++; - // Mark whitespace after - j = i + 1; - cur = ti->glyphs + j; - while (j < ti->length && IS_WHITESPACE(cur)) { - cur->skip++; - cur = ti->glyphs + ++j; + // Mark whitespace after + j = i + 1; + cur = ti->glyphs + j; + while (j < ti->length && IS_WHITESPACE(cur)) { + cur->skip++; + cur = ti->glyphs + ++j; + } + i = j - 1; } - i = j - 1; } } } |