Changes to the way charmaps are handled
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 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192
diff --git a/include/FTFont.h b/include/FTFont.h
index 898384d..55d96ce 100755
--- a/include/FTFont.h
+++ b/include/FTFont.h
@@ -49,8 +49,6 @@ class FTFont
// future list of sizes
FTSize charSize;
-// string fontName;
-
int numGlyphs;
FTGlyphContainer* glyphList;
diff --git a/src/FTFont.cpp b/src/FTFont.cpp
index de31df1..fbad1f7 100755
--- a/src/FTFont.cpp
+++ b/src/FTFont.cpp
@@ -72,21 +72,7 @@ bool FTFont::FaceSize( const int size, const int res )
bool FTFont::CharMap( CHARMAP encoding)
{
face.CharMap( encoding);
-
- //FIXME
- if( glyphList)
- delete glyphList;
-
- glyphList = new FTGlyphContainer( face.Face(), numGlyphs);
-
- if( MakeGlyphList())
- {
- return true;
- }
- else
- {
- return false;
- }
+ return false; // for the moment seeing as this doesn't do anything!!!
}
diff --git a/src/FTGLBitmapFont.cpp b/src/FTGLBitmapFont.cpp
index 51e1ee9..68210a3 100755
--- a/src/FTGLBitmapFont.cpp
+++ b/src/FTGLBitmapFont.cpp
@@ -20,23 +20,19 @@ bool FTGLBitmapFont::MakeGlyphList()
// if( preCache)
FT_Face* ftFace = face.Face();
- long glyphIndex;
- numGlyphs = 256; // FIXME hack
+// numGlyphs = 256; // FIXME hack
for( int c = 0; c < numGlyphs; ++c)
{
- glyphIndex = FT_Get_Char_Index( *ftFace, c );
-
- err = FT_Load_Glyph( *ftFace, glyphIndex, FT_LOAD_DEFAULT);
-
+ err = FT_Load_Glyph( *ftFace, c, FT_LOAD_DEFAULT);
FT_Glyph ftGlyph;
err = FT_Get_Glyph( (*ftFace)->glyph, &ftGlyph);
// FT_HAS_VERTICAL(face)
- tempGlyph = new FTBitmapGlyph( ftGlyph, glyphIndex);
+ tempGlyph = new FTBitmapGlyph( ftGlyph, c);
glyphList->Add( tempGlyph);
}
diff --git a/src/FTGLOutlineFont.cpp b/src/FTGLOutlineFont.cpp
index 3afe9e5..0831849 100755
--- a/src/FTGLOutlineFont.cpp
+++ b/src/FTGLOutlineFont.cpp
@@ -18,23 +18,19 @@ FTGLOutlineFont::~FTGLOutlineFont()
bool FTGLOutlineFont::MakeGlyphList()
{
- int glyphIndex;
+// int glyphIndex;
+ FT_Face* ftFace = face.Face();
numGlyphs = 127; // FIXME hack
for( int n = 0; n < numGlyphs; ++n)
{
- FT_Face* ftFace = face.Face();
-
- glyphIndex = FT_Get_Char_Index( *ftFace, n);
-
- err = FT_Load_Glyph( *ftFace, glyphIndex, FT_LOAD_DEFAULT);
-
+ err = FT_Load_Glyph( *ftFace, n, FT_LOAD_DEFAULT);
FT_Glyph ftGlyph;
err = FT_Get_Glyph( (*ftFace)->glyph, &ftGlyph);
- tempGlyph = new FTVectorGlyph( ftGlyph, glyphIndex);
+ tempGlyph = new FTVectorGlyph( ftGlyph, n);
glyphList->Add( tempGlyph);
}
diff --git a/src/FTGLPixmapFont.cpp b/src/FTGLPixmapFont.cpp
index e222b8c..8364304 100755
--- a/src/FTGLPixmapFont.cpp
+++ b/src/FTGLPixmapFont.cpp
@@ -18,25 +18,20 @@ FTGLPixmapFont::~FTGLPixmapFont()
bool FTGLPixmapFont::MakeGlyphList()
{
// if( preCache)
-
FT_Face* ftFace = face.Face();
- long glyphIndex;
- numGlyphs = 256; // FIXME hack
+// numGlyphs = 256; // FIXME hack
for( int c = 0; c < numGlyphs; ++c)
{
- glyphIndex = FT_Get_Char_Index( *ftFace, c );
-
- err = FT_Load_Glyph( *ftFace, glyphIndex, FT_LOAD_DEFAULT);
-
+ err = FT_Load_Glyph( *ftFace, c, FT_LOAD_DEFAULT);
FT_Glyph ftGlyph;
err = FT_Get_Glyph( (*ftFace)->glyph, &ftGlyph);
// FT_HAS_VERTICAL(face)
- tempGlyph = new FTPixmapGlyph( ftGlyph, glyphIndex);
+ tempGlyph = new FTPixmapGlyph( ftGlyph, c);
glyphList->Add( tempGlyph);
}
diff --git a/src/FTGLPolygonFont.cpp b/src/FTGLPolygonFont.cpp
index f4459c0..0b76401 100755
--- a/src/FTGLPolygonFont.cpp
+++ b/src/FTGLPolygonFont.cpp
@@ -17,21 +17,17 @@ FTGLPolygonFont::~FTGLPolygonFont()
bool FTGLPolygonFont::MakeGlyphList()
{
FT_Face* ftFace = face.Face();
- int glyphIndex;
numGlyphs = 127; // FIXME hack
for( int n = 0; n < numGlyphs; ++n)
{
- glyphIndex = FT_Get_Char_Index( *ftFace, n);
-
- err = FT_Load_Glyph( *ftFace, glyphIndex, FT_LOAD_DEFAULT);
-
+ err = FT_Load_Glyph( *ftFace, n, FT_LOAD_DEFAULT);
FT_Glyph ftGlyph;
err = FT_Get_Glyph( (*ftFace)->glyph, &ftGlyph);
- tempGlyph = new FTPolyGlyph( ftGlyph, glyphIndex);
+ tempGlyph = new FTPolyGlyph( ftGlyph, n);
glyphList->Add( tempGlyph);
}
diff --git a/src/FTGlyphContainer.cpp b/src/FTGlyphContainer.cpp
index ccc4f8f..3dd6d64 100755
--- a/src/FTGlyphContainer.cpp
+++ b/src/FTGlyphContainer.cpp
@@ -35,16 +35,19 @@ FT_Vector& FTGlyphContainer::render( int index, int next, FT_Vector pen)
{
kernAdvance.x = 0; kernAdvance.y = 0;
- if( index > glyphs.size())
+ int left = FT_Get_Char_Index( *face, index);
+ int right = FT_Get_Char_Index( *face, next);
+
+ if( left > glyphs.size())
return kernAdvance;
- if( 0 < next <= glyphs.size())
+ if( 0 < right <= glyphs.size())
{
// ft_kerning_unfitted
- err = FT_Get_Kerning( *face, glyphs[index]->glyphIndex, glyphs[next]->glyphIndex, ft_kerning_default, &kernAdvance);
+ err = FT_Get_Kerning( *face, left, right, ft_kerning_default, &kernAdvance);
}
- advance = glyphs[index]->Render( pen);
+ advance = glyphs[left]->Render( pen);
kernAdvance.x = advance + kernAdvance.x;
// kernAdvance.y = advance.y + kernAdvance.y;