ref: 2ea0d9fb649c6c3b08b72b2fd922c63ccb0cf565
parent: 13472b38d345843b4084ffda334a56c4a07436d4
author: Werner Lemberg <[email protected]>
date: Sun Oct 5 03:54:00 EDT 2003
* src/base/ftoutln.c (FT_OrientationExtremumRec, FT_Outline_Get_Orientation): Trivial typo fixes to make it compile.
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2003-10-04 Werner Lemberg <[email protected]>
+
+ * src/base/ftoutln.c (FT_OrientationExtremumRec,
+ FT_Outline_Get_Orientation): Trivial typo fixes to make it compile.
+
2003-10-02 Markus F.X.J. Oberhumer <[email protected]>
* src/winfonts/winfnt.c (FT_WinFNT_HeaderRec): `color_table_offset'
@@ -7,16 +12,20 @@
2003-10-01 David Turner <[email protected]>
- * src/autofit/*: adding first sources of the new multi-script
- "auto-fitter"
+ * src/autofit/*: Adding first source files of the new multi-script
+ `auto-fitter'.
- * include/freetype/ftoutln.h, src/base/ftoutln.c: adding the
- definition of FT_Outline_Get_Orientation, used to compute the
- fill orientation of a given glyph outline.
+ * include/freetype/ftoutln.h (FT_Orientation): New enumeration.
+ (FT_Outline_Get_Orientation): New declaration.
- * include/freetype/internal/ftserv.h: fixed trivial bug which
- could crashed the font engine when a cached service pointer was
- retrieved with FT_FACE_LOOKUP_SERVICE
+ * src/base/ftoutln.c (FT_OrientationExtremumRec): New structure.
+ (ft_orientation_extremum_compute): New auxiliary function.
+ (FT_Outline_Get_Orientation): New function to compute the fill
+ orientation of a given glyph outline.
+
+ * include/freetype/internal/ftserv.h (FT_FACE_LOOKUP_SERVICE): Fixed
+ trivial bug which could crash the font engine when a cached service
+ pointer was retrieved.
2003-09-30 Werner Lemberg <[email protected]>
--- a/src/base/ftoutln.c
+++ b/src/base/ftoutln.c
@@ -4,7 +4,7 @@
/* */
/* FreeType outline management (body). */
/* */
-/* Copyright 1996-2001, 2002 by */
+/* Copyright 1996-2001, 2002, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -656,13 +656,12 @@
}
-
- typedef FT_OrientationExtremumRec_
+ typedef struct FT_OrientationExtremumRec_
{
- FT_Int index;
- FT_Int pos;
- FT_Int first;
- FT_Int last;
+ FT_Int index;
+ FT_Int pos;
+ FT_Int first;
+ FT_Int last;
} FT_OrientationExtremumRec;
@@ -675,8 +674,8 @@
FT_Vector* points = outline->points;
FT_Angle angle_in, angle_out;
- /* compute the previous and next points in the same contour
- */
+
+ /* compute the previous and next points in the same contour */
point = points + extremum->index;
first = points + extremum->first;
last = points + extremum->last;
@@ -683,7 +682,7 @@
do
{
- prev = ( point == first ) ? last : point-1;
+ prev = ( point == first ) ? last : point - 1;
if ( prev == point )
return FT_ORIENTATION_TRUETYPE; /* degenerate case */
@@ -692,7 +691,7 @@
do
{
- next = ( point == last ) ? first : point+1;
+ next = ( point == last ) ? first : point + 1;
if ( next == point )
return FT_ORIENTATION_TRUETYPE; /* shouldn't happen */
@@ -699,15 +698,14 @@
} while ( next->x != point->x || next->y != point->y );
- /* now, compute the orientation of the "out" vector relative
- * to the "in" vector.
- */
+ /* now compute the orientation of the `out' vector relative */
+ /* to the `in' vector. */
angle_in = FT_Atan2( point->x - prev->x, point->y - prev->y );
angle_out = FT_Atan2( next->x - point->x, next->y - point->y );
return ( FT_Angle_Diff( angle_in, angle_out ) >= 0 )
- ? FT_ORIENTATION_TRUETYPE
- : FT_ORIENTATION_POSTSCRIPT;
+ ? FT_ORIENTATION_TRUETYPE
+ : FT_ORIENTATION_POSTSCRIPT;
}
@@ -716,6 +714,7 @@
{
FT_Orientation result = FT_ORIENTATION_TRUETYPE;
+
if ( outline && outline->n_points > 0 )
{
FT_OrientationExtremumRec xmin, ymin, xmax, ymax;
@@ -723,6 +722,7 @@
FT_Int first, last;
FT_Vector* points = outline->points;
+
xmin.pos = ymin.pos = +32768L;
xmax.pos = ymax.pos = -32768L;
@@ -729,21 +729,22 @@
xmin.index = ymin.index = xmax.index = ymax.index = -1;
first = 0;
- for ( n = 0; n < outline->n_contours; n++, first = last+1 )
+ for ( n = 0; n < outline->n_contours; n++, first = last + 1 )
{
last = outline->contours[n];
- /* skip single-point contours, these are degenerated cases
- */
- if ( last > first+1 )
+ /* skip single-point contours; these are degenerated cases */
+ if ( last > first + 1 )
{
FT_Int i;
+
for ( i = first; i < last; i++ )
{
- x = points[i].x;
- y = points[i].y;
+ FT_Pos x = points[i].x;
+ FT_Pos y = points[i].y;
+
if ( x < xmin.pos )
{
xmin.pos = x;
@@ -791,5 +792,6 @@
return result;
}
+
/* END */