* Some code cleanup here and there, mostly in FTGlyphContainer.
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
diff --git a/src/FTFace.cpp b/src/FTFace.cpp
index 7fd8154..743836e 100644
--- a/src/FTFace.cpp
+++ b/src/FTFace.cpp
@@ -134,7 +134,7 @@ const FTSize& FTFace::Size(const unsigned int size, const unsigned int res)
}
-unsigned int FTFace::CharMapCount()
+unsigned int FTFace::CharMapCount() const
{
return (*ftFace)->num_charmaps;
}
diff --git a/src/FTFace.h b/src/FTFace.h
index 899822f..0e903b5 100644
--- a/src/FTFace.h
+++ b/src/FTFace.h
@@ -110,7 +110,7 @@ class FTFace
*
* @return character map count.
*/
- unsigned int CharMapCount();
+ unsigned int CharMapCount() const;
/**
* Get a list of character maps in this face.
diff --git a/src/FTFont/FTFont.cpp b/src/FTFont/FTFont.cpp
index b345dae..cc47932 100644
--- a/src/FTFont/FTFont.cpp
+++ b/src/FTFont/FTFont.cpp
@@ -117,7 +117,7 @@ bool FTFont::CharMap(FT_Encoding encoding)
}
-unsigned int FTFont::CharMapCount()
+unsigned int FTFont::CharMapCount() const
{
return impl->CharMapCount();
}
@@ -393,7 +393,7 @@ bool FTFontImpl::CharMap(FT_Encoding encoding)
}
-unsigned int FTFontImpl::CharMapCount()
+unsigned int FTFontImpl::CharMapCount() const
{
return face.CharMapCount();
}
diff --git a/src/FTFont/FTFontImpl.h b/src/FTFont/FTFontImpl.h
index f163b7b..7007211 100644
--- a/src/FTFont/FTFontImpl.h
+++ b/src/FTFont/FTFontImpl.h
@@ -55,7 +55,7 @@ class FTFontImpl
virtual bool CharMap(FT_Encoding encoding);
- virtual unsigned int CharMapCount();
+ virtual unsigned int CharMapCount() const;
virtual FT_Encoding* CharMapList();
diff --git a/src/FTGL/FTFont.h b/src/FTGL/FTFont.h
index b8010db..d7b3b05 100644
--- a/src/FTGL/FTFont.h
+++ b/src/FTGL/FTFont.h
@@ -131,7 +131,7 @@ class FTGL_EXPORT FTFont
*
* @return character map count.
*/
- unsigned int CharMapCount();
+ unsigned int CharMapCount() const;
/**
* Get a list of character maps in this face.
diff --git a/src/FTGlyphContainer.cpp b/src/FTGlyphContainer.cpp
index fb88e2f..d9f7db6 100644
--- a/src/FTGlyphContainer.cpp
+++ b/src/FTGlyphContainer.cpp
@@ -62,58 +62,58 @@ bool FTGlyphContainer::CharMap(FT_Encoding encoding)
}
-unsigned int FTGlyphContainer::FontIndex(const unsigned int characterCode) const
+unsigned int FTGlyphContainer::FontIndex(const unsigned int charCode) const
{
- return charMap->FontIndex(characterCode);
+ return charMap->FontIndex(charCode);
}
-void FTGlyphContainer::Add(FTGlyph* tempGlyph, const unsigned int characterCode)
+void FTGlyphContainer::Add(FTGlyph* tempGlyph, const unsigned int charCode)
{
- charMap->InsertIndex(characterCode, glyphs.size());
+ charMap->InsertIndex(charCode, glyphs.size());
glyphs.push_back(tempGlyph);
}
-const FTGlyph* const FTGlyphContainer::Glyph(const unsigned int characterCode) const
+const FTGlyph* const FTGlyphContainer::Glyph(const unsigned int charCode) const
{
- signed int index = charMap->GlyphListIndex(characterCode);
+ unsigned int index = charMap->GlyphListIndex(charCode);
return glyphs[index];
}
-FTBBox FTGlyphContainer::BBox(const unsigned int characterCode) const
+FTBBox FTGlyphContainer::BBox(const unsigned int charCode) const
{
- return glyphs[charMap->GlyphListIndex(characterCode)]->BBox();
+ return Glyph(charCode)->BBox();
}
-float FTGlyphContainer::Advance(const unsigned int characterCode, const unsigned int nextCharacterCode)
+float FTGlyphContainer::Advance(const unsigned int charCode,
+ const unsigned int nextCharCode)
{
- unsigned int left = charMap->FontIndex(characterCode);
- unsigned int right = charMap->FontIndex(nextCharacterCode);
+ unsigned int left = charMap->FontIndex(charCode);
+ unsigned int right = charMap->FontIndex(nextCharCode);
- float width = face->KernAdvance(left, right).Xf();
- width += glyphs[charMap->GlyphListIndex(characterCode)]->Advance().Xf();
-
- return width;
+ return face->KernAdvance(left, right).Xf()
+ + Glyph(charCode)->Advance().Xf();
}
-FTPoint FTGlyphContainer::Render(const unsigned int characterCode, const unsigned int nextCharacterCode, FTPoint penPosition, int renderMode)
+FTPoint FTGlyphContainer::Render(const unsigned int charCode,
+ const unsigned int nextCharCode,
+ FTPoint penPosition, int renderMode)
{
- FTPoint kernAdvance, advance;
-
- unsigned int left = charMap->FontIndex(characterCode);
- unsigned int right = charMap->FontIndex(nextCharacterCode);
+ unsigned int left = charMap->FontIndex(charCode);
+ unsigned int right = charMap->FontIndex(nextCharCode);
- kernAdvance = face->KernAdvance(left, right);
+ FTPoint kernAdvance = face->KernAdvance(left, right);
if(!face->Error())
{
- advance = glyphs[charMap->GlyphListIndex(characterCode)]->Render(penPosition, renderMode);
+ unsigned int index = charMap->GlyphListIndex(charCode);
+ kernAdvance += glyphs[index]->Render(penPosition, renderMode);
}
- kernAdvance += advance;
return kernAdvance;
}
+