mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-12 10:03:53 +02:00
text fixes
This commit is contained in:
parent
7fdddee503
commit
bb2f016f49
@ -118,6 +118,12 @@ size_t CTrueTypeFont::getStringWidthScaled(const std::string & text) const
|
|||||||
{
|
{
|
||||||
int width;
|
int width;
|
||||||
TTF_SizeUTF8(font.get(), text.c_str(), &width, nullptr);
|
TTF_SizeUTF8(font.get(), text.c_str(), &width, nullptr);
|
||||||
|
|
||||||
|
if (outline)
|
||||||
|
width += getScalingFactor();
|
||||||
|
if (dropShadow || outline)
|
||||||
|
width += getScalingFactor();
|
||||||
|
|
||||||
return width;
|
return width;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -279,7 +279,7 @@ CStackWindow::BonusLineSection::BonusLineSection(CStackWindow * owner, size_t li
|
|||||||
std::string t = bonusNames.count(bi.bonusSource) ? bonusNames[bi.bonusSource] : CGI->generaltexth->translate("vcmi.bonusSource.other");
|
std::string t = bonusNames.count(bi.bonusSource) ? bonusNames[bi.bonusSource] : CGI->generaltexth->translate("vcmi.bonusSource.other");
|
||||||
int maxLen = 50;
|
int maxLen = 50;
|
||||||
EFonts f = FONT_TINY;
|
EFonts f = FONT_TINY;
|
||||||
Point pText = p + Point(3, 40);
|
Point pText = p + Point(4, 38);
|
||||||
|
|
||||||
// 1px Black border
|
// 1px Black border
|
||||||
bonusSource[leftRight].push_back(std::make_shared<CLabel>(pText.x - 1, pText.y, f, ETextAlignment::TOPLEFT, Colors::BLACK, t, maxLen));
|
bonusSource[leftRight].push_back(std::make_shared<CLabel>(pText.x - 1, pText.y, f, ETextAlignment::TOPLEFT, Colors::BLACK, t, maxLen));
|
||||||
|
@ -117,7 +117,13 @@ std::vector<std::string> CMessage::breakText(std::string text, size_t maxLineWid
|
|||||||
color = "";
|
color = "";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
printableString.append(text.data() + currPos, symbolSize);
|
{
|
||||||
|
std::string character = "";
|
||||||
|
character.append(text.data() + currPos, symbolSize);
|
||||||
|
if(fontPtr->getStringWidth(printableString + character) > maxLineWidth)
|
||||||
|
break;
|
||||||
|
printableString += character;
|
||||||
|
}
|
||||||
|
|
||||||
currPos += symbolSize;
|
currPos += symbolSize;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user