* Fix the FTLayout rendering: line feeds were not properly handled. Patch by Eric Beets.
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
diff --git a/src/FTBitmapGlyph.cpp b/src/FTBitmapGlyph.cpp
index b5451ff..e913b86 100644
--- a/src/FTBitmapGlyph.cpp
+++ b/src/FTBitmapGlyph.cpp
@@ -85,17 +85,22 @@ FTBitmapGlyph::~FTBitmapGlyph()
}
-const FTPoint& FTBitmapGlyph::Render( const FTPoint& pen)
+const FTPoint& FTBitmapGlyph::Render(const FTPoint& pen)
{
- glBitmap( 0, 0, 0.0f, 0.0f, pen.X() + pos.X(), pen.Y() - pos.Y(), (const GLubyte*)0 );
-
- if( data)
+ if(data)
{
- glPixelStorei( GL_UNPACK_ROW_LENGTH, destPitch * 8);
- glBitmap( destWidth, destHeight, 0.0f, 0.0, 0.0, 0.0, (const GLubyte*)data);
+ float dx, dy;
+
+ dx = pen.X() + pos.X();
+ dy = pen.Y() - pos.Y();
+
+ glBitmap(0, 0, 0.0f, 0.0f, dx, dy, (const GLubyte*)0);
+ glPixelStorei(GL_UNPACK_ROW_LENGTH, destPitch * 8);
+ glBitmap(destWidth, destHeight, 0.0f, 0.0, 0.0, 0.0,
+ (const GLubyte*)data);
+ glBitmap(0, 0, 0.0f, 0.0f, -dx, -dy, (const GLubyte*)0);
}
- glBitmap( 0, 0, 0.0f, 0.0f, -pos.X(), pos.Y(), (const GLubyte*)0 );
-
return advance;
}
+
diff --git a/src/FTExtrdGlyph.cpp b/src/FTExtrdGlyph.cpp
index 6436810..b767329 100644
--- a/src/FTExtrdGlyph.cpp
+++ b/src/FTExtrdGlyph.cpp
@@ -174,11 +174,11 @@ FTExtrdGlyph::~FTExtrdGlyph()
const FTPoint& FTExtrdGlyph::Render(const FTPoint& pen)
{
- glTranslatef(pen.X(), pen.Y(), 0);
-
if(glList)
{
+ glTranslatef(pen.X(), pen.Y(), 0);
glCallList(glList);
+ glTranslatef(-pen.X(), -pen.Y(), 0);
}
return advance;
diff --git a/src/FTFont.cpp b/src/FTFont.cpp
index 571db86..c5d1eeb 100644
--- a/src/FTFont.cpp
+++ b/src/FTFont.cpp
@@ -267,7 +267,7 @@ void FTFont::DoRender(const unsigned int chr,
if(CheckGlyph(chr))
{
FTPoint kernAdvance = glyphList->Render(chr, nextChr, origin);
- origin = kernAdvance;
+ origin += kernAdvance;
}
}
@@ -280,10 +280,7 @@ inline void FTFont::RenderI(const T* string)
while(*c)
{
- if(CheckGlyph(*c))
- {
- pen = glyphList->Render(*c, *(c + 1), pen);
- }
+ DoRender(*c, *(c + 1), pen);
++c;
}
}
diff --git a/src/FTOutlineGlyph.cpp b/src/FTOutlineGlyph.cpp
index eca616e..64c6d88 100644
--- a/src/FTOutlineGlyph.cpp
+++ b/src/FTOutlineGlyph.cpp
@@ -88,13 +88,13 @@ FTOutlineGlyph::~FTOutlineGlyph()
}
-const FTPoint& FTOutlineGlyph::Render( const FTPoint& pen)
+const FTPoint& FTOutlineGlyph::Render(const FTPoint& pen)
{
- glTranslatef( pen.X(), pen.Y(), 0.0f);
-
- if( glList)
+ if(glList)
{
- glCallList( glList);
+ glTranslatef(pen.X(), pen.Y(), 0.0f);
+ glCallList(glList);
+ glTranslatef(-pen.X(), -pen.Y(), 0.0f);
}
return advance;
diff --git a/src/FTPixmapGlyph.cpp b/src/FTPixmapGlyph.cpp
index 36ef647..95bf651 100644
--- a/src/FTPixmapGlyph.cpp
+++ b/src/FTPixmapGlyph.cpp
@@ -91,19 +91,24 @@ FTPixmapGlyph::~FTPixmapGlyph()
}
-const FTPoint& FTPixmapGlyph::Render( const FTPoint& pen)
+const FTPoint& FTPixmapGlyph::Render(const FTPoint& pen)
{
- glBitmap( 0, 0, 0.0f, 0.0f, pen.X() + pos.X(), pen.Y() - pos.Y(), (const GLubyte*)0);
-
- if( data)
+ if(data)
{
- glPixelStorei( GL_UNPACK_ROW_LENGTH, 0);
- glPixelStorei( GL_UNPACK_ALIGNMENT, 2);
+ float dx, dy;
+
+ dx = pen.X() + pos.X();
+ dy = pen.Y() - pos.Y();
+
+ glBitmap(0, 0, 0.0f, 0.0f, dx, dy, (const GLubyte*)0);
+ glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
+ glPixelStorei(GL_UNPACK_ALIGNMENT, 2);
- glDrawPixels( destWidth, destHeight, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, (const GLvoid*)data);
+ glDrawPixels(destWidth, destHeight, GL_LUMINANCE_ALPHA,
+ GL_UNSIGNED_BYTE, (const GLvoid*)data);
+ glBitmap(0, 0, 0.0f, 0.0f, -dx, -dy, (const GLubyte*)0);
}
-
- glBitmap( 0, 0, 0.0f, 0.0f, -pos.X(), pos.Y(), (const GLubyte*)0);
return advance;
}
+
diff --git a/src/FTPolyGlyph.cpp b/src/FTPolyGlyph.cpp
index 97ec4d4..02d1432 100644
--- a/src/FTPolyGlyph.cpp
+++ b/src/FTPolyGlyph.cpp
@@ -100,14 +100,15 @@ FTPolyGlyph::~FTPolyGlyph()
}
-const FTPoint& FTPolyGlyph::Render( const FTPoint& pen)
+const FTPoint& FTPolyGlyph::Render(const FTPoint& pen)
{
- glTranslatef( pen.X(), pen.Y(), 0.0f);
-
- if( glList)
+ if(glList)
{
- glCallList( glList);
+ glTranslatef(pen.X(), pen.Y(), 0.0f);
+ glCallList(glList);
+ glTranslatef(-pen.X(), -pen.Y(), 0.0f);
}
return advance;
}
+