From 7b3dc7d1448f4c3f8ab0465b5ea8d1df55e7186b Mon Sep 17 00:00:00 2001 From: Grigori Goronzy Date: Fri, 14 Aug 2009 01:34:31 +0200 Subject: Implement wrap style 1 Skip application of the algorithm that moves words between the lines to equalize line length for wrap style 1. --- libass/ass_render.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/libass/ass_render.c b/libass/ass_render.c index 828c883..f0800c3 100644 --- a/libass/ass_render.c +++ b/libass/ass_render.c @@ -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; -- cgit v1.2.3