summaryrefslogtreecommitdiff
path: root/pixel-client/src/render/font.rs
diff options
context:
space:
mode:
Diffstat (limited to 'pixel-client/src/render/font.rs')
-rw-r--r--pixel-client/src/render/font.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/pixel-client/src/render/font.rs b/pixel-client/src/render/font.rs
index ff4abade..392c1d66 100644
--- a/pixel-client/src/render/font.rs
+++ b/pixel-client/src/render/font.rs
@@ -25,8 +25,9 @@ impl FontTextures {
}
impl<'a> Renderer<'a> {
- pub fn draw_text(&mut self, position: Vec2, text: &str) {
+ pub fn draw_text(&mut self, position: Vec2, text: &str) -> Vec2 {
let mut cursor = position;
+ let mut line_height = 0f32;
for c in text.chars() {
if (c as u32) < 128 {
let r = self.font_textures.glyphs[c as usize];
@@ -37,7 +38,9 @@ impl<'a> Renderer<'a> {
None,
));
cursor.x += r.width() as f32;
+ line_height = line_height.max(r.height() as f32)
}
}
+ cursor + Vec2::Y * line_height
}
}