if( i_pts <= VLC_TS_INVALID )
{
msg_Warn( p_dec, "subtitle without a date" );
+ free( psz_subtitle );
+ free( psz_html );
return NULL;
}
subpicture_updater_sys_t *p_spu_sys = p_spu->updater.p_sys;
- p_spu_sys->align = SUBPICTURE_ALIGN_TOP | SUBPICTURE_ALIGN_LEFT;
+ /* The "leavetext" alignment is a special mode where the subpicture
+ region itself gets aligned, but the text inside it does not */
+ p_spu_sys->align = SUBPICTURE_ALIGN_LEAVETEXT;
p_spu_sys->text = psz_subtitle;
p_spu_sys->html = psz_html;
+ p_spu_sys->i_font_height_percent = 5;
+ p_spu_sys->renderbg = true;
return p_spu;
}
/* Search the start */
i_start = 0;
+ /* Ensure we get a monospaced font (required for accurate positioning */
+ if( b_html )
+ CAT( "<tt>" );
+
/* Convert leading spaces to non-breaking so that they don't get
stripped by the RenderHtml routine as regular whitespace */
while( i_start < EIA608_SCREEN_COLUMNS && p_char[i_start] == ' ' ) {
- Eia608TextUtf8( utf8, 0x89 );
- CAT( utf8 );
- i_start++;
+ Eia608TextUtf8( utf8, 0x89 );
+ CAT( utf8 );
+ i_start++;
}
/* Search the end */
"#ff00ff", // magenta
"#ffffff", // user defined XXX we use white
};
- CAT( "<font color=" );
+ CAT( "<font color=\"" );
CAT( ppsz_color[color] );
- CAT( ">" );
+ CAT( "\">" );
}
if( ( b_close_italics && b_italics ) || ( b_italics && !b_last_italics ) )
CAT( "<i>" );
CAT( "</i>" );
if( last_color != EIA608_COLOR_DEFAULT )
CAT( "</font>" );
+ CAT( "</tt>" );
}
#undef CAT
}