[vlc-commits] codec: ttml: fix white space stripping

Francois Cartegnie git at videolan.org
Fri May 26 12:28:11 CEST 2017


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri May 26 12:26:40 2017 +0200| [52030cf4254b15a986819da31fb32e247934b5a6] | committer: Francois Cartegnie

codec: ttml: fix white space stripping

Must not depend of ttml style presence

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=52030cf4254b15a986819da31fb32e247934b5a6
---

 modules/codec/ttml/substtml.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/modules/codec/ttml/substtml.c b/modules/codec/ttml/substtml.c
index ed7a79e36b..0f9fbf8248 100644
--- a/modules/codec/ttml/substtml.c
+++ b/modules/codec/ttml/substtml.c
@@ -662,6 +662,7 @@ static void AppendTextToRegion( ttml_context_t *p_ctx, const tt_textnode_t *p_tt
     p_segment = text_segment_New( p_ttnode->psz_text );
     if( p_segment )
     {
+        bool b_preserve_space = false;
         ttml_style_t *s = InheritTTMLStyles( p_ctx, p_ttnode->p_parent );
         if( s )
         {
@@ -671,8 +672,7 @@ static void AppendTextToRegion( ttml_context_t *p_ctx, const tt_textnode_t *p_tt
             p_segment->style = s->font_style;
             s->font_style = NULL;
 
-            if( !s->b_preserve_space )
-                StripSpacing( p_segment );
+            b_preserve_space = s->b_preserve_space;
             if( s->b_direction_set )
                 BIDIConvert( p_segment, s->i_direction );
 
@@ -686,6 +686,9 @@ static void AppendTextToRegion( ttml_context_t *p_ctx, const tt_textnode_t *p_tt
 
             ttml_style_Delete( s );
         }
+
+        if( !b_preserve_space )
+            StripSpacing( p_segment );
     }
 
     *p_region->pp_last_segment = p_segment;



More information about the vlc-commits mailing list