Fixes for broken glyphs. Uses numberOfContours as a flag that the glyph is valid.
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
diff --git a/include/FTVectoriser.h b/include/FTVectoriser.h
index 0ee24db..5672d96 100644
--- a/include/FTVectoriser.h
+++ b/include/FTVectoriser.h
@@ -220,9 +220,14 @@ class FTGL_EXPORT FTVectoriser
* A Mesh for tesselations
*/
FTMesh* mesh;
+
+ /**
+ *
+ */
+ short ftContourCount;
/**
- * A flag indicating the tesselation rule for the glyph
+ * A flag indicating the tesselation rule for the glyph
*/
int contourFlag;
diff --git a/src/FTVectoriser.cpp b/src/FTVectoriser.cpp
index 58b9c91..c237bc5 100644
--- a/src/FTVectoriser.cpp
+++ b/src/FTVectoriser.cpp
@@ -111,8 +111,9 @@ FTVectoriser::FTVectoriser( const FT_Glyph glyph)
{
FT_OutlineGlyph outline = (FT_OutlineGlyph)glyph;
ftOutline = outline->outline;
-
- contourList.reserve( ftOutline.n_contours);
+
+ ftContourCount = ftOutline.n_contours;;
+ contourList.reserve( ftContourCount);
contourFlag = ftOutline.flags;
}
}
@@ -134,12 +135,11 @@ FTVectoriser::~FTVectoriser()
void FTVectoriser::ProcessContours()
{
- const short contourCount = ftOutline.n_contours;
short contourLength = 0;
short startIndex = 0;
short endIndex = 0;
- for( short contourIndex = 0; contourIndex < contourCount; ++contourIndex)
+ for( short contourIndex = 0; contourIndex < ftContourCount; ++contourIndex)
{
FT_Vector* pointList = &ftOutline.points[startIndex];
char* tagList = &ftOutline.tags[startIndex];