summaryrefslogtreecommitdiff
path: root/src/gfx.cpp
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2011-10-07 07:48:59 +0000
committerpeter1138 <peter1138@openttd.org>2011-10-07 07:48:59 +0000
commit8a41530585402c7850ce68542ec1ea551d2cb277 (patch)
treeec6ff06bcbc14d8ca3553e8dab0340b2c2ce4866 /src/gfx.cpp
parentca1df3ddab2c70cef9edcdc462e07fdad17f4ab9 (diff)
downloadopenttd-8a41530585402c7850ce68542ec1ea551d2cb277.tar.xz
(svn r23009) -Change: Improve appearance of antialiased text with shadow.
Diffstat (limited to 'src/gfx.cpp')
-rw-r--r--src/gfx.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/gfx.cpp b/src/gfx.cpp
index c5fbcac2f..9d6d0b1ae 100644
--- a/src/gfx.cpp
+++ b/src/gfx.cpp
@@ -1057,6 +1057,7 @@ void DrawCharCentered(WChar c, int x, int y, TextColour colour)
static int ReallyDoDrawString(const UChar *string, int x, int y, DrawStringParams &params, bool parse_string_also_when_clipped)
{
DrawPixelInfo *dpi = _cur_dpi;
+ bool draw_shadow = GetDrawGlyphShadow();
UChar c;
int xo = x;
@@ -1087,7 +1088,13 @@ skip_cont:;
if (IsPrintable(c) && !IsTextDirectionChar(c)) {
if (x >= dpi->left + dpi->width) goto skip_char;
if (x + _max_char_width >= dpi->left) {
- GfxMainBlitter(GetGlyph(params.fontsize, c), x, y, BM_COLOUR_REMAP);
+ const Sprite *glyph = GetGlyph(params.fontsize, c);
+ if (draw_shadow && params.fontsize == FS_NORMAL && params.cur_colour != TC_BLACK && !(c >= SCC_SPRITE_START && c <= SCC_SPRITE_END)) {
+ SetColourRemap(TC_BLACK);
+ GfxMainBlitter(glyph, x + 1, y + 1, BM_COLOUR_REMAP);
+ SetColourRemap(params.cur_colour);
+ }
+ GfxMainBlitter(glyph, x, y, BM_COLOUR_REMAP);
}
x += GetCharacterWidth(params.fontsize, c);
} else if (c == '\n') { // newline = {}