]> granicus.if.org Git - libass/commitdiff
Add hack to support empty lines of text
authorgreg <greg@blackbox>
Fri, 19 Jun 2009 05:34:03 +0000 (07:34 +0200)
committergreg <greg@blackbox>
Sat, 20 Jun 2009 01:38:00 +0000 (03:38 +0200)
Consecutive forced breaks (\N\N) can be used to create empty lines of
text in other renderers. This doesn't work with the current text
layouter (wrap_lines_smart). This hack inserts a space glyph between two
consecutive forced breaks to get around this limitation.

libass/ass_render.c

index f2a34b2d0763cd3cafea83b22c3e68952efbe1d5..870623e23e375270fab23cbe668a4a1f2db54743 100644 (file)
@@ -2224,6 +2224,14 @@ ass_render_event(ass_renderer_t *render_priv, ass_event_t *event,
         if (code == 0)
             break;
 
+        // Insert space between two forced breaks to create empty lines
+        // FIXME: should probably be done in wrap_lines_smart,
+        // this is a hack
+        if (previous == '\n' && code == '\n') {
+            code = ' ';
+            p -= 2;
+        }
+
         if (text_info->length >= text_info->max_glyphs) {
             // Raise maximum number of glyphs
             text_info->max_glyphs *= 2;