Changed size calculations to use floats
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
diff --git a/include/FTFont.h b/include/FTFont.h
index ca37345..76f5990 100755
--- a/include/FTFont.h
+++ b/include/FTFont.h
@@ -106,14 +106,14 @@ class FTGL_EXPORT FTFont
*
* @return Ascender height
*/
- int Ascender() const;
+ float Ascender() const;
/**
* Gets the global descender height for the face.
*
* @return Descender height
*/
- int Descender() const;
+ float Descender() const;
/**
* Get the bounding box for a string.
diff --git a/include/FTSize.h b/include/FTSize.h
index d391759..4a0b52a 100755
--- a/include/FTSize.h
+++ b/include/FTSize.h
@@ -54,14 +54,14 @@ class FTGL_EXPORT FTSize
*
* @return Ascender height
*/
- int Ascender() const;
+ float Ascender() const;
/**
* Gets the global descender height for the face in pixels.
*
* @return Ascender height
*/
- int Descender() const;
+ float Descender() const;
/**
* Gets the global face height for the face.
@@ -73,7 +73,7 @@ class FTGL_EXPORT FTSize
*
* @return height in pixels.
*/
- int Height() const;
+ float Height() const;
/**
* Gets the global face width for the face.
@@ -85,14 +85,14 @@ class FTGL_EXPORT FTSize
*
* @return width in pixels.
*/
- int Width() const;
+ float Width() const;
/**
* Gets the underline position for the face.
*
* @return underline position in pixels
*/
- int Underline() const;
+ float Underline() const;
/**
diff --git a/src/FTFont.cpp b/src/FTFont.cpp
index 14af89e..d2a0930 100755
--- a/src/FTFont.cpp
+++ b/src/FTFont.cpp
@@ -110,13 +110,13 @@ bool FTFont::CharMap( FT_Encoding encoding)
}
-int FTFont::Ascender() const
+float FTFont::Ascender() const
{
return charSize.Ascender();
}
-int FTFont::Descender() const
+float FTFont::Descender() const
{
return charSize.Descender();
}
diff --git a/src/FTGLTextureFont.cpp b/src/FTGLTextureFont.cpp
index 1eb6979..29365a2 100755
--- a/src/FTGLTextureFont.cpp
+++ b/src/FTGLTextureFont.cpp
@@ -46,8 +46,8 @@ FTGlyph* FTGLTextureFont::MakeGlyph( unsigned int g)
if( ftGlyph)
{
// Estimate the glyph size size - global bbox
- glyphHeight = ( charSize.Height());
- glyphWidth = ( charSize.Width());
+ glyphHeight = static_cast<int>( charSize.Height());
+ glyphWidth = static_cast<int>( charSize.Width());
// Is there a current texture
if( numTextures == 0)
diff --git a/src/FTSize.cpp b/src/FTSize.cpp
index 43a94bb..035e662 100755
--- a/src/FTSize.cpp
+++ b/src/FTSize.cpp
@@ -40,23 +40,23 @@ unsigned int FTSize::CharSize() const
}
-int FTSize::Ascender() const
+float FTSize::Ascender() const
{
- return ftSize == 0 ? 0 : ftSize->metrics.ascender >> 6;
+ return ftSize == 0 ? 0.0f : static_cast<float>( ftSize->metrics.ascender) / 64.0f;
}
-int FTSize::Descender() const
+float FTSize::Descender() const
{
- return ftSize == 0 ? 0 : ftSize->metrics.descender >> 6;
+ return ftSize == 0 ? 0.0f : static_cast<float>( ftSize->metrics.descender) / 64.0f;
}
-int FTSize::Height() const
+float FTSize::Height() const
{
- if( ftSize == 0)
+ if( 0 == ftSize)
{
- return 0;
+ return 0.0f;
}
if( FT_IS_SCALABLE((*ftFace)))
@@ -64,20 +64,20 @@ int FTSize::Height() const
float height = ( (*ftFace)->bbox.yMax - (*ftFace)->bbox.yMin)
* ( (float)ftSize->metrics.y_ppem / (float)(*ftFace)->units_per_EM);
- return static_cast<int>(height);
+ return height;
}
else
{
- return ftSize->metrics.height >> 6;
+ return static_cast<float>( ftSize->metrics.height) / 64.0f;
}
}
-int FTSize::Width() const
+float FTSize::Width() const
{
- if( ftSize == 0)
+ if( 0 == ftSize)
{
- return 0;
+ return 0.0f;
}
if( FT_IS_SCALABLE((*ftFace)))
@@ -85,16 +85,16 @@ int FTSize::Width() const
float width = ( (*ftFace)->bbox.xMax - (*ftFace)->bbox.xMin)
* ( (float)ftSize->metrics.x_ppem / (float)(*ftFace)->units_per_EM);
- return static_cast<int>(width);
+ return width;
}
else
{
- return ftSize->metrics.max_advance >> 6;
+ return static_cast<float>( ftSize->metrics.max_advance) / 64.0f;
}
}
-int FTSize::Underline() const
+float FTSize::Underline() const
{
- return 0;
+ return 0.0f;
}