mirror of https://github.com/mpv-player/mpv
Correct implementation of text spacing.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@22277 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
beaa890438
commit
39c818a551
|
@ -352,7 +352,7 @@ void process_force_style(ass_track_t* track) {
|
||||||
INTVAL(Italic)
|
INTVAL(Italic)
|
||||||
INTVAL(Underline)
|
INTVAL(Underline)
|
||||||
INTVAL(StrikeOut)
|
INTVAL(StrikeOut)
|
||||||
INTVAL(Spacing)
|
FPVAL(Spacing)
|
||||||
INTVAL(Angle)
|
INTVAL(Angle)
|
||||||
INTVAL(BorderStyle)
|
INTVAL(BorderStyle)
|
||||||
INTVAL(Alignment)
|
INTVAL(Alignment)
|
||||||
|
@ -440,7 +440,7 @@ static int process_style(ass_track_t* track, char *str)
|
||||||
INTVAL(Italic)
|
INTVAL(Italic)
|
||||||
INTVAL(Underline)
|
INTVAL(Underline)
|
||||||
INTVAL(StrikeOut)
|
INTVAL(StrikeOut)
|
||||||
INTVAL(Spacing)
|
FPVAL(Spacing)
|
||||||
INTVAL(Angle)
|
INTVAL(Angle)
|
||||||
INTVAL(BorderStyle)
|
INTVAL(BorderStyle)
|
||||||
INTVAL(Alignment)
|
INTVAL(Alignment)
|
||||||
|
|
|
@ -150,7 +150,7 @@ typedef struct render_context_s {
|
||||||
int org_x, org_y; // origin
|
int org_x, org_y; // origin
|
||||||
char have_origin; // origin is explicitly defined; if 0, get_base_point() is used
|
char have_origin; // origin is explicitly defined; if 0, get_base_point() is used
|
||||||
double scale_x, scale_y;
|
double scale_x, scale_y;
|
||||||
int hspacing; // distance between letters, in pixels
|
double hspacing; // distance between letters, in pixels
|
||||||
double border; // outline width
|
double border; // outline width
|
||||||
uint32_t c[4]; // colors(Primary, Secondary, so on) in RGBA
|
uint32_t c[4]; // colors(Primary, Secondary, so on) in RGBA
|
||||||
int clip_x0, clip_y0, clip_x1, clip_y1;
|
int clip_x0, clip_y0, clip_x1, clip_y1;
|
||||||
|
@ -713,11 +713,11 @@ static char* parse_tag(char* p, double pwr) {
|
||||||
render_context.scale_y = render_context.style->ScaleY;
|
render_context.scale_y = render_context.style->ScaleY;
|
||||||
}
|
}
|
||||||
} else if (mystrcmp(&p, "fsp")) {
|
} else if (mystrcmp(&p, "fsp")) {
|
||||||
int val;
|
double val;
|
||||||
if (mystrtoi(&p, 10, &val))
|
if (mystrtod(&p, &val))
|
||||||
render_context.hspacing = val * pwr;
|
render_context.hspacing = render_context.hspacing * ( 1 - pwr ) + val * pwr;
|
||||||
else
|
else
|
||||||
render_context.hspacing = 0;
|
render_context.hspacing = render_context.style->Spacing;
|
||||||
} else if (mystrcmp(&p, "fs")) {
|
} else if (mystrcmp(&p, "fs")) {
|
||||||
int val;
|
int val;
|
||||||
if (mystrtoi(&p, 10, &val))
|
if (mystrtoi(&p, 10, &val))
|
||||||
|
@ -1158,7 +1158,7 @@ static void reset_render_context(void)
|
||||||
change_border(-1.);
|
change_border(-1.);
|
||||||
render_context.scale_x = render_context.style->ScaleX;
|
render_context.scale_x = render_context.style->ScaleX;
|
||||||
render_context.scale_y = render_context.style->ScaleY;
|
render_context.scale_y = render_context.style->ScaleY;
|
||||||
render_context.hspacing = 0; // FIXME
|
render_context.hspacing = render_context.style->Spacing;
|
||||||
render_context.be = 0;
|
render_context.be = 0;
|
||||||
render_context.shadow = render_context.style->Shadow;
|
render_context.shadow = render_context.style->Shadow;
|
||||||
render_context.frx = render_context.fry = 0.;
|
render_context.frx = render_context.fry = 0.;
|
||||||
|
@ -1711,7 +1711,7 @@ static int ass_render_event(ass_event_t* event, event_images_t* event_images)
|
||||||
text_info.glyphs[text_info.length].pos.y = d6_to_int(pen.y);
|
text_info.glyphs[text_info.length].pos.y = d6_to_int(pen.y);
|
||||||
|
|
||||||
pen.x += text_info.glyphs[text_info.length].advance.x;
|
pen.x += text_info.glyphs[text_info.length].advance.x;
|
||||||
pen.x += render_context.hspacing;
|
pen.x += double_to_d6(render_context.hspacing);
|
||||||
pen.y += text_info.glyphs[text_info.length].advance.y;
|
pen.y += text_info.glyphs[text_info.length].advance.y;
|
||||||
|
|
||||||
// if it's an outline glyph, we still need to fill the bbox
|
// if it's an outline glyph, we still need to fill the bbox
|
||||||
|
|
|
@ -43,7 +43,7 @@ typedef struct ass_style_s {
|
||||||
int StrikeOut;
|
int StrikeOut;
|
||||||
double ScaleX;
|
double ScaleX;
|
||||||
double ScaleY;
|
double ScaleY;
|
||||||
int Spacing;
|
double Spacing;
|
||||||
int Angle;
|
int Angle;
|
||||||
int BorderStyle;
|
int BorderStyle;
|
||||||
double Outline;
|
double Outline;
|
||||||
|
|
Loading…
Reference in New Issue