- improve autofitter's handling of serif fonts (results are much better) - make GCC 4 happy when compiling our zlib sources
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
diff --git a/ChangeLog b/ChangeLog
index 201f1eb..04f8cac 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2006-11-02 David Turner <david@freetype.org>
+ * src/autofit/aflatin.c: adding a few tweaks to better handle
+ serif fonts (we now ignore vertical segments that are less than
+ 1 pixels in height, which get rids of *many* corner cases with
+ serifs)
+
* src/autofit/afhints.c, src/autofit/afmodule.c,
src/autofit/aftypes.h: adding more debug messages and fixing a small
bug in af_compute_direction which produced garbage by missing lots of
diff --git a/src/autofit/aflatin.c b/src/autofit/aflatin.c
index 48dc813..9d92db3 100644
--- a/src/autofit/aflatin.c
+++ b/src/autofit/aflatin.c
@@ -949,6 +949,7 @@
AF_Direction up_dir;
FT_Fixed scale;
FT_Pos edge_distance_threshold;
+ FT_Pos segment_length_threshold;
axis->num_edges = 0;
@@ -959,6 +960,16 @@
up_dir = ( dim == AF_DIMENSION_HORZ ) ? AF_DIR_UP
: AF_DIR_RIGHT;
+ /* we want to ignore all segments that are less than 1.5
+ * pixels in length, to avoid many problems with serif
+ * fonts. we compute the corresponding threshold in font
+ * units
+ */
+ if ( dim == AF_DIMENSION_VERT )
+ segment_length_threshold = FT_DivFix( 64, hints->y_scale );
+ else
+ segment_length_threshold = 0;
+
/*********************************************************************/
/* */
/* We will begin by generating a sorted table of edges for the */
@@ -988,6 +999,8 @@
AF_Edge found = 0;
FT_Int ee;
+ if ( seg->max_coord - seg->min_coord < segment_length_threshold )
+ continue;
/* look for an edge corresponding to the segment */
for ( ee = 0; ee < axis->num_edges; ee++ )
@@ -1106,9 +1119,10 @@
/* check for links -- if seg->serif is set, then seg->link must */
/* be ignored */
- is_serif = (FT_Bool)( seg->serif && seg->serif->edge != edge );
+ is_serif = (FT_Bool)( seg->serif && seg->serif->edge &&
+ seg->serif->edge != edge );
- if ( seg->link || is_serif )
+ if ( (seg->link && seg->link->edge != NULL) || is_serif )
{
AF_Edge edge2;
AF_Segment seg2;
@@ -1700,7 +1714,7 @@
/* this should not happen, but it's better to be safe */
if ( edge2->blue_edge || edge2 < edge )
{
- AF_LOG(( "BLUE: ASSERT FAILED for edge %d\n", edge2-edges ));
+ AF_LOG(( "ASSERT FAILED for edge %d\n", edge2-edges ));
af_latin_align_linked_edge( hints, dim, edge2, edge );
edge->flags |= AF_EDGE_DONE;
continue;
@@ -1774,7 +1788,11 @@
(AF_Edge_Flags)edge->flags,
(AF_Edge_Flags)edge2->flags );
- if ( cur_len < 96 )
+ if ( edge2->flags & AF_EDGE_DONE )
+ {
+ edge->pos = edge2->pos - cur_len;
+ }
+ else if ( cur_len < 96 )
{
FT_Pos u_off, d_off;
diff --git a/src/gzip/inftrees.c b/src/gzip/inftrees.c
index 9002bf5..7b74296 100644
--- a/src/gzip/inftrees.c
+++ b/src/gzip/inftrees.c
@@ -131,6 +131,9 @@ uIntf *v /* working area: values in order of bit length */
uInt z; /* number of entries in current table */
+ /* Make comiler happy */
+ r.base = 0;
+
/* Generate counts for each bit length */
p = c;
#define C0 *p++ = 0;