diff options
author | Chris Liddell <chris.liddell@artifex.com> | 2023-03-29 16:36:40 +0100 |
---|---|---|
committer | Chris Liddell <chris.liddell@artifex.com> | 2023-03-29 16:56:00 +0100 |
commit | 7745bc9ed8be0692f798fae8c0d033e948af22dd (patch) | |
tree | d919f91f794ba34492159201ffbc606f3602bf37 /base | |
parent | bf6dab625243b502b0aee022b651e4dc365e66b5 (diff) | |
download | ghostpdl-7745bc9ed8be0692f798fae8c0d033e948af22dd.tar.gz |
Bug 706522: Fix scale rounding in the FAPI interface codeghostpdl-10.02.0-test-base-001
Where we combine and convert the font matrix and CTM scaling to pass through
the FAPI interface, we were always rounding values "up", meaning negative scale
values could rounded in the "wrong" direction, losing magnitude and hence
causing unintended drop-outs at very small scales.
Diffstat (limited to 'base')
-rw-r--r-- | base/gxfapi.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/base/gxfapi.c b/base/gxfapi.c index d4ecc4a58..b4de272a1 100644 --- a/base/gxfapi.c +++ b/base/gxfapi.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2001-2021 Artifex Software, Inc. +/* Copyright (C) 2001-2023 Artifex Software, Inc. All Rights Reserved. This software is provided AS-IS with no warranty, either express or @@ -37,6 +37,9 @@ #include "gxfapi.h" +#define FAPI_ROUND(v) (v >= 0 ? v + 0.5 : v - 0.5) +#define FAPI_ROUND_TO_FRACINT(v) ((fracint)FAPI_ROUND(v)) + extern_gs_get_fapi_server_inits(); /* FIXME */ @@ -1396,12 +1399,12 @@ retry_scaling: goto retry_scaling; } else { - font_scale.matrix[0] = (fracint) (scale_mat.xx * FontMatrix_div * scale + 0.5); - font_scale.matrix[1] = -(fracint) (scale_mat.xy * FontMatrix_div * scale + 0.5); - font_scale.matrix[2] = (fracint) (scale_mat.yx * FontMatrix_div * scale + 0.5); - font_scale.matrix[3] = -(fracint) (scale_mat.yy * FontMatrix_div * scale + 0.5); - font_scale.matrix[4] = (fracint) (scale_mat.tx * FontMatrix_div * scale + 0.5); - font_scale.matrix[5] = (fracint) (scale_mat.ty * FontMatrix_div * scale + 0.5); + font_scale.matrix[0] = FAPI_ROUND_TO_FRACINT(scale_mat.xx * FontMatrix_div * scale); + font_scale.matrix[1] = -FAPI_ROUND_TO_FRACINT(scale_mat.xy * FontMatrix_div * scale); + font_scale.matrix[2] = FAPI_ROUND_TO_FRACINT(scale_mat.yx * FontMatrix_div * scale); + font_scale.matrix[3] = -FAPI_ROUND_TO_FRACINT(scale_mat.yy * FontMatrix_div * scale); + font_scale.matrix[4] = FAPI_ROUND_TO_FRACINT(scale_mat.tx * FontMatrix_div * scale); + font_scale.matrix[5] = FAPI_ROUND_TO_FRACINT(scale_mat.ty * FontMatrix_div * scale); } /* Note: the ctm mapping here is upside down. */ |