[vlc-commits] text_renderer: freetype: don't fail the whole region on empty paragraph

Francois Cartegnie git at videolan.org
Mon Jun 5 20:52:56 CEST 2017


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Sun Jun  4 14:11:08 2017 +0200| [1c18925a7fd3bbbb8185ed30db40ff0b909626cb] | committer: Francois Cartegnie

text_renderer: freetype: don't fail the whole region on empty paragraph

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

 modules/text_renderer/freetype/text_layout.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/modules/text_renderer/freetype/text_layout.c b/modules/text_renderer/freetype/text_layout.c
index 15b8e93007..e24771a7e4 100644
--- a/modules/text_renderer/freetype/text_layout.c
+++ b/modules/text_renderer/freetype/text_layout.c
@@ -1329,7 +1329,7 @@ static int LayoutParagraph( filter_t *p_filter, paragraph_t *p_paragraph,
     FT_Pos i_total_width = 0;
     FT_Pos i_last_space_width = 0;
     int i_last_space = -1;
-    line_desc_t *p_first_line = 0;
+    line_desc_t *p_first_line = NULL;
     line_desc_t **pp_line = &p_first_line;
 
     for( int i = 0; i < p_paragraph->i_size; ++i )
@@ -1400,9 +1400,12 @@ static int LayoutParagraph( filter_t *p_filter, paragraph_t *p_paragraph,
         {
             if( i_line_start == i )
             {
-                msg_Err( p_filter,
-                         "LayoutParagraph(): Width of single glyph exceeds maximum" );
-                goto error;
+                /* If wrapping, algorithm would not end shifting lines down.
+                 *  Not wrapping, that can't be rendered anymore. */
+                msg_Dbg( p_filter, "LayoutParagraph(): First glyph width in line exceeds maximum, skipping" );
+                for( ; i < p_paragraph->i_size; ++i )
+                    ReleaseGlyphBitMaps( &p_paragraph->p_glyph_bitmaps[ i ] );
+                return VLC_SUCCESS;
             }
 
             int i_end_offset;



More information about the vlc-commits mailing list