Commit 901ee76c71f707ef55b55bd41ec509881a22773e

sammy 2008-05-21T15:45:11

* Fix a texture coordinate bug caused by our next-power-of-two ceiling.

diff --git a/src/FTFont/FTBufferFont.cpp b/src/FTFont/FTBufferFont.cpp
index 0b25126..05964c9 100644
--- a/src/FTFont/FTBufferFont.cpp
+++ b/src/FTFont/FTBufferFont.cpp
@@ -182,13 +182,17 @@ inline FTPoint FTBufferFontImpl::RenderI(const T* string, const int len,
 
     glBegin(GL_QUADS);
         glNormal3f(0.0f, 0.0f, 1.0f);
-        glTexCoord2f(border / texWidth, border / texHeight);
+        glTexCoord2f(border / texWidth,
+                     (texHeight - height + border) / texHeight);
         glVertex2f(bbox.Lower().Xf(), bbox.Upper().Yf());
-        glTexCoord2f((width - border) / texWidth, border / texHeight);
+        glTexCoord2f((width - border) / texWidth,
+                     (texHeight - height + border) / texHeight);
         glVertex2f(bbox.Upper().Xf(), bbox.Upper().Yf());
-        glTexCoord2f((width - border) / texWidth, (height - border) / texHeight);
+        glTexCoord2f((width - border) / texWidth,
+                     (texHeight - border) / texHeight);
         glVertex2f(bbox.Upper().Xf(), bbox.Lower().Yf());
-        glTexCoord2f(border / texWidth, (height - border) / texHeight);
+        glTexCoord2f(border / texWidth,
+                     (texHeight - border) / texHeight);
         glVertex2f(bbox.Lower().Xf(), bbox.Lower().Yf());
     glEnd();