From d527307adc124db80c6e487bca8b0ac8e68e4b94 Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Sun, 28 Sep 2014 21:26:17 -0300 Subject: [PATCH] Font glyphs created from ImageFonts no longer treat separator pixels as spacing (resolves issue #190.) --HG-- branch : minor --- src/modules/font/ImageRasterizer.cpp | 16 +--------------- src/modules/font/ImageRasterizer.h | 1 - 2 files changed, 1 insertion(+), 16 deletions(-) diff --git a/src/modules/font/ImageRasterizer.cpp b/src/modules/font/ImageRasterizer.cpp index c4ba34bfe..4447e9a6e 100644 --- a/src/modules/font/ImageRasterizer.cpp +++ b/src/modules/font/ImageRasterizer.cpp @@ -60,7 +60,7 @@ GlyphData *ImageRasterizer::getGlyphData(uint32 glyph) const if (it != imageGlyphs.end()) { gm.width = it->second.width; - gm.advance = it->second.width + it->second.spacing; + gm.advance = it->second.width; } gm.height = metrics.height; @@ -118,10 +118,6 @@ void ImageRasterizer::load() while (start < imgw && equal(pixels[start], spacer)) ++start; - // set previous glyph's spacing - if (i > 0 && imageGlyphs.size() > 0) - imageGlyphs[glyphs[i - 1]].spacing = (start > end) ? (start - end) : 0; - end = start; // Find where glyph ends. @@ -137,16 +133,6 @@ void ImageRasterizer::load() imageGlyphs[glyphs[i]] = imageGlyph; } - - // Find spacing of last glyph - if (numglyphs > 0) - { - start = end; - while (start < imgw && equal(pixels[start], spacer)) - ++start; - - imageGlyphs[glyphs[numglyphs - 1]].spacing = (start > end) ? (start - end) : 0; - } } int ImageRasterizer::getGlyphCount() const diff --git a/src/modules/font/ImageRasterizer.h b/src/modules/font/ImageRasterizer.h index 59a16205e..19a836222 100644 --- a/src/modules/font/ImageRasterizer.h +++ b/src/modules/font/ImageRasterizer.h @@ -66,7 +66,6 @@ private: { int x; int width; - int spacing; }; std::map imageGlyphs;