summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/gui/truetypefont.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/gui/truetypefont.cpp b/src/gui/truetypefont.cpp
index 3986cca5..82a22bc2 100644
--- a/src/gui/truetypefont.cpp
+++ b/src/gui/truetypefont.cpp
@@ -130,6 +130,12 @@ void TrueTypeFont::drawString(gcn::Graphics *graphics,
}
gcn::Color col = g->getColor();
+ float alpha = 1.0f;
+ if (col.a != 255) alpha = col.a / 255.0f;
+ col.a = 255;
+ /* alpha value is ignored at sting generation so it makes no sense to
+ * cache the same text with different alpha values.
+ */
TextChunk chunk(text, col);
@@ -157,6 +163,7 @@ void TrueTypeFont::drawString(gcn::Graphics *graphics,
cache.front().generate(mFont);
}
+ if (alpha != 1.0f) cache.front().img->setAlpha(alpha);
g->drawImage(cache.front().img, x, y);
}