From b4df875196f3ac39d8ca3ec0efb02baccc8ef0cc Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Thu, 28 May 2009 07:07:48 +0200 Subject: [PATCH] Remove compiler warning. Reported by Krzysztof Kowalczyk . * src/autofit/aflatin2.c (af_latin2_hint_edges): Move declaration of `n_edges' into `#if' block. --- ChangeLog | 8 +++++ src/autofit/Jamfile | 4 +-- src/autofit/aflatin2.c | 79 ++++++++++++++++++++++-------------------- 3 files changed, 52 insertions(+), 39 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1b9159ae3..f1eba3812 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2009-05-28 Werner Lemberg + + Remove compiler warning. + Reported by Krzysztof Kowalczyk . + + * src/autofit/aflatin2.c (af_latin2_hint_edges): Move declaration of + `n_edges' into `#if' block. + 2009-05-28 Werner Lemberg Make compilation work with FT_CONFIG_OPTION_USE_ZLIB not defined. diff --git a/src/autofit/Jamfile b/src/autofit/Jamfile index 1ed5c50c4..2714765b5 100644 --- a/src/autofit/Jamfile +++ b/src/autofit/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 src/autofit Jamfile # -# Copyright 2003, 2004, 2005, 2006, 2007 by +# Copyright 2003, 2004, 2005, 2006, 2007, 2009 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -14,7 +14,7 @@ SubDir FT2_TOP src autofit ; { local _sources ; - # define FT2_AUTOFIT2 do enable to experimental latin hinter replacement + # define FT2_AUTOFIT2 to enable experimental latin hinter replacement if $(FT2_AUTOFIT2) { DEFINES += FT_OPTION_AUTOFIT2 ; diff --git a/src/autofit/aflatin2.c b/src/autofit/aflatin2.c index 58c07832e..ec5e3fec6 100644 --- a/src/autofit/aflatin2.c +++ b/src/autofit/aflatin2.c @@ -4,7 +4,7 @@ /* */ /* Auto-fitter hinting routines for latin script (body). */ /* */ -/* Copyright 2003, 2004, 2005, 2006, 2007, 2008 by */ +/* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -1788,7 +1788,6 @@ AF_AxisHints axis = &hints->axis[dim]; AF_Edge edges = axis->edges; AF_Edge edge_limit = edges + axis->num_edges; - FT_Int n_edges; AF_Edge edge; AF_Edge anchor = 0; FT_Int has_serifs = 0; @@ -2099,54 +2098,60 @@ /* We don't handle horizontal edges since we can't easily assure that */ /* the third (lowest) stem aligns with the base line; it might end up */ /* one pixel higher or lower. */ + #if 0 - n_edges = edge_limit - edges; - if ( dim == AF_DIMENSION_HORZ && ( n_edges == 6 || n_edges == 12 ) ) { - AF_Edge edge1, edge2, edge3; - FT_Pos dist1, dist2, span, delta; + FT_Int n_edges = edge_limit - edges; - if ( n_edges == 6 ) + if ( dim == AF_DIMENSION_HORZ && ( n_edges == 6 || n_edges == 12 ) ) { - edge1 = edges; - edge2 = edges + 2; - edge3 = edges + 4; - } - else - { - edge1 = edges + 1; - edge2 = edges + 5; - edge3 = edges + 9; - } + AF_Edge edge1, edge2, edge3; + FT_Pos dist1, dist2, span, delta; - dist1 = edge2->opos - edge1->opos; - dist2 = edge3->opos - edge2->opos; - span = dist1 - dist2; - if ( span < 0 ) - span = -span; - - if ( span < 8 ) - { - delta = edge3->pos - ( 2 * edge2->pos - edge1->pos ); - edge3->pos -= delta; - if ( edge3->link ) - edge3->link->pos -= delta; - - /* move the serifs along with the stem */ - if ( n_edges == 12 ) + if ( n_edges == 6 ) { - ( edges + 8 )->pos -= delta; - ( edges + 11 )->pos -= delta; + edge1 = edges; + edge2 = edges + 2; + edge3 = edges + 4; + } + else + { + edge1 = edges + 1; + edge2 = edges + 5; + edge3 = edges + 9; } - edge3->flags |= AF_EDGE_DONE; - if ( edge3->link ) - edge3->link->flags |= AF_EDGE_DONE; + dist1 = edge2->opos - edge1->opos; + dist2 = edge3->opos - edge2->opos; + + span = dist1 - dist2; + if ( span < 0 ) + span = -span; + + if ( span < 8 ) + { + delta = edge3->pos - ( 2 * edge2->pos - edge1->pos ); + edge3->pos -= delta; + if ( edge3->link ) + edge3->link->pos -= delta; + + /* move the serifs along with the stem */ + if ( n_edges == 12 ) + { + ( edges + 8 )->pos -= delta; + ( edges + 11 )->pos -= delta; + } + + edge3->flags |= AF_EDGE_DONE; + if ( edge3->link ) + edge3->link->flags |= AF_EDGE_DONE; + } } } #endif + if ( has_serifs || !anchor ) { /*