]> granicus.if.org Git - libass/commitdiff
Properly skip glyphs for multiple consecutive line breaks
authorOleg Oshmyan <chortos@inbox.lv>
Sun, 2 Aug 2015 21:40:16 +0000 (00:40 +0300)
committerOleg Oshmyan <chortos@inbox.lv>
Sun, 2 Aug 2015 21:54:51 +0000 (00:54 +0300)
This corrects the calculated width of events that contain \N\N,
which previously included the width of the glyph corresponding
to '\n' (more generally, for n consecutive line breaks, only
the first glyph was skipped and n-1 glyphs were included).

Reported on IRC.

libass/ass_render.c

index 42758c890a1dc7175782264a4538619e494cc746..3fc4daf5583c6d38b7d2a433f61f5876dcb3304d 100644 (file)
@@ -1481,7 +1481,7 @@ 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->symbol == '\n') {
                 cur->skip++;
                 // Mark whitespace after
                 j = i + 1;