freetype-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[freetype2] cvt-scaling 1452355de: * src/truetype/ttobjs.c (tt_size_run_


From: Werner Lemberg
Subject: [freetype2] cvt-scaling 1452355de: * src/truetype/ttobjs.c (tt_size_run_prep): Correct scaling of CVT values.
Date: Fri, 19 Jul 2024 16:37:49 -0400 (EDT)

branch: cvt-scaling
commit 1452355de99d22b0cba6ccc17bf5cdf3682ef61e
Author: Werner Lemberg <wl@gnu.org>
Commit: Werner Lemberg <wl@gnu.org>

    * 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 ));
     }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]