diff --git a/src/os/windows/font_win32.cpp b/src/os/windows/font_win32.cpp --- a/src/os/windows/font_win32.cpp +++ b/src/os/windows/font_win32.cpp @@ -476,9 +476,10 @@ void Win32FontCache::ClearFontCache() GetGlyphOutline(this->dc, key, GGO_GLYPH_INDEX | (aa ? GGO_GRAY8_BITMAP : GGO_BITMAP), &gm, size, bmp, &mat); } - /* Add 1 pixel for the shadow on the medium font. Our sprite must be at least 1x1 pixel. */ - uint width = std::max(1U, (uint)gm.gmBlackBoxX + (this->fs == FS_NORMAL)); - uint height = std::max(1U, (uint)gm.gmBlackBoxY + (this->fs == FS_NORMAL)); + /* Add 1 scaled pixel for the shadow on the medium font. Our sprite must be at least 1x1 pixel. */ + uint shadow = (this->fs == FS_NORMAL) ? ScaleGUITrad(1) : 0; + uint width = std::max(1U, (uint)gm.gmBlackBoxX + shadow); + uint height = std::max(1U, (uint)gm.gmBlackBoxY + shadow); /* Limit glyph size to prevent overflows later on. */ if (width > MAX_GLYPH_DIM || height > MAX_GLYPH_DIM) usererror("Font glyph is too large"); @@ -506,8 +507,8 @@ void Win32FontCache::ClearFontCache() for (uint y = 0; y < gm.gmBlackBoxY; y++) { for (uint x = 0; x < gm.gmBlackBoxX; x++) { if (aa ? (bmp[x + y * pitch] > 0) : HasBit(bmp[(x / 8) + y * 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 ? (bmp[x + y * pitch] << 2) - 1 : 0xFF; + sprite.data[shadow + x + (shadow + y) * sprite.width].m = SHADOW_COLOUR; + sprite.data[shadow + x + (shadow + y) * sprite.width].a = aa ? (bmp[x + y * pitch] << 2) - 1 : 0xFF; } } }