freetype: use [.\/_] to break lines when ' ' only failed
authorRafaël Carré <funman@videolan.org>
Mon, 19 Nov 2007 23:34:15 +0000 (23:34 +0000)
committerRafaël Carré <funman@videolan.org>
Mon, 19 Nov 2007 23:34:15 +0000 (23:34 +0000)
modules/misc/freetype.c

index 2811b4e..408a1e8 100644 (file)
@@ -1264,11 +1264,22 @@ static int RenderText( filter_t *p_filter, subpicture_region_t *p_region_out,
             if( p_prev ) p_prev->p_next = p_line;
             else p_lines = p_line;
 
+            uint32_t *psz_unicode_saved = psz_unicode;
             while( psz_unicode > psz_line_start && *psz_unicode != ' ' )
             {
                 psz_unicode--;
             }
             if( psz_unicode == psz_line_start )
+            {   /* try harder to break that line */
+                psz_unicode = psz_unicode_saved;
+                while( psz_unicode > psz_line_start &&
+                    *psz_unicode != '_'  && *psz_unicode != '/' &&
+                    *psz_unicode != '\\' && *psz_unicode != '.' )
+                {
+                    psz_unicode--;
+                }
+            }
+            if( psz_unicode == psz_line_start )
             {
                 msg_Warn( p_filter, "unbreakable string" );
                 goto error;