From 63daffb22f9476af14f072fc3fdeb400d4496aac Mon Sep 17 00:00:00 2001 From: Bart van Strien Date: Tue, 21 Aug 2012 15:18:12 +0200 Subject: [PATCH] Correctly set the spacing for the last character in an ImageFont as well --- src/modules/font/ImageRasterizer.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/modules/font/ImageRasterizer.cpp b/src/modules/font/ImageRasterizer.cpp index 9891a18fa..21f45539b 100644 --- a/src/modules/font/ImageRasterizer.cpp +++ b/src/modules/font/ImageRasterizer.cpp @@ -131,6 +131,16 @@ void ImageRasterizer::load() widths[c] = (end - start); } + // Find spacing of last glyph + if (length > 0) + { + start = end; + while (start < imgw && equal(pixels[start], spacer)) + ++start; + + spacing[glyphs[length - 1]] = (start > end) ? (start - end) : 0; + } + // Replace spacer color with an empty pixel for (unsigned int i = 0; i < imgs; ++i) {