[MPlayer-cvslog] r22277 - in trunk/libass: ass.c ass_render.c ass_types.h

eugeni subversion at mplayerhq.hu
Mon Feb 19 19:01:49 CET 2007


Author: eugeni
Date: Mon Feb 19 19:01:49 2007
New Revision: 22277

Modified:
   trunk/libass/ass.c
   trunk/libass/ass_render.c
   trunk/libass/ass_types.h

Log:
Correct implementation of text spacing.


Modified: trunk/libass/ass.c
==============================================================================
--- trunk/libass/ass.c	(original)
+++ trunk/libass/ass.c	Mon Feb 19 19:01:49 2007
@@ -352,7 +352,7 @@
 					INTVAL(Italic)
 					INTVAL(Underline)
 					INTVAL(StrikeOut)
-					INTVAL(Spacing)
+					FPVAL(Spacing)
 					INTVAL(Angle)
 					INTVAL(BorderStyle)
 					INTVAL(Alignment)
@@ -440,7 +440,7 @@
 			INTVAL(Italic)
 			INTVAL(Underline)
 			INTVAL(StrikeOut)
-			INTVAL(Spacing)
+			FPVAL(Spacing)
 			INTVAL(Angle)
 			INTVAL(BorderStyle)
 			INTVAL(Alignment)

Modified: trunk/libass/ass_render.c
==============================================================================
--- trunk/libass/ass_render.c	(original)
+++ trunk/libass/ass_render.c	Mon Feb 19 19:01:49 2007
@@ -150,7 +150,7 @@
 	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 @@
 				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 @@
 	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 @@
 		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

Modified: trunk/libass/ass_types.h
==============================================================================
--- trunk/libass/ass_types.h	(original)
+++ trunk/libass/ass_types.h	Mon Feb 19 19:01:49 2007
@@ -43,7 +43,7 @@
 	int StrikeOut;
 	double ScaleX;
 	double ScaleY;
-	int Spacing;
+	double Spacing;
 	int Angle;
 	int BorderStyle;
 	double Outline;



More information about the MPlayer-cvslog mailing list