X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fcodec%2Fcc.c;h=8863f1c6f5aa40afc37aa01b45729bc9251ab96c;hb=9925a34ee91b6debfc2f9f137fe9c77e7e0d6241;hp=5366fb4096532dfae970e5775fa1a6bddf5288a7;hpb=2393f44266d735bc93e2dedb7491c461834e946d;p=vlc diff --git a/modules/codec/cc.c b/modules/codec/cc.c index 5366fb4096..8863f1c6f5 100644 --- a/modules/codec/cc.c +++ b/modules/codec/cc.c @@ -327,9 +327,13 @@ static subpicture_t *Subtitle( decoder_t *p_dec, char *psz_subtitle, char *psz_h 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; } @@ -933,12 +937,16 @@ static void Eia608TextLine( struct eia608_screen *screen, char *psz_text, int i_ /* Search the start */ i_start = 0; + /* Ensure we get a monospaced font (required for accurate positioning */ + if( b_html ) + CAT( "" ); + /* 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 */ @@ -1038,6 +1046,7 @@ static void Eia608TextLine( struct eia608_screen *screen, char *psz_text, int i_ CAT( "" ); if( last_color != EIA608_COLOR_DEFAULT ) CAT( "" ); + CAT( "" ); } #undef CAT }