From 735a53170f1009f85121da800f6a7f84c8bf5c30 Mon Sep 17 00:00:00 2001 From: dwyip Date: Thu, 25 May 2006 16:33:13 +0000 Subject: [PATCH] fix for backwards compatibility with FreeType 2.1.x --- src/libnrtype/FontInstance.cpp | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/libnrtype/FontInstance.cpp b/src/libnrtype/FontInstance.cpp index d28fb42a4..2b9b4e13f 100644 --- a/src/libnrtype/FontInstance.cpp +++ b/src/libnrtype/FontInstance.cpp @@ -90,9 +90,20 @@ typedef struct ft2_to_liv { NR::Point last; } ft2_to_liv; +// Note: Freetype 2.2.1 redefined function signatures for functions to be placed in an +// FT_Outline_Funcs structure. This is needed to keep backwards compatibility with the +// 2.1.x series. + +/* *** BEGIN #if HACK *** */ +#if FREETYPE_MAJOR == 2 && FREETYPE_MINOR >= 2 +#define FREETYPE_VECTOR FT_Vector const +#else +#define FREETYPE_VECTOR FT_Vector +#endif + // outline as returned by freetype -> livarot Path // see nr-type-ft2.cpp for the freetype -> artBPath on which this code is based -static int ft2_move_to(FT_Vector const *to, void * i_user) { +static int ft2_move_to(FREETYPE_VECTOR *to, void * i_user) { ft2_to_liv* user=(ft2_to_liv*)i_user; NR::Point p(user->scale*to->x,user->scale*to->y); // printf("m t=%f %f\n",p[0],p[1]); @@ -101,7 +112,7 @@ static int ft2_move_to(FT_Vector const *to, void * i_user) { return 0; } -static int ft2_line_to(FT_Vector const *to, void *i_user) +static int ft2_line_to(FREETYPE_VECTOR *to, void *i_user) { ft2_to_liv* user=(ft2_to_liv*)i_user; NR::Point p(user->scale*to->x,user->scale*to->y); @@ -111,7 +122,7 @@ static int ft2_line_to(FT_Vector const *to, void *i_user) return 0; } -static int ft2_conic_to(FT_Vector const *control, FT_Vector const *to, void *i_user) +static int ft2_conic_to(FREETYPE_VECTOR *control, FREETYPE_VECTOR *to, void *i_user) { ft2_to_liv* user=(ft2_to_liv*)i_user; NR::Point p(user->scale*to->x,user->scale*to->y),c(user->scale*control->x,user->scale*control->y); @@ -123,7 +134,7 @@ static int ft2_conic_to(FT_Vector const *control, FT_Vector const *to, void *i_u return 0; } -static int ft2_cubic_to(FT_Vector const *control1, FT_Vector const *control2, FT_Vector const *to, void *i_user) +static int ft2_cubic_to(FREETYPE_VECTOR *control1, FREETYPE_VECTOR *control2, FREETYPE_VECTOR *to, void *i_user) { ft2_to_liv* user=(ft2_to_liv*)i_user; NR::Point p(user->scale*to->x,user->scale*to->y), @@ -136,6 +147,8 @@ static int ft2_cubic_to(FT_Vector const *control1, FT_Vector const *control2, FT } #endif +/* *** END #if HACK *** */ + /* * */ -- 2.30.2