From 1452355de99d22b0cba6ccc17bf5cdf3682ef61e Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Thu, 18 Jul 2024 09:31:19 +0200 Subject: [PATCH] * src/truetype/ttobjs.c (tt_size_run_prep): Correct scaling of CVT values. This reverts the scaling behaviour introduced in commit 37580053. Fixes issue #1005. --- src/truetype/ttobjs.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/truetype/ttobjs.c b/src/truetype/ttobjs.c index 08aee62a8..d0ac31812 100644 --- a/src/truetype/ttobjs.c +++ b/src/truetype/ttobjs.c @@ -994,16 +994,16 @@ FT_Error error; FT_UInt i; - /* unscaled CVT values are already stored in 26.6 format */ - FT_Fixed scale = size->ttmetrics.scale >> 6; - /* Scale the cvt values to the new ppem. */ /* By default, we use the y ppem value for scaling. */ FT_TRACE6(( "CVT values:\n" )); for ( i = 0; i < size->cvt_size; i++ ) { - size->cvt[i] = FT_MulFix( face->cvt[i], scale ); + /* Unscaled CVT values are already stored in 26.6 format. */ + /* Note that this scaling operation is very sensitive to rounding; */ + /* the integer division by 64 must be applied to the first argument. */ + size->cvt[i] = FT_MulFix( face->cvt[i] / 64, size->ttmetrics.scale ); FT_TRACE6(( " %3d: %f (%f)\n", i, (double)face->cvt[i] / 64, (double)size->cvt[i] / 64 )); }