]> granicus.if.org Git - libass/commitdiff
Implement wrap style 1
authorGrigori Goronzy <greg@blackbox>
Thu, 13 Aug 2009 23:34:31 +0000 (01:34 +0200)
committerGrigori Goronzy <greg@blackbox>
Thu, 13 Aug 2009 23:36:14 +0000 (01:36 +0200)
Skip application of the algorithm that moves words between the lines
to equalize line length for wrap style 1.

libass/ass_render.c

index 828c883c8648e30b20336871c9972c5b22c9f1ab..f0800c3badddeee0e07bcf5ced9cbee2ce689c0e 100644 (file)
@@ -1625,13 +1625,12 @@ static unsigned get_next_char(ASS_Renderer *render_priv, char **str)
         return ' ';
     }
     if (*p == '\\') {
-        if ((*(p + 1) == 'N')
-            || ((*(p + 1) == 'n')
-                && (render_priv->state.wrap_style == 2))) {
+        if ((p[1] == 'N') || ((p[1] == 'n') &&
+                              (render_priv->state.wrap_style == 2))) {
             p += 2;
             *str = p;
             return '\n';
-        } else if ((*(p + 1) == 'n') || (*(p + 1) == 'h')) {
+        } else if ((p[1] == 'n') || (p[1] == 'h')) {
             p += 2;
             *str = p;
             return ' ';
@@ -2281,7 +2280,7 @@ wrap_lines_smart(ASS_Renderer *render_priv, double max_text_width)
     }
 #define DIFF(x,y) (((x) < (y)) ? (y - x) : (x - y))
     exit = 0;
-    while (!exit) {
+    while (!exit && render_priv->state.wrap_style != 1) {
         exit = 1;
         w = s3 = text_info->glyphs;
         s1 = s2 = 0;