#include <freetype/ftoutln.h>
#include <freetype/internal/ftobjs.h>
#include <freetype/internal/ftcalc.h>
#include <freetype/internal/ftdebug.h>
#include <freetype/fttrigon.h>
#undef FT_COMPONENT
#define FT_COMPONENT …
static
const FT_Outline null_outline = …;
FT_EXPORT_DEF( FT_Error )
FT_Outline_Decompose( FT_Outline* outline,
const FT_Outline_Funcs* func_interface,
void* user )
{ … }
FT_EXPORT_DEF( FT_Error )
FT_Outline_New( FT_Library library,
FT_UInt numPoints,
FT_Int numContours,
FT_Outline *anoutline )
{ … }
FT_EXPORT_DEF( FT_Error )
FT_Outline_Check( FT_Outline* outline )
{ … }
FT_EXPORT_DEF( FT_Error )
FT_Outline_Copy( const FT_Outline* source,
FT_Outline *target )
{ … }
FT_EXPORT_DEF( FT_Error )
FT_Outline_Done( FT_Library library,
FT_Outline* outline )
{ … }
FT_EXPORT_DEF( void )
FT_Outline_Get_CBox( const FT_Outline* outline,
FT_BBox *acbox )
{ … }
FT_EXPORT_DEF( void )
FT_Outline_Translate( const FT_Outline* outline,
FT_Pos xOffset,
FT_Pos yOffset )
{ … }
FT_EXPORT_DEF( void )
FT_Outline_Reverse( FT_Outline* outline )
{ … }
FT_EXPORT_DEF( FT_Error )
FT_Outline_Render( FT_Library library,
FT_Outline* outline,
FT_Raster_Params* params )
{ … }
FT_EXPORT_DEF( FT_Error )
FT_Outline_Get_Bitmap( FT_Library library,
FT_Outline* outline,
const FT_Bitmap *abitmap )
{ … }
FT_EXPORT_DEF( void )
FT_Vector_Transform( FT_Vector* vector,
const FT_Matrix* matrix )
{ … }
FT_EXPORT_DEF( void )
FT_Outline_Transform( const FT_Outline* outline,
const FT_Matrix* matrix )
{ … }
#if 0
#define FT_OUTLINE_GET_CONTOUR …
static FT_Bool
ft_contour_has( FT_Outline* outline,
FT_Short c,
FT_Vector* point )
{
FT_Vector* first;
FT_Vector* last;
FT_Vector* a;
FT_Vector* b;
FT_UInt n = 0;
FT_OUTLINE_GET_CONTOUR( outline, c, first, last );
for ( a = first; a <= last; a++ )
{
FT_Pos x;
FT_Int intersect;
b = ( a == last ) ? first : a + 1;
intersect = ( a->y - point->y ) ^ ( b->y - point->y );
if ( intersect >= 0 )
{
if ( intersect == 0 && a->y == point->y )
{
if ( ( a->x <= point->x && b->x >= point->x ) ||
( a->x >= point->x && b->x <= point->x ) )
return 1;
}
continue;
}
x = a->x + ( b->x - a->x ) * (point->y - a->y ) / ( b->y - a->y );
if ( x < point->x )
n++;
else if ( x == point->x )
return 1;
}
return n & 1;
}
static FT_Bool
ft_contour_enclosed( FT_Outline* outline,
FT_UShort c )
{
FT_Vector* first;
FT_Vector* last;
FT_Short i;
FT_OUTLINE_GET_CONTOUR( outline, c, first, last );
for ( i = 0; i < outline->n_contours; i++ )
{
if ( i != c && ft_contour_has( outline, i, first ) )
{
FT_Vector* pt;
for ( pt = first + 1; pt <= last; pt++ )
if ( !ft_contour_has( outline, i, pt ) )
return 0;
return 1;
}
}
return 0;
}
static FT_Orientation
ft_outline_get_orientation( FT_Outline* outline )
{
FT_Short i;
FT_Vector* first;
FT_Vector* last;
FT_Orientation orient = FT_ORIENTATION_NONE;
first = outline->points;
for ( i = 0; i < outline->n_contours; i++, first = last + 1 )
{
FT_Vector* point;
FT_Vector* xmin_point;
FT_Pos xmin;
last = outline->points + outline->contours[i];
if ( last < first + 2 )
continue;
if ( ft_contour_enclosed( outline, i ) )
continue;
xmin = first->x;
xmin_point = first;
for ( point = first + 1; point <= last; point++ )
{
if ( point->x < xmin )
{
xmin = point->x;
xmin_point = point;
}
}
{
FT_Vector* prev;
FT_Vector* next;
FT_Orientation o;
prev = ( xmin_point == first ) ? last : xmin_point - 1;
next = ( xmin_point == last ) ? first : xmin_point + 1;
if ( FT_Atan2( prev->x - xmin_point->x, prev->y - xmin_point->y ) >
FT_Atan2( next->x - xmin_point->x, next->y - xmin_point->y ) )
o = FT_ORIENTATION_POSTSCRIPT;
else
o = FT_ORIENTATION_TRUETYPE;
if ( orient == FT_ORIENTATION_NONE )
orient = o;
else if ( orient != o )
return FT_ORIENTATION_NONE;
}
}
return orient;
}
#endif
FT_EXPORT_DEF( FT_Error )
FT_Outline_Embolden( FT_Outline* outline,
FT_Pos strength )
{ … }
FT_EXPORT_DEF( FT_Error )
FT_Outline_EmboldenXY( FT_Outline* outline,
FT_Pos xstrength,
FT_Pos ystrength )
{ … }
FT_EXPORT_DEF( FT_Orientation )
FT_Outline_Get_Orientation( FT_Outline* outline )
{ … }