diff options
author | Grigori Goronzy <greg@blackbox> | 2011-07-17 13:53:29 +0200 |
---|---|---|
committer | Grigori Goronzy <greg@blackbox> | 2011-07-17 13:55:01 +0200 |
commit | 2f01497b9974ab083b99bed3823bbf9702ad8b9a (patch) | |
tree | c4f68e79ebbac00a602ffb37f10108a713dbfd12 | |
parent | c3167c0876ba3f727075a5c44797780a0a334477 (diff) | |
download | libass-2f01497b9974ab083b99bed3823bbf9702ad8b9a.tar.bz2 libass-2f01497b9974ab083b99bed3823bbf9702ad8b9a.tar.xz |
Fix line counting and breaking
Make sure to increment the line counter only if the offset of the new
line is actually legal and inside the bounds of the text size. Fixes
random crashes in case the last symbol of the line is a break.
git-blame says it's Evgeniys fault, it wasn't caused by the recent
layout changes.
-rw-r--r-- | libass/ass_render.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/libass/ass_render.c b/libass/ass_render.c index 0ac1ff9..8d82a74 100644 --- a/libass/ass_render.c +++ b/libass/ass_render.c @@ -1529,12 +1529,13 @@ wrap_lines_smart(ASS_Renderer *render_priv, double max_text_width) sizeof(LineInfo) * text_info->max_lines); } - if (lead < text_info->length) + if (lead < text_info->length) { text_info->glyphs[lead].linebreak = break_type; - last_space = -1; - s1 = text_info->glyphs + lead; - s_offset = d6_to_double(s1->bbox.xMin + s1->pos.x); - text_info->n_lines++; + last_space = -1; + s1 = text_info->glyphs + lead; + s_offset = d6_to_double(s1->bbox.xMin + s1->pos.x); + text_info->n_lines++; + } } } #define DIFF(x,y) (((x) < (y)) ? (y - x) : (x - y)) |