summaryrefslogtreecommitdiffstats
path: root/libass
diff options
context:
space:
mode:
authoreugeni <eugeni@b3059339-0415-0410-9bf9-f77b7e298cf2>2007-02-19 18:01:49 +0000
committereugeni <eugeni@b3059339-0415-0410-9bf9-f77b7e298cf2>2007-02-19 18:01:49 +0000
commit39c818a5514581145328ab03863701d2a975821d (patch)
tree01995f672eec1268c86b6fb6dcc360b402c85a68 /libass
parentbeaa890438c4ce54487c1194bf0b08652361ccf9 (diff)
downloadmpv-39c818a5514581145328ab03863701d2a975821d.tar.bz2
mpv-39c818a5514581145328ab03863701d2a975821d.tar.xz
Correct implementation of text spacing.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@22277 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libass')
-rw-r--r--libass/ass.c4
-rw-r--r--libass/ass_render.c14
-rw-r--r--libass/ass_types.h2
3 files changed, 10 insertions, 10 deletions
diff --git a/libass/ass.c b/libass/ass.c
index d2c9523c7e..f071a3b6bb 100644
--- a/libass/ass.c
+++ b/libass/ass.c
@@ -352,7 +352,7 @@ void process_force_style(ass_track_t* track) {
INTVAL(Italic)
INTVAL(Underline)
INTVAL(StrikeOut)
- INTVAL(Spacing)
+ FPVAL(Spacing)
INTVAL(Angle)
INTVAL(BorderStyle)
INTVAL(Alignment)
@@ -440,7 +440,7 @@ static int process_style(ass_track_t* track, char *str)
INTVAL(Italic)
INTVAL(Underline)
INTVAL(StrikeOut)
- INTVAL(Spacing)
+ FPVAL(Spacing)
INTVAL(Angle)
INTVAL(BorderStyle)
INTVAL(Alignment)
diff --git a/libass/ass_render.c b/libass/ass_render.c
index 1aac8afd51..ac0078e090 100644
--- a/libass/ass_render.c
+++ b/libass/ass_render.c
@@ -150,7 +150,7 @@ typedef struct render_context_s {
int org_x, org_y; // origin
char have_origin; // origin is explicitly defined; if 0, get_base_point() is used
double scale_x, scale_y;
- int hspacing; // distance between letters, in pixels
+ double hspacing; // distance between letters, in pixels
double border; // outline width
uint32_t c[4]; // colors(Primary, Secondary, so on) in RGBA
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;
}
} else if (mystrcmp(&p, "fsp")) {
- int val;
- if (mystrtoi(&p, 10, &val))
- render_context.hspacing = val * pwr;
+ double val;
+ if (mystrtod(&p, &val))
+ render_context.hspacing = render_context.hspacing * ( 1 - pwr ) + val * pwr;
else
- render_context.hspacing = 0;
+ render_context.hspacing = render_context.style->Spacing;
} else if (mystrcmp(&p, "fs")) {
int val;
if (mystrtoi(&p, 10, &val))
@@ -1158,7 +1158,7 @@ static void reset_render_context(void)
change_border(-1.);
render_context.scale_x = render_context.style->ScaleX;
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.shadow = render_context.style->Shadow;
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);
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;
// if it's an outline glyph, we still need to fill the bbox
diff --git a/libass/ass_types.h b/libass/ass_types.h
index 2e3d5b5293..e39a245531 100644
--- a/libass/ass_types.h
+++ b/libass/ass_types.h
@@ -43,7 +43,7 @@ typedef struct ass_style_s {
int StrikeOut;
double ScaleX;
double ScaleY;
- int Spacing;
+ double Spacing;
int Angle;
int BorderStyle;
double Outline;