diff -r b75cc01645af src/fontcache.cpp --- src/fontcache.cpp Sun Jul 20 07:55:52 2008 +0800 +++ src/fontcache.cpp Sun Jul 20 08:03:40 2008 +0800 @@ -428,13 +428,15 @@ y_adj = (size == FS_NORMAL) ? 2 : 0; sprite.y_offs = GetCharacterHeight(size) - slot->bitmap_top - y_adj; + bool binary_bitmap = (slot->bitmap.palette_mode == FT_PIXEL_MODE_MONO); + /* Draw shadow for medium size */ if (size == FS_NORMAL) { for (y = 0; y < slot->bitmap.rows; y++) { for (x = 0; x < slot->bitmap.width; x++) { - if (aa ? (slot->bitmap.buffer[x + y * slot->bitmap.pitch] > 0) : HasBit(slot->bitmap.buffer[(x / 8) + y * slot->bitmap.pitch], 7 - (x % 8))) { + if (binary_bitmap ? (slot->bitmap.buffer[x + y * slot->bitmap.pitch] > 0) : HasBit(slot->bitmap.buffer[(x / 8) + y * slot->bitmap.pitch], 7 - (x % 8))) { sprite.data[1 + x + (1 + y) * sprite.width].m = SHADOW_COLOUR; - sprite.data[1 + x + (1 + y) * sprite.width].a = aa ? slot->bitmap.buffer[x + y * slot->bitmap.pitch] : 0xFF; + sprite.data[1 + x + (1 + y) * sprite.width].a = binary_bitmap ? slot->bitmap.buffer[x + y * slot->bitmap.pitch] : 0xFF; } } } @@ -442,9 +444,9 @@ for (y = 0; y < slot->bitmap.rows; y++) { for (x = 0; x < slot->bitmap.width; x++) { - if (aa ? (slot->bitmap.buffer[x + y * slot->bitmap.pitch] > 0) : HasBit(slot->bitmap.buffer[(x / 8) + y * slot->bitmap.pitch], 7 - (x % 8))) { + if (binary_bitmap ? (slot->bitmap.buffer[x + y * slot->bitmap.pitch] > 0) : HasBit(slot->bitmap.buffer[(x / 8) + y * slot->bitmap.pitch], 7 - (x % 8))) { sprite.data[x + y * sprite.width].m = FACE_COLOUR; - sprite.data[x + y * sprite.width].a = aa ? slot->bitmap.buffer[x + y * slot->bitmap.pitch] : 0xFF; + sprite.data[x + y * sprite.width].a = binary_bitmap ? slot->bitmap.buffer[x + y * slot->bitmap.pitch] : 0xFF; } } }