Commit 618c11ff5f51b6e6d857c9c58c8678cd7ab13b89

henry 2002-12-10T08:38:55

Changed size calculations to use floats

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;
 }