summaryrefslogtreecommitdiff
path: root/src/graphics/text.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/graphics/text.cpp')
-rw-r--r--src/graphics/text.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/graphics/text.cpp b/src/graphics/text.cpp
index 7b135d6..51b71ae 100644
--- a/src/graphics/text.cpp
+++ b/src/graphics/text.cpp
@@ -20,24 +20,26 @@ void Text<TextureFont>::arrange(TextureFont &font){
if(text_[i] == '\n') continue;
}
+ // Position the character in the text
vertices_[4*i+0].position = sf::Vector2f(
col*glyph.advance + glyph.bounds.left,
- (glyph.bounds.top) + row * glyph.bounds.height
+ (glyph.bounds.top) + row * font.getLineSpacing() * lineHeightRatio_
);
vertices_[4*i+1].position = sf::Vector2f(
col*glyph.advance + glyph.bounds.left+glyph.bounds.width,
- (glyph.bounds.top) + row * glyph.bounds.height
+ (glyph.bounds.top) + row * font.getLineSpacing() * lineHeightRatio_
);
vertices_[4*i+2].position = sf::Vector2f(
col*glyph.advance + glyph.bounds.left+glyph.bounds.width,
- (glyph.bounds.top+glyph.bounds.height) + row * glyph.bounds.height
+ (glyph.bounds.top+glyph.bounds.height) + row * font.getLineSpacing() * lineHeightRatio_
);
vertices_[4*i+3].position = sf::Vector2f(
col*glyph.advance + glyph.bounds.left,
- (glyph.bounds.top+glyph.bounds.height) + row * glyph.bounds.height
+ (glyph.bounds.top+glyph.bounds.height) + row * font.getLineSpacing() * lineHeightRatio_
);
col++;
+ // Choose the texture rectangle for this character
vertices_[4*i+0].texCoords = sf::Vector2f(
glyph.textureRect.left,
glyph.textureRect.top