freetype-devel
[Top][All Lists]
Advanced

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

[Devel] autohinter suggestions


From: David Chester
Subject: [Devel] autohinter suggestions
Date: Wed, 12 Feb 2003 11:16:40 -0500
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20030109

Greetings.

The rescaling code in ahhint.c looks good except that the changes to
x_scale and y_scale don't stick, and so there's almost no difference in
the output.  For instance, at line 1681 in ahhint.c, instead of this:

y_scale = FT_MulDiv( y_scale, fitted, scaled );

shouldn't it be something like the following?

face->size->metrics.y_scale = FT_MulDiv( metrics.y_scale, fitted, scaled );

Also, should the other values in face->size->metrics be scaled too, or
do you think that the difference would be so small that it doesn't matter?

I have also attached a patch which implements this in the ps hinter.

Finally, I noticed that my email address is not correct in the changelog.
For future reference, instead of address@hidden 
<http://us.f113.mail.yahoo.com/ym/address@hidden&YY=48012&order=down&sort=date&pos=0>,
 it should be
address@hidden 
<http://us.f113.mail.yahoo.com/ym/address@hidden&YY=48012&order=down&sort=date&pos=0>

Thanks,
David Chester

diff -ru /home/dchest/ft-clean/freetype2/src/pshinter/pshalgo3.c 
./src/pshinter/pshalgo3.c
--- /home/dchest/ft-clean/freetype2/src/pshinter/pshalgo3.c     2003-01-30 
18:24:18.000000000 -0500
+++ ./src/pshinter/pshalgo3.c   2003-02-01 21:54:36.000000000 -0500
@@ -1908,6 +1908,34 @@
     if ( error )
       goto Exit;

+   /* try to optimize the y_scale so that the top of non-capital letters
+    * is aligned on a pixel boundary whenever possible
+    */
+    {
+      PSH_Dimension  dim_x = &glyph->globals->dimension[0];
+      PSH_Dimension  dim_y = &glyph->globals->dimension[1];
+
+      FT_Fixed x_scale = dim_x->scale_mult;
+      FT_Fixed y_scale = dim_y->scale_mult;
+
+      FT_Fixed scaled;
+      FT_Fixed fitted;
+
+      scaled = FT_MulFix( globals->blues.normal_top.zones->org_ref, y_scale );
+      fitted = (scaled + 32) & -64;
+
+      if (scaled != fitted ) {
+
+        y_scale = FT_MulDiv( y_scale, fitted, scaled );
+
+        if ( fitted < scaled )
+          x_scale -= x_scale/50;
+
+        psh_globals_set_scale( glyph->globals, x_scale, y_scale, 0, 0);
+
+      }
+    }
+
     glyph->do_horz_hints = 1;
     glyph->do_vert_hints = 1;


reply via email to

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