[vlc-commits] text_renderer: freetype: handle text wrap style
Francois Cartegnie
git at videolan.org
Mon Jun 5 20:52:44 CEST 2017
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri Jun 2 17:41:20 2017 +0200| [3d8f7c70f6e8bbeebd11155d27451836701c8e90] | committer: Francois Cartegnie
text_renderer: freetype: handle text wrap style
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3d8f7c70f6e8bbeebd11155d27451836701c8e90
---
modules/text_renderer/freetype/text_layout.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/modules/text_renderer/freetype/text_layout.c b/modules/text_renderer/freetype/text_layout.c
index 66d7673cfa..4cbf1ef250 100644
--- a/modules/text_renderer/freetype/text_layout.c
+++ b/modules/text_renderer/freetype/text_layout.c
@@ -1345,6 +1345,8 @@ static int LayoutParagraph( filter_t *p_filter, paragraph_t *p_paragraph,
for( int i = 0; i <= p_paragraph->i_size; ++i )
{
+ const run_desc_t *p_run = &p_paragraph->p_runs[p_paragraph->pi_run_ids[i]];
+
if( i == p_paragraph->i_size )
{
if( i_line_start < i )
@@ -1386,7 +1388,7 @@ static int LayoutParagraph( filter_t *p_filter, paragraph_t *p_paragraph,
i_width += p_paragraph->p_glyph_bitmaps[ i ].i_x_advance;
- if( i_last_space_width >= i_preferred_width
+ if( ( i_last_space_width >= i_preferred_width && p_run->p_style->e_wrapinfo == STYLE_WRAP_DEFAULT )
|| i_width >= i_max_width )
{
if( i_line_start == i )
@@ -1406,6 +1408,15 @@ static int LayoutParagraph( filter_t *p_filter, paragraph_t *p_paragraph,
i_end_offset, pp_line, b_grid ) )
goto error;
+ /* Handle early end of renderable content;
+ We're over size and we can't break space */
+ if( p_run->p_style->e_wrapinfo == STYLE_WRAP_NONE )
+ {
+ for( ; i < p_paragraph->i_size; ++i )
+ ReleaseGlyphBitMaps( &p_paragraph->p_glyph_bitmaps[ i ] );
+ break;
+ }
+
pp_line = &( *pp_line )->p_next;
i_line_start = i_end_offset;
i = i_line_start - 1;
More information about the vlc-commits
mailing list