]> granicus.if.org Git - libass/commitdiff
Fix two-pass stroking for \xbord, \ybord
authorGrigori Goronzy <greg@blackbox>
Mon, 29 Jun 2009 03:19:40 +0000 (05:19 +0200)
committerGrigori Goronzy <greg@blackbox>
Mon, 29 Jun 2009 03:23:49 +0000 (05:23 +0200)
The two-pass stroker blindly assumed that the number of points of
the stroked glyph is the same, no matter the size of the stroker.
Unfortunately, this is not the case every time.  In such cases, the
coordinates will only be replaced up to mininum of points of both
glyphs.  It's incredibly hacky, but seems to work well (and look good).

libass/ass_render.c

index 86dfd3d57d6ce7e0151c879980f33e323ce35702..d3d53e40c4cc7980f696f54521e9114f86ded82e 100644 (file)
@@ -1799,7 +1799,7 @@ get_outline_glyph(ass_renderer_t *render_priv, int symbol,
 
             // 2nd pass if x/y borders are different
             if (render_priv->state.border_x != render_priv->state.border_y) {
-                int i;
+                int i, m;
                 FT_Glyph g;
                 FT_OutlineGlyph go, gi;
 
@@ -1814,7 +1814,8 @@ get_outline_glyph(ass_renderer_t *render_priv, int symbol,
                 // Replace x coordinates
                 go = (FT_OutlineGlyph) info->outline_glyph;
                 gi = (FT_OutlineGlyph) g;
-                for (i = 0; i < go->outline.n_points; i++)
+                m = FFMIN(go->outline.n_points, gi->outline.n_points);
+                for (i = 0; i < m; i++)
                     go->outline.points[i].x = gi->outline.points[i].x;
                 FT_Done_Glyph(g);
             }