* Fix random bugs introduced in [941] and [943].
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176
diff --git a/include/FTContour.h b/include/FTContour.h
index ba86187..c27934d 100644
--- a/include/FTContour.h
+++ b/include/FTContour.h
@@ -68,6 +68,9 @@ class FTGL_EXPORT FTContour
~FTContour()
{
pointList.clear();
+ outsetPointList.clear();
+ frontPointList.clear();
+ backPointList.clear();
}
/**
@@ -125,6 +128,7 @@ class FTGL_EXPORT FTContour
*
* @return the number of points in this contour
*/
+ size_t OutsetPointCount() const { return outsetPointList.size(); }
size_t FrontPointCount() const { return frontPointList.size(); }
size_t BackPointCount() const { return backPointList.size(); }
diff --git a/src/FTContour.cpp b/src/FTContour.cpp
index 58156cc..ff59a31 100644
--- a/src/FTContour.cpp
+++ b/src/FTContour.cpp
@@ -52,13 +52,22 @@ void FTContour::AddPoint(FTPoint point)
}
}
+
void FTContour::AddOutsetPoint(FTPoint point)
{
- if(outsetPointList.empty() || (point != outsetPointList[pointList.size() - 1]
- && point != outsetPointList[0]))
- {
- outsetPointList.push_back(point);
- }
+ outsetPointList.push_back(point);
+}
+
+
+void FTContour::AddFrontPoint(FTPoint point)
+{
+ frontPointList.push_back(point);
+}
+
+
+void FTContour::AddBackPoint(FTPoint point)
+{
+ backPointList.push_back(point);
}
@@ -92,24 +101,6 @@ void FTContour::evaluateCubicCurve(FTPoint A, FTPoint B, FTPoint C, FTPoint D)
}
}
-void FTContour::AddFrontPoint(FTPoint point)
-{
- if(frontPointList.empty() || (point != frontPointList[pointList.size() - 1]
- && point != frontPointList[0]))
- {
- frontPointList.push_back(point);
- }
-}
-
-void FTContour::AddBackPoint(FTPoint point)
-{
- if(backPointList.empty() || (point != backPointList[pointList.size() - 1]
- && point != backPointList[0]))
- {
- backPointList.push_back(point);
- }
-}
-
FTGL_DOUBLE FTContour::NormVector(const FTPoint &v)
{
return sqrt(v.X() * v.X() + v.Y() * v.Y());
@@ -136,9 +127,9 @@ void FTContour::MultMatrixVect(FTGL_DOUBLE *mat, FTPoint &v)
void FTContour::ComputeBisec(FTPoint &v)
{
- FTGL_DOUBLE sgn = 64.0;
+ FTGL_DOUBLE sgn = -64.0;
if((v.Y() / NormVector(v)) < 0)
- sgn = -64.0;
+ sgn = 64.0;
v.X(sgn * sqrt((NormVector(v) - v.X()) / (NormVector(v) + v.X())));
v.Y(64.0);
}
@@ -162,15 +153,15 @@ FTPoint FTContour::ComputeOutsetPoint(FTPoint a, FTPoint b, FTPoint c)
void FTContour::outsetContour()
{
size_t size = PointCount();
- FTPoint vOutsetF, vOutsetB;
+ FTPoint vOutset;
for(unsigned int pointIndex = 0; pointIndex < size; ++pointIndex)
{
int prev = (pointIndex%size + size - 1) % size;
int cur = pointIndex%size;
int next = (pointIndex%size + 1) % size;
/* Build the outset shape with d = 1.0f */
- vOutsetB = ComputeOutsetPoint(Point(prev), Point(cur), Point(next));
- AddOutsetPoint(vOutsetB);
+ vOutset = ComputeOutsetPoint(Point(prev), Point(cur), Point(next));
+ AddOutsetPoint(vOutset);
}
}
@@ -219,7 +210,6 @@ FTContour::FTContour(FT_Vector* contour, char* tags, unsigned int n)
FTPoint next2 = (i == n - 2)
? pointList[0]
: FTPoint(contour[i + 2]);
-
evaluateCubicCurve(prev, cur, next, next2);
++i;
continue;
diff --git a/src/FTOutlineGlyph.cpp b/src/FTOutlineGlyph.cpp
index 0ad798b..8a55351 100644
--- a/src/FTOutlineGlyph.cpp
+++ b/src/FTOutlineGlyph.cpp
@@ -59,7 +59,7 @@ FTOutlineGlyph::FTOutlineGlyph(FT_GlyphSlot glyph, float _outset,
return;
}
- this->outset = outset;
+ outset = _outset;
if(useDisplayList)
{
diff --git a/src/FTPoint.cpp b/src/FTPoint.cpp
index ea7f6d6..21a281b 100644
--- a/src/FTPoint.cpp
+++ b/src/FTPoint.cpp
@@ -38,12 +38,12 @@
#include <math.h>
-bool operator == ( const FTPoint &a, const FTPoint &b)
+bool operator == ( const FTPoint &a, const FTPoint &b)
{
return((a.values[0] == b.values[0]) && (a.values[1] == b.values[1]) && (a.values[2] == b.values[2]));
}
-bool operator != ( const FTPoint &a, const FTPoint &b)
+bool operator != ( const FTPoint &a, const FTPoint &b)
{
return((a.values[0] != b.values[0]) || (a.values[1] != b.values[1]) || (a.values[2] != b.values[2]));
}
@@ -53,7 +53,7 @@ FTPoint operator*( double multiplier, FTPoint& point)
{
return point * multiplier;
}
-
+
FTPoint FTPoint::GetNormal(const FTPoint &a, const FTPoint &b)
{
float vectorX = a.X() - b.X();
diff --git a/src/FTPolyGlyph.cpp b/src/FTPolyGlyph.cpp
index 6347037..aeb241f 100644
--- a/src/FTPolyGlyph.cpp
+++ b/src/FTPolyGlyph.cpp
@@ -60,9 +60,9 @@ FTPolyGlyph::FTPolyGlyph(FT_GlyphSlot glyph, float _outset,
}
- this->hscale = glyph->face->size->metrics.x_ppem * 64;
- this->vscale = glyph->face->size->metrics.y_ppem * 64;
- this->outset = outset;
+ hscale = glyph->face->size->metrics.x_ppem * 64;
+ vscale = glyph->face->size->metrics.y_ppem * 64;
+ outset = _outset;
if(useDisplayList)
{