diff options
author | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2011-01-26 04:12:25 +0200 |
---|---|---|
committer | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2011-01-26 20:39:04 +0200 |
commit | 828af33bfefd0ddeab10f9f979a144ed3f195194 (patch) | |
tree | a1a411d45b225c7069b2e654e4cebbb66a282211 | |
parent | 304cafd31dfaeee853e138a460b7ba82e65ed420 (diff) |
subtitles: change default libass rendering style
Change the default style used for rendering plaintext subtitles with
libass. The following attributes change:
* FontSize: Increase the size multiplier used with the default
-subfont-autoscale 3 from 1.4 to 1.7, thus making the font 21%
larger. Actually implementing the -subfont-autoscale modes other
than 1 would give a multiplier of 5/3=1.67 for 4:3 aspect ratio
video, sqrt(337)/9=2.04 for 16:9.
* PrimaryColour: Change color from yellow to white.
* Outline: Before this was 2 regardless of user font size choice. Make
it FontSize/16 instead. With default font size this is about half
the previous width.
* Kerning: Enable kerning for the track. There won't be styling
designed for VSFilter's lack of kerning, and hopefully people won't
use broken fonts with bad kerning tables for the default font
either.
-rw-r--r-- | ass_mp.c | 34 |
1 files changed, 16 insertions, 18 deletions
@@ -70,8 +70,6 @@ extern char *sub_cp; static char *sub_cp = 0; #endif -void process_force_style(ASS_Track *track); - ASS_Track *mp_ass_default_track(ASS_Library *library) { ASS_Track *track = ass_new_track(library); @@ -85,13 +83,9 @@ ASS_Track *mp_ass_default_track(ASS_Library *library) ass_read_styles(track, ass_styles_file, sub_cp); if (track->n_styles == 0) { - ASS_Style *style; - int sid; - double fs; - uint32_t c1, c2; - - sid = ass_alloc_style(track); - style = track->styles + sid; + track->Kerning = true; + int sid = ass_alloc_style(track); + ASS_Style *style = track->styles + sid; style->Name = strdup("Default"); style->FontName = (font_fontconfig >= 0 && sub_font_name) ? strdup(sub_font_name) @@ -99,30 +93,34 @@ ASS_Track *mp_ass_default_track(ASS_Library *library) && font_name) ? strdup(font_name) : strdup("Sans"); style->treat_fontname_as_pattern = 1; - fs = track->PlayResY * text_font_scale_factor / 100.; - // approximate autoscale coefficients + double fs = track->PlayResY * text_font_scale_factor / 100.; + /* The font size is always proportional to video height only; + * real -subfont-autoscale behavior is not implemented. + * Apply a correction that corresponds to about 4:3 aspect ratio + * video to get a size somewhat closer to what non-libass rendering + * would produce with the same text_font_scale_factor + * and subtitle_autoscale. + */ if (subtitle_autoscale == 2) fs *= 1.3; else if (subtitle_autoscale == 3) - fs *= 1.4; - style->FontSize = fs; + fs *= 1.7; + uint32_t c1 = 0xFFFFFF00; + uint32_t c2 = 0x00000000; if (ass_color) c1 = strtoll(ass_color, NULL, 16); - else - c1 = 0xFFFF0000; if (ass_border_color) c2 = strtoll(ass_border_color, NULL, 16); - else - c2 = 0x00000000; + style->FontSize = fs; style->PrimaryColour = c1; style->SecondaryColour = c1; style->OutlineColour = c2; style->BackColour = 0x00000000; style->BorderStyle = 1; style->Alignment = 2; - style->Outline = 2; + style->Outline = fs / 16; style->MarginL = 10; style->MarginR = 10; style->MarginV = 5; |