Close issue #408: printf-justify alignment.

Add letter_spacing argument to Font::print(). Might be worth to expose to Lua
at some point. Justify alignment may result in mushy/blurred glyphs.
This commit is contained in:
vrld
2012-07-08 13:37:09 +02:00
parent 12f714bf74
commit 6d02057864
5 changed files with 16 additions and 5 deletions
+3 -3
View File
@@ -177,7 +177,7 @@ float Font::getHeight() const
return static_cast<float>(height);
}
void Font::print(std::string text, float x, float y, float angle, float sx, float sy, float ox, float oy, float kx, float ky)
void Font::print(std::string text, float x, float y, float letter_spacing, float angle, float sx, float sy, float ox, float oy, float kx, float ky)
{
float dx = 0.0f; // spacing counter for newline handling
glPushMatrix();
@@ -207,8 +207,8 @@ void Font::print(std::string text, float x, float y, float angle, float sx, floa
bindTexture(glyph->texture);
glCallList(glyph->list);
glPopMatrix();
glTranslatef(static_cast<GLfloat>(glyph->spacing), 0, 0);
dx += glyph->spacing;
glTranslatef(static_cast<GLfloat>(glyph->spacing + letter_spacing), 0, 0);
dx += glyph->spacing + letter_spacing;
}
}
catch(utf8::exception &e)