From: Grigori Goronzy Date: Sat, 11 Jun 2011 01:38:11 +0000 (+0200) Subject: Fix whitespace trimming X-Git-Tag: 0.10.0~83 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=dc4e13bdab03b352825d8dbd46966fa932832d28;p=libass 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. --- 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; } } }