freetype-commit
[Top][All Lists]
Advanced

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

[freetype2] master c1278179d: * src/cff/cffgload.c (cff_slot_load): Fix


From: Werner Lemberg
Subject: [freetype2] master c1278179d: * src/cff/cffgload.c (cff_slot_load): Fix autohinter scaling.
Date: Wed, 7 May 2025 18:00:34 -0400 (EDT)

branch: master
commit c1278179dc4d162e7f49d91e3fc40fde8fcfa539
Author: Alexei Podtelezhnikov <apodtele@gmail.com>
Commit: Alexei Podtelezhnikov <apodtele@gmail.com>

    * src/cff/cffgload.c (cff_slot_load): Fix autohinter scaling.
    
    Fixes #1330.
---
 src/cff/cffgload.c | 32 ++++++++++++++++++++------------
 1 file changed, 20 insertions(+), 12 deletions(-)

diff --git a/src/cff/cffgload.c b/src/cff/cffgload.c
index 1abee3aec..208ac98ba 100644
--- a/src/cff/cffgload.c
+++ b/src/cff/cffgload.c
@@ -408,12 +408,28 @@
 
 #endif /* FT_CONFIG_OPTION_SVG */
 
+    /* top-level code ensures that FT_LOAD_NO_HINTING is set */
+    /* if FT_LOAD_NO_SCALE is active                         */
+    hinting = FT_BOOL( ( load_flags & FT_LOAD_NO_HINTING ) == 0 );
+    scaled  = FT_BOOL( ( load_flags & FT_LOAD_NO_SCALE   ) == 0 );
+
+    glyph->hint        = hinting;
+    glyph->scaled      = scaled;
+
+    if ( scaled )
+    {
+      glyph->x_scale = size->root.metrics.x_scale;
+      glyph->y_scale = size->root.metrics.y_scale;
+    }
+    else
+    {
+      glyph->x_scale = 0x10000L;
+      glyph->y_scale = 0x10000L;
+    }
+
     /* if we have a CID subfont, use its matrix (which has already */
     /* been multiplied with the root matrix)                       */
 
-    glyph->x_scale = size->root.metrics.x_scale;
-    glyph->y_scale = size->root.metrics.y_scale;
-
     /* this scaling is only relevant if the PS hinter isn't active */
     if ( cff->num_subfonts )
     {
@@ -445,14 +461,6 @@
       font_offset = cff->top_font.font_dict.font_offset;
     }
 
-    /* top-level code ensures that FT_LOAD_NO_HINTING is set */
-    /* if FT_LOAD_NO_SCALE is active                         */
-    hinting = FT_BOOL( ( load_flags & FT_LOAD_NO_HINTING ) == 0 );
-    scaled  = FT_BOOL( ( load_flags & FT_LOAD_NO_SCALE   ) == 0 );
-
-    glyph->hint        = hinting;
-    glyph->scaled      = scaled;
-
     {
 #ifdef CFF_CONFIG_OPTION_OLD_ENGINE
       PS_Driver  driver = (PS_Driver)FT_FACE_DRIVER( face );
@@ -687,7 +695,7 @@
           metrics->vertAdvance += font_offset.y;
         }
 
-        if ( ( load_flags & FT_LOAD_NO_SCALE ) == 0 || force_scaling )
+        if ( scaled || force_scaling )
         {
           /* scale the outline and the metrics */
           FT_Int       n;



reply via email to

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