inlined the ascender and descender functions
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
diff --git a/include/FTFont.h b/include/FTFont.h
index d8fb20c..d87de19 100755
--- a/include/FTFont.h
+++ b/include/FTFont.h
@@ -1,16 +1,16 @@
#ifndef __FTFont__
#define __FTFont__
-#include <string>
+#include <string>
-#include <ft2build.h>
-#include FT_FREETYPE_H
+#include <ft2build.h>
+#include FT_FREETYPE_H
-#include "FTGL.h"
-#include "FTFace.h"
+#include "FTGL.h"
+#include "FTFace.h"
-class FTGlyphContainer;
class FTGlyph;
+class FTGlyphContainer;
using namespace std;
@@ -92,14 +92,14 @@ class FTGL_EXPORT FTFont
*
* @return Ascender height
*/
- int Ascender() const;
+ inline int Ascender() const { return charSize.Ascender(); }
/**
* Gets the global descender height for the face.
*
* @return Descender height
*/
- int Descender() const;
+ inline int Descender() const { return charSize.Descender(); }
/**
* Get the bounding box for a string.
@@ -186,7 +186,7 @@ class FTGL_EXPORT FTFont
* @return <code>true</code> on success.
*/
virtual bool MakeGlyphList();
-
+
/**
* Get the advance width for a character.
*
diff --git a/src/FTFont.cpp b/src/FTFont.cpp
index d0319ed..86283bd 100755
--- a/src/FTFont.cpp
+++ b/src/FTFont.cpp
@@ -1,6 +1,5 @@
#include "FTFace.h"
#include "FTFont.h"
-#include "FTGlyphContainer.h"
#include "FTGlyph.h" // for FTBbox
#ifdef FTGL_DEBUG
#include "mmgr.h"
@@ -70,24 +69,6 @@ bool FTFont::FaceSize( const unsigned int size, const unsigned int res )
}
-bool FTFont::MakeGlyphList()
-{
- for( unsigned int c = 0; c < numGlyphs; ++c)
- {
- if( preCache)
- {
- glyphList->Add( MakeGlyph( c), c);
- }
- else
- {
- glyphList->Add( NULL, c);
- }
- }
-
- return !err; // FIXME what err?
-}
-
-
bool FTFont::CharMap( FT_Encoding encoding)
{
err = face.CharMap( encoding);
@@ -95,15 +76,21 @@ bool FTFont::CharMap( FT_Encoding encoding)
}
-int FTFont::Ascender() const
-{
- return charSize.Ascender();
-}
-
-
-int FTFont::Descender() const
+bool FTFont::MakeGlyphList()
{
- return charSize.Descender();
+ for( unsigned int c = 0; c < numGlyphs; ++c)
+ {
+ if( preCache)
+ {
+ glyphList->Add( MakeGlyph( c), c);
+ }
+ else
+ {
+ glyphList->Add( NULL, c);
+ }
+ }
+
+ return !err; // From derived class MakeGlyph()
}