mirror of
https://github.com/vcmi/vcmi.git
synced 2025-04-25 12:14:46 +02:00
CComponent: do not always assume 80 for text
This commit is contained in:
parent
7a04c28815
commit
da8840c499
@ -73,7 +73,13 @@ void CComponent::init(Etype Type, int Subtype, int Val, ESize imageSize)
|
|||||||
|
|
||||||
pos.h += 4; //distance between text and image
|
pos.h += 4; //distance between text and image
|
||||||
|
|
||||||
std::vector<std::string> textLines = CMessage::breakText(getSubtitle(), std::max<int>(80, pos.w), font);
|
auto max = 80;
|
||||||
|
if (size < medium)
|
||||||
|
max = 40;
|
||||||
|
if (size < small)
|
||||||
|
max = 30;
|
||||||
|
|
||||||
|
std::vector<std::string> textLines = CMessage::breakText(getSubtitle(), std::max<int>(max, pos.w), font);
|
||||||
for(auto & line : textLines)
|
for(auto & line : textLines)
|
||||||
{
|
{
|
||||||
int height = static_cast<int>(graphics->fonts[font]->getLineHeight());
|
int height = static_cast<int>(graphics->fonts[font]->getLineHeight());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user