]> git.sesse.net Git - vlc/blobdiff - modules/misc/freetype.c
vout_fb: cosmetics, else on the same line than closing }
[vlc] / modules / misc / freetype.c
index b00a50cc4a6b5ac639eecd7eb70e875b8d2464be..76fd10b262d2c55b00176304446e7d0b90eaf702 100644 (file)
@@ -40,6 +40,7 @@
 #include <vlc_input.h>
 #include <vlc_strings.h>
 #include <vlc_dialog.h>
+#include <vlc_memory.h>
 
 #include <math.h>
 #include <errno.h>
@@ -62,6 +63,9 @@
 #elif defined( WIN32 )
 #define DEFAULT_FONT "" /* Default font found at run-time */
 #define FC_DEFAULT_FONT "Arial"
+#elif defined( HAVE_MAEMO )
+#define DEFAULT_FONT "/usr/share/fonts/nokia/nosnb.ttf"
+#define FC_DEFAULT_FONT "Nokia Sans Bold"
 #else
 #define DEFAULT_FONT "/usr/share/fonts/truetype/freefont/FreeSerifBold.ttf"
 #define FC_DEFAULT_FONT "Serif Bold"
@@ -351,8 +355,7 @@ static int Create( vlc_object_t *p_this )
             _("Building font cache"),
             _("Please wait while your font cache is rebuilt.\n"
                 "This should take less than few minutes."), NULL );
-    char *path;
-    path = (char *)malloc( PATH_MAX + 1 );
+    char *path = xmalloc( PATH_MAX + 1 );
     /* Fontconfig doesnt seem to know where windows fonts are with
      * current contribs. So just tell default windows font directory
      * is the place to search fonts
@@ -1670,15 +1673,16 @@ static void SetupLine( filter_t *p_filter, const char *psz_text_in,
     {
         (*pi_runs)++;
 
+        /* XXX this logic looks somewhat broken */
+
         if( *ppp_styles )
         {
-            *ppp_styles = (ft_style_t **)
-                realloc( *ppp_styles, *pi_runs * sizeof( ft_style_t * ) );
+            *ppp_styles = realloc_or_free( *ppp_styles,
+                                          *pi_runs * sizeof( ft_style_t * ) );
         }
         else if( *pi_runs == 1 )
         {
-            *ppp_styles = (ft_style_t **)
-                malloc( *pi_runs * sizeof( ft_style_t * ) );
+            *ppp_styles = malloc( *pi_runs * sizeof( ft_style_t * ) );
         }
 
         /* We have just malloc'ed this memory successfully -
@@ -1689,10 +1693,12 @@ static void SetupLine( filter_t *p_filter, const char *psz_text_in,
             p_style = NULL;
         }
 
+        /* XXX more iffy logic */
+
         if( *ppi_run_lengths )
         {
-            *ppi_run_lengths = (uint32_t *)
-                realloc( *ppi_run_lengths, *pi_runs * sizeof( uint32_t ) );
+            *ppi_run_lengths = realloc_or_free( *ppi_run_lengths,
+                                              *pi_runs * sizeof( uint32_t ) );
         }
         else if( *pi_runs == 1 )
         {
@@ -2367,6 +2373,33 @@ static char* FontConfig_Select( FcConfig* priv, const char* family,
     FcPatternDestroy( p_pat );
     return strdup( (const char*)val_s );
 }
+#else
+
+static void SetupLine( filter_t *p_filter, const char *psz_text_in,
+                       uint32_t **psz_text_out, uint32_t *pi_runs,
+                       uint32_t **ppi_run_lengths, ft_style_t ***ppp_styles,
+                       ft_style_t *p_style )
+{
+        VLC_UNUSED(p_filter);
+        VLC_UNUSED(psz_text_in);
+        VLC_UNUSED(psz_text_out);
+        VLC_UNUSED(pi_runs);
+        VLC_UNUSED(ppi_run_lengths);
+        VLC_UNUSED(ppp_styles);
+        VLC_UNUSED(p_style);
+}
+
+static ft_style_t *GetStyleFromFontStack( filter_sys_t *p_sys,
+        font_stack_t **p_fonts, bool b_bold, bool b_italic,
+        bool b_uline )
+{
+        VLC_UNUSED(p_sys);
+        VLC_UNUSED(p_fonts);
+        VLC_UNUSED(b_bold);
+        VLC_UNUSED(b_italic);
+        VLC_UNUSED(b_uline);
+        return NULL;
+}
 #endif
 
 static void FreeLine( line_desc_t *p_line )