[vlc-commits] text_renderer: freetype: truncate line according to region max width

Francois Cartegnie git at videolan.org
Thu Jun 8 14:34:04 CEST 2017


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon Jun  5 20:45:17 2017 +0200| [8c1e2969bc8eaf48d3980ce4646c362713518ad6] | committer: Francois Cartegnie

text_renderer: freetype: truncate line according to region max width

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

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

diff --git a/modules/text_renderer/freetype/freetype.c b/modules/text_renderer/freetype/freetype.c
index aa98ab6d2d..2779a82279 100644
--- a/modules/text_renderer/freetype/freetype.c
+++ b/modules/text_renderer/freetype/freetype.c
@@ -1132,15 +1132,15 @@ static int Render( filter_t *p_filter, subpicture_region_t *p_region_out,
     line_desc_t *p_lines = NULL;
 
     uint32_t *pi_k_durations   = NULL;
-
     unsigned i_max_width = p_filter->fmt_out.video.i_visible_width;
-    if( p_region_in->i_x > 0 && (unsigned)p_region_in->i_x < i_max_width )
+    if( p_region_in->i_max_width > 0 && (unsigned) p_region_in->i_max_width < i_max_width )
+        i_max_width = p_region_in->i_max_width;
+    else if( p_region_in->i_x > 0 && (unsigned)p_region_in->i_x < i_max_width )
         i_max_width -= p_region_in->i_x;
 
     rv = LayoutText( p_filter,
                      psz_text, pp_styles, pi_k_durations, i_text_length, p_region_in->b_gridmode,
-                     p_filter->fmt_out.video.i_visible_width,
-                     &p_lines, &bbox, &i_max_face_height );
+                     i_max_width, &p_lines, &bbox, &i_max_face_height );
 
     p_region_out->i_x = p_region_in->i_x;
     p_region_out->i_y = p_region_in->i_y;



More information about the vlc-commits mailing list