[vlc-devel] [PATCH] fribidi: use version 1.0

Shaleen Jain shaleen at jain.sh
Fri Feb 23 15:48:37 CET 2018


update functions deprecated in version 1.0
---
 Not tested with complex script subtitles

 configure.ac                                 |  2 +-
 modules/text_renderer/freetype/text_layout.c | 11 ++++++++++-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index 6573e9b99a..b8a5ed76f0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3227,7 +3227,7 @@ if test "${enable_freetype}" != "no"; then
 
       dnl fribidi support
       if test "${enable_fribidi}" != "no"; then
-        PKG_CHECK_MODULES(FRIBIDI, fribidi, [
+        PKG_CHECK_MODULES(FRIBIDI, [fribidi >= 1.0], [
           have_fribidi="yes"
           VLC_ADD_CPPFLAGS([skins2], [${FRIBIDI_CFLAGS} -DHAVE_FRIBIDI])
           VLC_ADD_LIBS([skins2], [${FRIBIDI_LIBS}])
diff --git a/modules/text_renderer/freetype/text_layout.c b/modules/text_renderer/freetype/text_layout.c
index 13efd567b4..476c273ef8 100644
--- a/modules/text_renderer/freetype/text_layout.c
+++ b/modules/text_renderer/freetype/text_layout.c
@@ -153,6 +153,7 @@ typedef struct paragraph_t
 
 #ifdef HAVE_FRIBIDI
     FriBidiCharType     *p_types;
+    FriBidiBracketType  *p_btypes;
     FriBidiLevel        *p_levels;
     FriBidiStrIndex     *pi_reordered_indices;
     FriBidiParType       paragraph_type;
@@ -361,6 +362,7 @@ static paragraph_t *NewParagraph( filter_t *p_filter,
 #ifdef HAVE_FRIBIDI
     p_paragraph->p_levels = vlc_alloc( i_size, sizeof( *p_paragraph->p_levels ) );
     p_paragraph->p_types = vlc_alloc( i_size, sizeof( *p_paragraph->p_types ) );
+    p_paragraph->p_btypes = vlc_alloc( i_size, sizeof( *p_paragraph->p_btypes ) );
     p_paragraph->pi_reordered_indices =
             vlc_alloc( i_size, sizeof( *p_paragraph->pi_reordered_indices ) );
 
@@ -398,6 +400,7 @@ error:
 #ifdef HAVE_FRIBIDI
     if( p_paragraph->p_levels ) free( p_paragraph->p_levels );
     if( p_paragraph->p_types ) free( p_paragraph->p_types );
+    if( p_paragraph->p_btypes ) free( p_paragraph->p_btypes );
     if( p_paragraph->pi_reordered_indices )
         free( p_paragraph->pi_reordered_indices );
 #endif
@@ -424,6 +427,7 @@ static void FreeParagraph( paragraph_t *p_paragraph )
 #ifdef HAVE_FRIBIDI
     free( p_paragraph->pi_reordered_indices );
     free( p_paragraph->p_types );
+    free( p_paragraph->p_btypes );
     free( p_paragraph->p_levels );
 #endif
 
@@ -436,7 +440,12 @@ static int AnalyzeParagraph( paragraph_t *p_paragraph )
     fribidi_get_bidi_types(  p_paragraph->p_code_points,
                              p_paragraph->i_size,
                              p_paragraph->p_types );
-    fribidi_get_par_embedding_levels( p_paragraph->p_types,
+    fribidi_get_bracket_types( p_paragraph->p_code_points,
+                               p_paragraph->i_size,
+                               p_paragraph->p_types,
+                               p_paragraph->p_btypes );
+    fribidi_get_par_embedding_levels_ex( p_paragraph->p_types,
+                                      p_paragraph->p_btypes,
                                       p_paragraph->i_size,
                                       &p_paragraph->paragraph_type,
                                       p_paragraph->p_levels );
-- 
2.16.2


More information about the vlc-devel mailing list