]> granicus.if.org Git - libass/commitdiff
Fix layout with fsp/fay features enabled
authorGrigori Goronzy <greg@blackbox>
Wed, 13 Jul 2011 20:03:57 +0000 (22:03 +0200)
committerGrigori Goronzy <greg@blackbox>
Wed, 13 Jul 2011 20:03:57 +0000 (22:03 +0200)
libass/ass_render.c

index 3c8fcb6bfd69724aa4694257dd4aed2f67e36678..81dadb928d6773566051982b7016b0e4815dc522 100644 (file)
@@ -1849,13 +1849,12 @@ ass_render_event(ASS_Renderer *render_priv, ASS_Event *event,
         }
         info = glyphs + i;
 
-        // add displacement for vertical shearing
-        info->cluster_advance.y += (info->fay * info->scale_y) * info->cluster_advance.x;
-
         // add horizontal letter spacing
         info->cluster_advance.x += double_to_d6(render_priv->state.hspacing *
                 render_priv->font_scale * info->scale_x);
 
+        // add displacement for vertical shearing
+        info->cluster_advance.y += (info->fay * info->scale_y) * info->cluster_advance.x;
     }
 
     // Preliminary layout (for line wrapping)
@@ -1969,6 +1968,10 @@ ass_render_event(ASS_Renderer *render_priv, ASS_Event *event,
         double width = 0;
         for (i = 0; i <= text_info->length; ++i) {   // (text_info->length + 1) is the end of the last line
             if ((i == text_info->length) || glyphs[i].linebreak) {
+                // remove letter spacing (which is included in cluster_advance)
+                if (i > 0)
+                    width -= render_priv->state.hspacing * render_priv->font_scale *
+                        glyphs[i-1].scale_x;
                 double shift = 0;
                 if (halign == HALIGN_LEFT) {    // left aligned, no action
                     shift = 0;