Fixed maximal font size

--HG--
branch : feature
This commit is contained in:
BojanKverh 2016-07-29 21:59:48 +02:00
parent c5f38207fd
commit 06cfaea3b3
2 changed files with 3 additions and 2 deletions

View file

@ -138,12 +138,13 @@ bool VTextManager::IsBigEnough(qreal fW, qreal fH, int iFontSize)
TextLine tlOut = tl;
fnt.setPixelSize(iFontSize + tl.m_iFontSize);
QFontMetrics fm(fnt);
int iHorSp = fm.width(" ");
tlOut.m_iHeight = fm.height();
QStringList qslLines = SplitString(tlOut.m_qsText, fW, fm);
for (int iL = 0; iL < qslLines.count(); ++iL)
{
// check if every line fits within the label width
if (fm.width(qslLines[iL]) + 2*GetSpacing() > fW)
if (fm.width(qslLines[iL]) + iHorSp > fW)
{
return false;
}

View file

@ -9,7 +9,7 @@
#include "../ifc/xml/vabstractpattern.h"
#define MIN_FONT_SIZE 12
#define MAX_FONT_SIZE 128
#define MAX_FONT_SIZE 1024
/**
* @brief The TextLine struct holds the information about one text line