freetype-commit
[Top][All Lists]
Advanced

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

[freetype2] master 7bed7a02f: Fix some `FT_Fixed` vs. `FT_Long` confusio


From: Werner Lemberg
Subject: [freetype2] master 7bed7a02f: Fix some `FT_Fixed` vs. `FT_Long` confusion.
Date: Sat, 3 Jun 2023 01:09:28 -0400 (EDT)

branch: master
commit 7bed7a02f4bfbfe2a47efb4d06b9c02fdb83b758
Author: Ben Wagner <bungeman@chromium.org>
Commit: Werner Lemberg <wl@gnu.org>

    Fix some `FT_Fixed` vs. `FT_Long` confusion.
    
    `FT_Fixed` and `FT_Long` are both typedef'ed to be `signed long`.  However,
    `FT_Fixed` implies that the lower 16 bits are being used to express
    fractional values and so these two types should not be confused.
    
    * include/freetype/internal/services/svmm.h (FT_Set_MM_Blend_Func): Use
    `FT_Fixed` for `coords`.  Users are passing `FT_Fixed` and implementations
    are taking `FT_Fixed`.
    (FT_Get_MM_Blend_Func): Ditto.
    
    * src/autofit/afcjk.c (af_cjk_metrics_check_digits): Use `FT_Long` for
    `advance` and `old_advance`.  `advance`'s address is passed as `FT_Long*` to
    `af_shaper_get_elem`, which writes the advance in em units (not fixed).  The
    exact value is not important here as it is only compared to check whether it
    has changed.
    
    * src/autofit/aflatin.c (af_latin_metrics_check_digits): Ditto.
---
 include/freetype/internal/services/svmm.h | 12 ++++++------
 src/autofit/afcjk.c                       |  4 ++--
 src/autofit/aflatin.c                     |  4 ++--
 3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/include/freetype/internal/services/svmm.h 
b/include/freetype/internal/services/svmm.h
index 982bb47db..7e76ab832 100644
--- a/include/freetype/internal/services/svmm.h
+++ b/include/freetype/internal/services/svmm.h
@@ -60,9 +60,9 @@ FT_BEGIN_HEADER
   /* use return value -1 to indicate that the new coordinates  */
   /* are equal to the current ones; no changes are thus needed */
   typedef FT_Error
-  (*FT_Set_MM_Blend_Func)( FT_Face   face,
-                           FT_UInt   num_coords,
-                           FT_Long*  coords );
+  (*FT_Set_MM_Blend_Func)( FT_Face    face,
+                           FT_UInt    num_coords,
+                           FT_Fixed*  coords );
 
   typedef FT_Error
   (*FT_Get_Var_Design_Func)( FT_Face    face,
@@ -78,9 +78,9 @@ FT_BEGIN_HEADER
                                          FT_UInt  *instance_index );
 
   typedef FT_Error
-  (*FT_Get_MM_Blend_Func)( FT_Face   face,
-                           FT_UInt   num_coords,
-                           FT_Long*  coords );
+  (*FT_Get_MM_Blend_Func)( FT_Face    face,
+                           FT_UInt    num_coords,
+                           FT_Fixed*  coords );
 
   typedef FT_Error
   (*FT_Get_Var_Blend_Func)( FT_Face      face,
diff --git a/src/autofit/afcjk.c b/src/autofit/afcjk.c
index 3466bb9f9..af775b190 100644
--- a/src/autofit/afcjk.c
+++ b/src/autofit/afcjk.c
@@ -567,8 +567,8 @@
   af_cjk_metrics_check_digits( AF_CJKMetrics  metrics,
                                FT_Face        face )
   {
-    FT_Bool   started = 0, same_width = 1;
-    FT_Fixed  advance = 0, old_advance = 0;
+    FT_Bool  started = 0, same_width = 1;
+    FT_Long  advance = 0, old_advance = 0;
 
     /* If HarfBuzz is not available, we need a pointer to a single */
     /* unsigned long value.                                        */
diff --git a/src/autofit/aflatin.c b/src/autofit/aflatin.c
index 6f672d593..46c6e450a 100644
--- a/src/autofit/aflatin.c
+++ b/src/autofit/aflatin.c
@@ -1065,8 +1065,8 @@
   af_latin_metrics_check_digits( AF_LatinMetrics  metrics,
                                  FT_Face          face )
   {
-    FT_Bool   started = 0, same_width = 1;
-    FT_Fixed  advance = 0, old_advance = 0;
+    FT_Bool  started = 0, same_width = 1;
+    FT_Long  advance = 0, old_advance = 0;
 
     /* If HarfBuzz is not available, we need a pointer to a single */
     /* unsigned long value.                                        */



reply via email to

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