[vlc-commits] Freetype: regroup functions

Jean-Baptiste Kempf git at videolan.org
Tue Aug 18 16:25:32 CEST 2015


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Mon Aug 17 20:28:01 2015 +0200| [a1a02efeb8bbc0ce932aad81688b658c1d943a6a] | committer: Jean-Baptiste Kempf

Freetype: regroup functions

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

 modules/text_renderer/freetype.c |   70 ++++++++++++++++++--------------------
 1 file changed, 34 insertions(+), 36 deletions(-)

diff --git a/modules/text_renderer/freetype.c b/modules/text_renderer/freetype.c
index 05b84f4..a7e9457 100644
--- a/modules/text_renderer/freetype.c
+++ b/modules/text_renderer/freetype.c
@@ -861,42 +861,6 @@ static inline int RenderAXYZ( filter_t *p_filter,
     return VLC_SUCCESS;
 }
 
-
-
-
-static FT_Face LoadEmbeddedFace( filter_sys_t *p_sys, const char *psz_fontname,
-                                 const text_style_t *p_style )
-{
-    for( int k = 0; k < p_sys->i_font_attachments; k++ )
-    {
-        input_attachment_t *p_attach   = p_sys->pp_font_attachments[k];
-        int                 i_font_idx = 0;
-        FT_Face             p_face = NULL;
-
-        while( 0 == FT_New_Memory_Face( p_sys->p_library,
-                                        p_attach->p_data,
-                                        p_attach->i_data,
-                                        i_font_idx,
-                                        &p_face ))
-        {
-            if( p_face )
-            {
-                int i_style_received = ((p_face->style_flags & FT_STYLE_FLAG_BOLD)    ? STYLE_BOLD   : 0) |
-                                       ((p_face->style_flags & FT_STYLE_FLAG_ITALIC ) ? STYLE_ITALIC : 0);
-                if( p_face->family_name != NULL
-                 && !strcasecmp( p_face->family_name, psz_fontname )
-                 && (p_style->i_style_flags & (STYLE_BOLD | STYLE_ITALIC))
-                                                          == i_style_received )
-                    return p_face;
-
-                FT_Done_Face( p_face );
-            }
-            i_font_idx++;
-        }
-    }
-    return NULL;
-}
-
 static void FillDefaultStyles( filter_t *p_filter )
 {
     filter_sys_t *p_sys = p_filter->p_sys;
@@ -931,6 +895,7 @@ static void FillDefaultStyles( filter_t *p_filter )
     /* Apply forced styles to defaults, if any */
     text_style_Merge( p_sys->p_default_style, p_sys->p_forced_style, true );
 }
+
 static uni_char_t* SegmentsToTextAndStyles( filter_t *p_filter, const text_segment_t *p_segment, size_t *pi_string_length, const text_style_t ***ppp_styles)
 {
     const text_style_t **pp_styles = NULL;
@@ -1367,6 +1332,39 @@ bool FaceStyleEquals( const text_style_t *p_style1,
            !strcmp( p_style1->psz_fontname, p_style2->psz_fontname );
 }
 
+static FT_Face LoadEmbeddedFace( filter_sys_t *p_sys, const char *psz_fontname,
+                                 const text_style_t *p_style )
+{
+    for( int k = 0; k < p_sys->i_font_attachments; k++ )
+    {
+        input_attachment_t *p_attach   = p_sys->pp_font_attachments[k];
+        int                 i_font_idx = 0;
+        FT_Face             p_face = NULL;
+
+        while( 0 == FT_New_Memory_Face( p_sys->p_library,
+                                        p_attach->p_data,
+                                        p_attach->i_data,
+                                        i_font_idx,
+                                        &p_face ))
+        {
+            if( p_face )
+            {
+                int i_style_received = ((p_face->style_flags & FT_STYLE_FLAG_BOLD)    ? STYLE_BOLD   : 0) |
+                                       ((p_face->style_flags & FT_STYLE_FLAG_ITALIC ) ? STYLE_ITALIC : 0);
+                if( p_face->family_name != NULL
+                 && !strcasecmp( p_face->family_name, psz_fontname )
+                 && (p_style->i_style_flags & (STYLE_BOLD | STYLE_ITALIC))
+                                                          == i_style_received )
+                    return p_face;
+
+                FT_Done_Face( p_face );
+            }
+            i_font_idx++;
+        }
+    }
+    return NULL;
+}
+
 FT_Face LoadFace( filter_t *p_filter,
                   const text_style_t *p_style )
 {



More information about the vlc-commits mailing list