summaryrefslogtreecommitdiffstats
path: root/libass/ass_render.c
diff options
context:
space:
mode:
authorOleg Oshmyan <chortos@inbox.lv>2020-10-16 22:50:41 +0300
committerOleg Oshmyan <chortos@inbox.lv>2020-10-18 05:03:17 +0300
commit24bff1571420d08bfbcc8754af3d3ea0c0bed4b2 (patch)
tree50b150e5413aaf770e1ffa7b270a1f85a830bdb8 /libass/ass_render.c
parentb27b97ae52a0af7f4a0f32b32c280d8cc1dae12c (diff)
downloadlibass-24bff1571420d08bfbcc8754af3d3ea0c0bed4b2.tar.bz2
libass-24bff1571420d08bfbcc8754af3d3ea0c0bed4b2.tar.xz
Support line breaks with Banner effect
Make Banner default to \q2, but allow explicit line breaks and \q overrides. Justify the lines according to \a etc., and wrap lines as usual if \q is overridden, but make sure to keep the left/right edge of the whole event flush with the edge of the screen at the event's start time as required by Banner. This is what VSFilter does.
Diffstat (limited to 'libass/ass_render.c')
-rw-r--r--libass/ass_render.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/libass/ass_render.c b/libass/ass_render.c
index fe499f1..2cec0e4 100644
--- a/libass/ass_render.c
+++ b/libass/ass_render.c
@@ -2130,8 +2130,10 @@ static void align_lines(ASS_Renderer *render_priv, double max_text_width)
int justify = render_priv->state.justify;
double max_width = 0;
- if (render_priv->state.evt_type == EVENT_HSCROLL)
- return;
+ if (render_priv->state.evt_type == EVENT_HSCROLL) {
+ justify = halign;
+ halign = HALIGN_LEFT;
+ }
for (i = 0; i <= text_info->length; ++i) { // (text_info->length + 1) is the end of the last line
if ((i == text_info->length) || glyphs[i].linebreak) {
@@ -2639,16 +2641,7 @@ ass_render_event(ASS_Renderer *render_priv, ASS_Event *event,
x2scr_left(render_priv, MarginL);
// wrap lines
- if (render_priv->state.evt_type != EVENT_HSCROLL) {
- // rearrange text in several lines
- wrap_lines_smart(render_priv, max_text_width);
- } else {
- // no breaking or wrapping, everything in a single line
- text_info->lines[0].offset = 0;
- text_info->lines[0].len = text_info->length;
- text_info->n_lines = 1;
- measure_text(render_priv);
- }
+ wrap_lines_smart(render_priv, max_text_width);
reorder_text(render_priv);