From 2426d97450798fa6e482efcdf9a130e8afe2985f Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Tue, 18 Jun 2013 23:16:01 -0300 Subject: [PATCH] Fixed justify printf Align Mode (issue #635) --- src/modules/graphics/opengl/Graphics.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/graphics/opengl/Graphics.cpp b/src/modules/graphics/opengl/Graphics.cpp index f2ebd221b..8d0fc723a 100644 --- a/src/modules/graphics/opengl/Graphics.cpp +++ b/src/modules/graphics/opengl/Graphics.cpp @@ -818,7 +818,7 @@ void Graphics::printf(const std::string &str, float x, float y, float wrap, Alig currentFont->print(*line_iter, ceil(x + (wrap - width) / 2), ceil(y), 0.0f); break; case ALIGN_JUSTIFY: - if (line_iter->length() > 1 && (line_iter+1) != line_end) + if (line_iter->length() > 1) letter_spacing = (wrap - width) / float(line_iter->length() - 1); else letter_spacing = 0.0f;