shithub: freetype+ttf2subf

Download patch

ref: 89d4e4bd9a4fccd6a40373727ef1f667a3bd8cb2
parent: 7d62f526fed7aebbe63421a54311792da0e62ff8
author: Werner Lemberg <[email protected]>
date: Sat Jun 5 02:27:08 EDT 2004

* src/autofit/afloader.c (af_loader_load_g): Set `lsb_delta' and
`rsb_delta' in slot->metrics and tune side bearings slightly.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2004-06-05  Werner Lemberg  <[email protected]>
+
+	* src/autofit/afloader.c (af_loader_load_g): Set `lsb_delta' and
+	`rsb_delta' in slot->metrics and tune side bearings slightly.
+
 2004-06-04  Werner Lemberg  <[email protected]>
 
 	* docs/CHANGES: Updated.
@@ -10,7 +15,7 @@
 	`lsb_delta' and `rsb_delta'.
 
 	* src/autohint/ahhint.c (ah_hinter_load): Set `lsb_delta' and
-	`rsb_delta' in slot->metrics.
+	`rsb_delta' in slot->metrics and tune side bearings slightly.
 
 2004-06-04  David Turner  <[email protected]>
 
--- a/src/autofit/afloader.c
+++ b/src/autofit/afloader.c
@@ -158,10 +158,13 @@
         /* width/positioning that occured during the hinting process  */
         {
           FT_Pos        old_advance, old_rsb, old_lsb, new_lsb;
+          FT_Pos        pp1x_uh, pp2x_uh;
           AF_AxisHints  axis  = &hints->axis[ AF_DIMENSION_HORZ ];
-          AF_Edge       edge1 = axis->edges;    /* leftmost edge  */
-          AF_Edge       edge2 = edge1 + axis->num_edges - 1; /* rightmost edge */
+          AF_Edge       edge1 = axis->edges;         /* leftmost edge  */
+          AF_Edge       edge2 = edge1 +
+                                axis->num_edges - 1; /* rightmost edge */
 
+
           if ( edge2 > edge1 )
           {
             old_advance = loader->pp2.x;
@@ -169,8 +172,26 @@
             old_lsb     = edge1->opos;
             new_lsb     = edge1->pos;
 
-            loader->pp1.x = FT_PIX_ROUND( new_lsb    - old_lsb );
-            loader->pp2.x = FT_PIX_ROUND( edge2->pos + old_rsb );
+            /* remember unhinted values to later account */
+            /* for rounding errors                       */
+
+            pp1x_uh = new_lsb    - old_lsb;
+            pp2x_uh = edge2->pos + old_rsb;
+
+            /* prefer too much space over too little space */
+            /* for very small sizes                        */
+
+            if ( old_lsb < 24 )
+              pp1x_uh -= 5;
+
+            if ( old_rsb < 24 )
+              pp2x_uh += 5;
+
+            loader->pp1.x = FT_PIX_ROUND( pp1x_uh );
+            loader->pp2.x = FT_PIX_ROUND( pp2x_uh );
+
+            slot->metrics.lsb_delta = hinter->pp1.x - pp1x_uh;
+            slot->metrics.rsb_delta = hinter->pp2.x - pp2x_uh;
 
 #if 0
             /* try to fix certain bad advance computations */