freetype-devel
[Top][All Lists]
Advanced

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

[ft-devel] different stem darkening


From: Alexei Podtelezhnikov
Subject: [ft-devel] different stem darkening
Date: Fri, 8 Sep 2017 22:21:06 -0400

Hi Nikolaus,

As a prove of concept, I tried a different approach to stem darkening,
see below. I just slapped in an adjustment of thin stem width where
the autohinter modifies them. The functional form is what I would call
smooth with most adjustment by about 1/4 between 1/2 and 1. It seems
to work.

Best,
Alexei

diff --git a/src/autofit/aflatin.c b/src/autofit/aflatin.c
index cdbc1b7..8d8de0e 100644
--- a/src/autofit/aflatin.c
+++ b/src/autofit/aflatin.c
@@ -2682,16 +2682,16 @@
     FT_Int           vertical = ( dim == AF_DIMENSION_VERT );


-    if ( !AF_LATIN_HINTS_DO_STEM_ADJUST( hints ) ||
-         axis->extra_light                       )
-      return width;
-
     if ( dist < 0 )
     {
       dist = -width;
       sign = 1;
     }

+    if ( !AF_LATIN_HINTS_DO_STEM_ADJUST( hints ) ||
+         axis->extra_light                       )
+      goto Done_Width;
+
     if ( (  vertical && !AF_LATIN_HINTS_DO_VERT_SNAP( hints ) ) ||
          ( !vertical && !AF_LATIN_HINTS_DO_HORZ_SNAP( hints ) ) )
     {
@@ -2855,6 +2855,11 @@
     }

   Done_Width:
+
+    /* XXX: stem darkening */
+    if ( dist < 96 )
+       dist += dist * ( 96 - dist ) / 128;
+
     if ( sign )
       dist = -dist;



reply via email to

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