shithub: freetype+ttf2subf

Download patch

ref: c02485cb725f94ea0487351596adc1e3ef8d1ae6
parent: 29bc310563d4c8c728adfa78e18af9e4d3c89116
author: Werner Lemberg <[email protected]>
date: Thu Jan 13 16:55:08 EST 2011

[raster] Reduce jitter value.

This catches a rendering problem with glyph `x' from Tahoma at
10ppem.  It seems that the increase of the precision in the change
from 2009-06-11 makes a larger jitter value unnecessary.

* src/raster/ftraster.c (Set_High_Precision): Implement it.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 2011-01-13  Werner Lemberg  <[email protected]>
 
+	[raster] Reduce jitter value.
+
+	This catches a rendering problem with glyph `x' from Tahoma at
+	10ppem.  It seems that the increase of the precision in the change
+	from 2009-06-11 makes a larger jitter value unnecessary.
+
+	* src/raster/ftraster.c (Set_High_Precision): Implement it.
+
+2011-01-13  Werner Lemberg  <[email protected]>
+
 	[raster] Handle drop-outs at glyph borders according to Microsoft.
 
 	If a drop-out rule would switch on a pixel outside of the glyph's
--- a/src/raster/ftraster.c
+++ b/src/raster/ftraster.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    The FreeType glyph rasterizer (body).                                */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2005, 2007, 2008, 2009, 2010 by       */
+/*  Copyright 1996-2001, 2002, 2003, 2005, 2007, 2008, 2009, 2010, 2011 by */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -651,11 +651,33 @@
   static void
   Set_High_Precision( RAS_ARGS Int  High )
   {
+    /*
+     * `precision_step' is used in `Bezier_Up' to decide when to split a
+     * given y-monotonous Bezier arc that crosses a scanline before
+     * approximating it as a straight segment.  The default value of 32 (for
+     * low accuracy) corresponds to
+     *
+     *   32 / 64 == 0.5 pixels ,
+     *
+     * while for the high accuracy case we have
+     *
+     *   256/ (1 << 12) = 0.0625 pixels .
+     *
+     * `precision_jitter' is an epsilon threshold used in
+     * `Vertical_Sweep_Span' to deal with small imperfections in the Bezier
+     * decomposition (after all, we are working with approximations only);
+     * it avoids switching on additional pixels which would cause artifacts
+     * otherwise.
+     *
+     * The value of `precision_jitter' has been determined heuristically.
+     *
+     */
+
     if ( High )
     {
       ras.precision_bits   = 12;
       ras.precision_step   = 256;
-      ras.precision_jitter = 50;
+      ras.precision_jitter = 30;
     }
     else
     {