summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOleg Oshmyan <chortos@inbox.lv>2012-11-22 02:19:17 +0000
committerOleg Oshmyan <chortos@inbox.lv>2012-12-28 18:54:27 +0200
commit91b0e50da385723853969b2d3814b70d21a36077 (patch)
treec9241fde30ad6a31f1a6986e22b9ab229a680b0d
parent7e4553211048d0cdf5f23fb7532e2d619f6edccb (diff)
downloadlibass-91b0e50da385723853969b2d3814b70d21a36077.tar.bz2
libass-91b0e50da385723853969b2d3814b70d21a36077.tar.xz
Fix fix_freetype_stroker
The first point in a countour is not allowed to be a cubic control point, which is sometimes violated by blindly reversing a countour, producing the following errors: [ass] FT_Stroker_ParseOutline failed, error: 20 [ass] Failed to rasterize glyph: 1 To avoid this, let the first point remain the first and only reverse the order of the remaining points.
-rw-r--r--libass/ass_font.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/libass/ass_font.c b/libass/ass_font.c
index 92a2eff..6840e2f 100644
--- a/libass/ass_font.c
+++ b/libass/ass_font.c
@@ -711,12 +711,12 @@ void fix_freetype_stroker(FT_Outline *outline, int border_x, int border_y)
/* "inside" contour but we can't find anything it could be
* inside of - assume the font is buggy and it should be
* an "outside" contour, and reverse it */
- for (j = 0; j < (end + 1 - start) / 2; j++) {
- FT_Vector temp = outline->points[start + j];
- char temp2 = outline->tags[start + j];
- outline->points[start + j] = outline->points[end - j];
+ for (j = 0; j < (end - start) / 2; j++) {
+ FT_Vector temp = outline->points[start + 1 + j];
+ char temp2 = outline->tags[start + 1 + j];
+ outline->points[start + 1 + j] = outline->points[end - j];
outline->points[end - j] = temp;
- outline->tags[start + j] = outline->tags[end - j];
+ outline->tags[start + 1 + j] = outline->tags[end - j];
outline->tags[end - j] = temp2;
}
dir ^= 1;