diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-06-14 19:04:58 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-06-14 19:04:58 +0300 |
commit | acc395f67dbe683787f1aeb0bf96fe0a16f62c5e (patch) | |
tree | 33139c7cdf1b807732f86ea0de292ba12ed20249 /src/gui | |
parent | 2bc5d7a1bfaf32f5df3121bbc4d07b886cf9ffc3 (diff) | |
download | manaverse-acc395f67dbe683787f1aeb0bf96fe0a16f62c5e.tar.gz manaverse-acc395f67dbe683787f1aeb0bf96fe0a16f62c5e.tar.bz2 manaverse-acc395f67dbe683787f1aeb0bf96fe0a16f62c5e.tar.xz manaverse-acc395f67dbe683787f1aeb0bf96fe0a16f62c5e.zip |
Add workaround to browserbox if text line start with bold sign.
This fix only most used cases.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/widgets/browserbox.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp index 22a6cec9d..2d9202805 100644 --- a/src/gui/widgets/browserbox.cpp +++ b/src/gui/widgets/browserbox.cpp @@ -307,6 +307,10 @@ void BrowserBox::addRow(const std::string &row, const bool atTop) if (mMode == BrowserBoxMode::AUTO_SIZE) { std::string plain = newRow; + // workaround if used only one string started from bold + // width for this string can be calculated wrong + // this workaround fix width if string start from bold sign + const bool startBold = (plain.find("##B") == 0); for (idx1 = plain.find("##"); idx1 != std::string::npos; idx1 = plain.find("##")) @@ -315,7 +319,8 @@ void BrowserBox::addRow(const std::string &row, const bool atTop) } // Adjust the BrowserBox size - const int w = font->getWidth(plain); + const int w = startBold ? + boldFont->getWidth(plain) : font->getWidth(plain); if (w > getWidth()) setWidth(w); } |