From 97b157f5625b4d4caf50309a20e7da09f7464d8c Mon Sep 17 00:00:00 2001 From: Oleg Oshmyan Date: Tue, 7 Jan 2014 15:32:05 +0200 Subject: [PATCH] Fix \pbo b61d260b attempted to add support for \p scaling to \pbo. However, while it fixed the exact sample originally reported, it broke \pbo with other \p values, including \p1, by confusing the direction of scaling and the units in which \pbo is measured. In addition, the descenders assigned to drawings have always had a wrong sign, causing lines that contain drawings with \pbo to be shifted in the wrong direction: negative \pbo raised bottom- aligned lines, while positive \pbo lowered top-aligned lines. All errors and fixes have been confirmed with VSFilter. --- libass/ass_drawing.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/libass/ass_drawing.c b/libass/ass_drawing.c index 03eb568..32a3803 100644 --- a/libass/ass_drawing.c +++ b/libass/ass_drawing.c @@ -86,7 +86,7 @@ static void drawing_prepare(ASS_Drawing *drawing) */ static void drawing_finish(ASS_Drawing *drawing, int raw_mode) { - int i, offset; + int i; double pbo; FT_BBox bbox = drawing->cbox; FT_Outline *ol = &drawing->outline; @@ -104,15 +104,13 @@ static void drawing_finish(ASS_Drawing *drawing, int raw_mode) drawing->advance.x = bbox.xMax - bbox.xMin; - pbo = drawing->pbo / (64.0 / (1 << (drawing->scale - 1))); - drawing->desc = double_to_d6(-pbo * drawing->scale_y); - drawing->asc = bbox.yMax - bbox.yMin + drawing->desc; + pbo = drawing->pbo / (1 << (drawing->scale - 1)); + drawing->desc = double_to_d6(pbo * drawing->scale_y); + drawing->asc = bbox.yMax - bbox.yMin - drawing->desc; // Place it onto the baseline - offset = (bbox.yMax - bbox.yMin) + double_to_d6(-pbo * - drawing->scale_y); for (i = 0; i < ol->n_points; i++) - ol->points[i].y += offset; + ol->points[i].y += drawing->asc; } /* -- 2.40.0