* src/base/ftoutln.c (FT_OrientationExtremumRec,

FT_Outline_Get_Orientation): Trivial typo fixes to make it compile.
This commit is contained in:
Werner Lemberg 2003-10-05 07:54:00 +00:00
parent 13472b38d3
commit 2ea0d9fb64
2 changed files with 41 additions and 30 deletions

View File

@ -1,3 +1,8 @@
2003-10-04 Werner Lemberg <wl@gnu.org>
* 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 <markus@oberhumer.com>
* src/winfonts/winfnt.c (FT_WinFNT_HeaderRec): `color_table_offset'
@ -7,16 +12,20 @@
2003-10-01 David Turner <david@freetype.org>
* 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 <wl@gnu.org>

View File

@ -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,15 +674,15 @@
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;
do
{
prev = ( point == first ) ? last : point-1;
prev = ( point == first ) ? last : point - 1;
if ( prev == point )
return FT_ORIENTATION_TRUETYPE; /* degenerate case */
@ -692,22 +691,21 @@
do
{
next = ( point == last ) ? first : point+1;
next = ( point == last ) ? first : point + 1;
if ( next == point )
return FT_ORIENTATION_TRUETYPE; /* shouldn't happen */
} 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,27 +722,29 @@
FT_Int first, last;
FT_Vector* points = outline->points;
xmin.pos = ymin.pos = +32768L;
xmax.pos = ymax.pos = -32768L;
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;
@ -792,4 +793,5 @@
return result;
}
/* END */