]> git.sesse.net Git - mlt/commitdiff
+ Moved ~ to LF hack to pango processing
authorlilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
Fri, 14 Oct 2005 13:10:17 +0000 (13:10 +0000)
committerlilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
Fri, 14 Oct 2005 13:10:17 +0000 (13:10 +0000)
git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@852 d19143bc-622f-0410-bfdd-b5b2a6649095

src/modules/gtk2/producer_pango.c

index 69b1c2527b5cb8d4f4e4fb7da95efcd56a15fd43..4f4526fb8bff8f7db21551f192e742a58cf1c193 100644 (file)
@@ -633,11 +633,23 @@ static GdkPixbuf *pango_get_pixbuf( const char *markup, const char *text, const
 //     pango_layout_set_spacing( layout, space );
        pango_layout_set_alignment( layout, ( PangoAlignment ) align  );
        if ( markup != NULL && strcmp( markup, "" ) != 0 )
+       {
                pango_layout_set_markup( layout, markup, strlen( markup ) );
+       }
        else if ( text != NULL && strcmp( text, "" ) != 0 )
-               pango_layout_set_text( layout, text, strlen( text ) );
+       {
+               // Replace all ~'s with a line feed (silly convention, but handy)
+               char *copy = strdup( text );
+               while ( strchr( copy, '~' ) )
+                       ( *strchr( copy, '~' ) ) = '\n';
+               pango_layout_set_text( layout, copy, strlen( copy ) );
+               free( copy );
+       }
        else
+       {
+               // Pango doesn't like empty strings
                pango_layout_set_text( layout, "  ", 2 );
+       }
        pango_layout_get_pixel_size( layout, &w, &h );
 
        pixbuf = gdk_pixbuf_new( GDK_COLORSPACE_RGB, TRUE /* has alpha */, 8, w + 2 * pad, h + 2 * pad );