Minor improvements.
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 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158
diff --git a/src/autohint/ahglyph.c b/src/autohint/ahglyph.c
index 8a9c331..de8bab4 100644
--- a/src/autohint/ahglyph.c
+++ b/src/autohint/ahglyph.c
@@ -198,6 +198,10 @@
first = last + 1;
}
+ /* compute the vectorial product -- since we know that the angle */
+ /* is <= 180 degrees (otherwise it wouldn't be an extremum) we */
+ /* can determine the filling orientation if the product is */
+ /* either positive or negative */
product = FT_MulDiv( cur->x - prev->x, /* in.x */
next->y - cur->y, /* out.y */
0x40 )
@@ -456,7 +460,7 @@
/* We can't rely on the value of `FT_Outline.flags' to know the fill */
/* direction used for a glyph, given that some fonts are broken (e.g. */
- /* the Arphic ones). We thus recompute it each time we need to. */
+ /* the Arphic ones). We thus recompute it each time we need to. */
/* */
outline->vert_major_dir = AH_DIR_UP;
outline->horz_major_dir = AH_DIR_LEFT;
@@ -483,7 +487,7 @@
/* compute coordinates */
{
- FT_Vector* vec = source->points;
+ FT_Vector* vec = source->points;
for ( point = points; point < point_limit; vec++, point++ )
@@ -507,9 +511,11 @@
switch ( FT_CURVE_TAG( *tag ) )
{
case FT_CURVE_TAG_CONIC:
- point->flags = AH_FLAG_CONIC; break;
+ point->flags = AH_FLAG_CONIC;
+ break;
case FT_CURVE_TAG_CUBIC:
- point->flags = AH_FLAG_CUBIC; break;
+ point->flags = AH_FLAG_CUBIC;
+ break;
default:
;
}
@@ -589,7 +595,7 @@
point->out_dir = ah_compute_direction( ovec.x, ovec.y );
#ifndef AH_OPTION_NO_WEAK_INTERPOLATION
- if ( point->flags & (AH_FLAG_CONIC | AH_FLAG_CUBIC) )
+ if ( point->flags & ( AH_FLAG_CONIC | AH_FLAG_CUBIC ) )
{
Is_Weak_Point:
point->flags |= AH_FLAG_WEAK_INTERPOLATION;
@@ -685,8 +691,8 @@
static void
ah_outline_compute_inflections( AH_Outline outline )
{
- AH_Point* contour = outline->contours;
- AH_Point* contour_limit = contour + outline->num_contours;
+ AH_Point* contour = outline->contours;
+ AH_Point* contour_limit = contour + outline->num_contours;
/* load original coordinates in (u,v) */
@@ -696,10 +702,10 @@
for ( ; contour < contour_limit; contour++ )
{
FT_Vector vec;
- AH_Point point = contour[0];
- AH_Point first = point;
- AH_Point start = point;
- AH_Point end = point;
+ AH_Point point = contour[0];
+ AH_Point first = point;
+ AH_Point start = point;
+ AH_Point end = point;
AH_Point before;
AH_Point after;
AH_Angle angle_in, angle_seg, angle_out;
@@ -773,7 +779,6 @@
{
/* diff_in and diff_out have different signs, we have */
/* inflection points here... */
-
do
{
start->flags |= AH_FLAG_INFLECTION;
@@ -833,10 +838,10 @@
/* do each contour separately */
for ( ; contour < contour_limit; contour++ )
{
- AH_Point point = contour[0];
- AH_Point last = point->prev;
- int on_edge = 0;
- FT_Pos min_pos = +32000; /* minimum segment pos != min_coord */
+ AH_Point point = contour[0];
+ AH_Point last = point->prev;
+ int on_edge = 0;
+ FT_Pos min_pos = 32000; /* minimum segment pos != min_coord */
FT_Pos max_pos = -32000; /* maximum segment pos != max_coord */
FT_Bool passed;
@@ -854,7 +859,7 @@
}
#endif
- if ( point == last ) /* skip singletons -- just in case? */
+ if ( point == last ) /* skip singletons -- just in case */
continue;
if ( ABS( last->out_dir ) == major_dir &&
@@ -1268,7 +1273,7 @@
/* */
/* - edge's main direction */
/* - stem edge, serif edge or both (which defaults to stem then) */
- /* - rounded edge, straigth or both (which defaults to straight) */
+ /* - rounded edge, straight or both (which defaults to straight) */
/* - link for edge */
/* */
/*********************************************************************/
@@ -1390,7 +1395,7 @@
edge->dir = - up_dir;
else if ( ups == downs )
- edge->dir = 0; /* both up and down !! */
+ edge->dir = 0; /* both up and down! */
/* gets rid of serifs if link is set */
/* XXX: This gets rid of many unpleasant artefacts! */
@@ -1463,7 +1468,7 @@
ref = globals->blue_refs[blue];
shoot = globals->blue_shoots[blue];
- dist = ref-shoot;
+ dist = ref - shoot;
if ( dist < 0 )
dist = -dist;
@@ -1511,6 +1516,7 @@
FT_Bool is_major_dir =
FT_BOOL( edge->dir == outline->horz_major_dir );
+
if ( !blue_active[blue] )
continue;
@@ -1573,7 +1579,7 @@
/* ah_outline_scale_blue_edges */
/* */
/* <Description> */
- /* This functions must be called before hinting in order to re-adjust */
+ /* This function must be called before hinting in order to re-adjust */
/* the contents of the detected edges (basically change the `blue */
/* edge' pointer from `design units' to `scaled ones'). */
/* */