diff --git a/src/modules/graphics/Font.cpp b/src/modules/graphics/Font.cpp index 6d111b0e4..2bd62ff1d 100644 --- a/src/modules/graphics/Font.cpp +++ b/src/modules/graphics/Font.cpp @@ -153,9 +153,19 @@ void Font::createTexture() image->setFilter(filter); { - // Initialize the texture with transparent black. size_t bpp = getPixelFormatSize(pixelFormat); - std::vector emptydata(size.width * size.height * bpp, 0); + size_t pixelcount = size.width * size.height; + + // Initialize the texture with transparent white for Luminance-Alpha + // formats (since we keep luminance constant and vary alpha in those + // glyphs), and transparent black otherwise. + std::vector emptydata(pixelcount * bpp, 0); + + if (pixelFormat == PIXELFORMAT_LA8) + { + for (size_t i = 0; i < pixelcount; i++) + emptydata[i * 2 + 0] = 255; + } Rect rect = {0, 0, size.width, size.height}; image->replacePixels(emptydata.data(), emptydata.size(), 0, 0, rect, false);