summaryrefslogtreecommitdiff
path: root/src/text.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/text.cpp')
-rw-r--r--src/text.cpp12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/text.cpp b/src/text.cpp
index 29bed5375..41b2b01ca 100644
--- a/src/text.cpp
+++ b/src/text.cpp
@@ -44,15 +44,14 @@ Text::Text(const std::string &text, const int x, const int y,
const gcn::Graphics::Alignment alignment,
const gcn::Color* color, const bool isSpeech,
gcn::Font *const font) :
+ mFont(font ? font : gui->getFont()),
+ mY(y),
+ mWidth(mFont->getWidth(text)),
+ mHeight(mFont->getHeight()),
mText(text),
mColor(color),
mIsSpeech(isSpeech)
{
- if (!font)
- mFont = gui->getFont();
- else
- mFont = font;
-
if (!textManager)
{
textManager = new TextManager;
@@ -74,8 +73,6 @@ Text::Text(const std::string &text, const int x, const int y,
}
}
++mInstances;
- mHeight = mFont->getHeight();
- mWidth = mFont->getWidth(text);
switch (alignment)
{
@@ -92,7 +89,6 @@ Text::Text(const std::string &text, const int x, const int y,
break;
}
mX = x - mXOffset;
- mY = y;
if (textManager)
textManager->addText(this);
}