summaryrefslogtreecommitdiff
path: root/splash/SplashFTFont.cc
diff options
context:
space:
mode:
authorAlbert Astals Cid <aacid@kde.org>2005-11-17 21:37:34 +0000
committerAlbert Astals Cid <aacid@kde.org>2005-11-17 21:37:34 +0000
commit6fe2cb0fcd53211143dcd0c47bf8c8c7a8c11a39 (patch)
tree4ffa796062be4b32f16a392b2e28903c6a0336eb /splash/SplashFTFont.cc
parent429d3521d788be702a3944bc290569f90ae04892 (diff)
make it compile with freetype 2.2.0 preversions
Diffstat (limited to 'splash/SplashFTFont.cc')
-rw-r--r--splash/SplashFTFont.cc42
1 files changed, 37 insertions, 5 deletions
diff --git a/splash/SplashFTFont.cc b/splash/SplashFTFont.cc
index 8e8b395f..14319a92 100644
--- a/splash/SplashFTFont.cc
+++ b/splash/SplashFTFont.cc
@@ -12,6 +12,11 @@
#pragma implementation
#endif
+#define MAKE_VERSION( a,b,c ) (((a) << 16) | ((b) << 8) | (c))
+
+#define FREETYPE_VERSION \
+ MAKE_VERSION(FREETYPE_MAJOR,FREETYPE_MINOR,FREETYPE_PATCH)
+
#include <ft2build.h>
#include FT_OUTLINE_H
#include FT_INTERNAL_OBJECTS_H // needed for FT_New_Size decl
@@ -25,11 +30,19 @@
//------------------------------------------------------------------------
+#if ( FREETYPE_VERSION >= MAKE_VERSION(2,2,0) )
+static int glyphPathMoveTo(const FT_Vector *pt, void *path);
+static int glyphPathLineTo(const FT_Vector *pt, void *path);
+static int glyphPathConicTo(const FT_Vector *ctrl, const FT_Vector *pt, void *path);
+static int glyphPathCubicTo(const FT_Vector *ctrl1, const FT_Vector *ctrl2,
+ const FT_Vector *pt, void *path);
+#else
static int glyphPathMoveTo(FT_Vector *pt, void *path);
static int glyphPathLineTo(FT_Vector *pt, void *path);
static int glyphPathConicTo(FT_Vector *ctrl, FT_Vector *pt, void *path);
static int glyphPathCubicTo(FT_Vector *ctrl1, FT_Vector *ctrl2,
FT_Vector *pt, void *path);
+#endif
//------------------------------------------------------------------------
// SplashFTFont
@@ -249,7 +262,12 @@ SplashPath *SplashFTFont::getGlyphPath(int c) {
return path.path;
}
-static int glyphPathMoveTo(FT_Vector *pt, void *path) {
+#if ( FREETYPE_VERSION >= MAKE_VERSION(2,2,0) )
+static int glyphPathMoveTo(const FT_Vector *pt, void *path)
+#else
+static int glyphPathMoveTo(FT_Vector *pt, void *path)
+#endif
+{
SplashFTFontPath *p = (SplashFTFontPath *)path;
if (p->needClose) {
@@ -260,7 +278,12 @@ static int glyphPathMoveTo(FT_Vector *pt, void *path) {
return 0;
}
-static int glyphPathLineTo(FT_Vector *pt, void *path) {
+#if ( FREETYPE_VERSION >= MAKE_VERSION(2,2,0) )
+static int glyphPathLineTo(const FT_Vector *pt, void *path)
+#else
+static int glyphPathLineTo(FT_Vector *pt, void *path)
+#endif
+{
SplashFTFontPath *p = (SplashFTFontPath *)path;
p->path->lineTo(pt->x / 64.0, -pt->y / 64.0);
@@ -268,7 +291,12 @@ static int glyphPathLineTo(FT_Vector *pt, void *path) {
return 0;
}
-static int glyphPathConicTo(FT_Vector *ctrl, FT_Vector *pt, void *path) {
+#if ( FREETYPE_VERSION >= MAKE_VERSION(2,2,0) )
+static int glyphPathConicTo(const FT_Vector *ctrl, const FT_Vector *pt, void *path)
+#else
+static int glyphPathConicTo(FT_Vector *ctrl, FT_Vector *pt, void *path)
+#endif
+{
SplashFTFontPath *p = (SplashFTFontPath *)path;
SplashCoord x0, y0, x1, y1, x2, y2, x3, y3, xc, yc;
@@ -306,8 +334,12 @@ static int glyphPathConicTo(FT_Vector *ctrl, FT_Vector *pt, void *path) {
return 0;
}
-static int glyphPathCubicTo(FT_Vector *ctrl1, FT_Vector *ctrl2,
- FT_Vector *pt, void *path) {
+#if ( FREETYPE_VERSION >= MAKE_VERSION(2,2,0) )
+static int glyphPathCubicTo(const FT_Vector *ctrl1, const FT_Vector *ctrl2, const FT_Vector *pt, void *path)
+#else
+static int glyphPathCubicTo(FT_Vector *ctrl1, FT_Vector *ctrl2, FT_Vector *pt, void *path)
+#endif
+{
SplashFTFontPath *p = (SplashFTFontPath *)path;
p->path->curveTo(ctrl1->x / 64.0, -ctrl1->y / 64.0,