Commit d1bea0353339fc2a6bcc15b8b661c7401f796f97

sammy 2008-05-22T15:31:07

* Fix a visual bug in FTBufferFont caused by overlapping glyphs.

diff --git a/src/FTGlyph/FTBufferGlyph.cpp b/src/FTGlyph/FTBufferGlyph.cpp
index 861ee6a..24d95ed 100644
--- a/src/FTGlyph/FTBufferGlyph.cpp
+++ b/src/FTGlyph/FTBufferGlyph.cpp
@@ -99,11 +99,19 @@ const FTPoint& FTBufferGlyphImpl::RenderImpl(const FTPoint& pen, int renderMode)
 
         for(int y = 0; y < bitmap.rows; y++)
         {
-if(y + dy < 0 || y + dy >= buffer->height) continue;
+            // FIXME: change the loop bounds instead of doing this test
+            if(y + dy < 0 || y + dy >= buffer->height) continue;
+
             for(int x = 0; x < bitmap.width; x++)
             {
-if(x + dx < 0 || x + dx >= buffer->width) continue;
-                dest[y * buffer->pitch + x] = pixels[y * bitmap.pitch + x];
+                if(x + dx < 0 || x + dx >= buffer->width) continue;
+
+                unsigned char p = pixels[y * bitmap.pitch + x];
+
+                if(p)
+                {
+                    dest[y * buffer->pitch + x] = p;
+                }
             }
         }
     }