summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOleg Oshmyan <chortos@inbox.lv>2014-01-07 15:32:05 +0200
committerOleg Oshmyan <chortos@inbox.lv>2014-01-08 03:18:55 +0200
commit97b157f5625b4d4caf50309a20e7da09f7464d8c (patch)
treee2327da16545915953d8dfab7877d348e5b14395
parentde69ffc0367b4fa447cbe1c14d31d9ac7ef00c4e (diff)
downloadlibass-97b157f5625b4d4caf50309a20e7da09f7464d8c.tar.bz2
libass-97b157f5625b4d4caf50309a20e7da09f7464d8c.tar.xz
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.
-rw-r--r--libass/ass_drawing.c12
1 files 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;
}
/*