summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-10-24 13:04:48 +0200
committerwm4 <wm4@nowhere>2013-10-24 13:04:48 +0200
commit516f0eadac78255df58368d2c9cb9b200ae0ff64 (patch)
treee94315a754ea1f15c5a3fdd9b300702d37cbd0cd
parentdacfe5efa293b6e0d41a8b3154626a9fa54c2ffa (diff)
downloadlibass-516f0eadac78255df58368d2c9cb9b200ae0ff64.tar.bz2
libass-516f0eadac78255df58368d2c9cb9b200ae0ff64.tar.xz
Reset text origin on \fay changes for VSFilter compatibility
Comparing this rendering of this line: {\fnTahoma\c&H000000&\fs100\an7\fay0.115\pos(240,250)}——————–>{\fay0.0}——> To this line: {\fnTahoma\c&H000000&\fs100\an7\fay0.0\pos(240,250)}——————–>{\fay0.0}——> The second arrow is in the same place for both lines when using VSFilter, but the origin of the second shear is different when using libass. After every change in \fay or a newline, the vertical offset resets to 0. Fixes issue #80. Bug report and patch by BwackNinja (BwackNi...@gmail.com) (this commit corresponds to the patch issue_80_3.patch)
-rw-r--r--libass/ass_render.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/libass/ass_render.c b/libass/ass_render.c
index 78fd003..3923e52 100644
--- a/libass/ass_render.c
+++ b/libass/ass_render.c
@@ -1962,16 +1962,23 @@ ass_render_event(ASS_Renderer *render_priv, ASS_Event *event,
pen.x = 0;
pen.y = 0;
int lineno = 1;
+ double last_pen_x = 0;
+ double last_fay = 0;
for (i = 0; i < text_info->length; i++) {
GlyphInfo *info = glyphs + cmap[i];
if (glyphs[i].linebreak) {
- pen.y -= (info->fay / info->scale_x * info->scale_y) * pen.x;
- pen.x = 0;
+ pen.y -= (last_fay / info->scale_x * info->scale_y) * (pen.x - last_pen_x);
+ last_pen_x = pen.x = 0;
pen.y += double_to_d6(text_info->lines[lineno-1].desc);
pen.y += double_to_d6(text_info->lines[lineno].asc);
pen.y += double_to_d6(render_priv->settings.line_spacing);
lineno++;
}
+ else if (last_fay != info->fay) {
+ pen.y -= (last_fay / info->scale_x * info->scale_y) * (pen.x - last_pen_x);
+ last_pen_x = pen.x;
+ }
+ last_fay = info->fay;
if (info->skip) continue;
FT_Vector cluster_pen = pen;
while (info) {