Merge with experimental-ui-scaling

--HG--
branch : develop
This commit is contained in:
Nimetu 2018-12-06 15:20:18 +02:00
commit a34d4342d7

View file

@ -920,9 +920,8 @@ namespace NLGUI
// *************************************************************************** // ***************************************************************************
sint CViewText::getCurrentMultiLineMaxW() const sint CViewText::getCurrentMultiLineMaxW() const
{ {
sint maxw = ceilf(_LineMaxW * _Scale);
if(_MultiLineMaxWOnly) if(_MultiLineMaxWOnly)
return maxw; return _LineMaxW;
else else
{ {
sint offset = (sint)_XReal - (sint)_Parent->getXReal(); sint offset = (sint)_XReal - (sint)_Parent->getXReal();
@ -2021,7 +2020,7 @@ namespace NLGUI
_W = (sint)ceilf(_Info.StringWidth / _Scale); _W = (sint)ceilf(_Info.StringWidth / _Scale);
// Rare case: clamp W => recompute slowly, cut letters // Rare case: clamp W => recompute slowly, cut letters
if(_Info.StringWidth > _LineMaxW) if(_W > _LineMaxW)
{ {
TextContext->erase (_Index); TextContext->erase (_Index);
@ -2038,6 +2037,8 @@ namespace NLGUI
dotWidth = si.StringWidth; dotWidth = si.StringWidth;
} }
// scale LineMaxW to actual font size
float fLineMaxW = (float)_LineMaxW * _Scale;
float rWidthCurrentLine = 0; float rWidthCurrentLine = 0;
// for all the text // for all the text
if (_ClampRight) if (_ClampRight)
@ -2048,7 +2049,7 @@ namespace NLGUI
ucstring ucStrLetter; ucstring ucStrLetter;
ucStrLetter= ucLetter; ucStrLetter= ucLetter;
si = TextContext->getStringInfo (ucStrLetter); si = TextContext->getStringInfo (ucStrLetter);
if ((rWidthCurrentLine + si.StringWidth + dotWidth) > _LineMaxW) if ((rWidthCurrentLine + si.StringWidth + dotWidth) > fLineMaxW)
{ {
break; break;
} }
@ -2074,7 +2075,7 @@ namespace NLGUI
ucstring ucStrLetter; ucstring ucStrLetter;
ucStrLetter= ucLetter; ucStrLetter= ucLetter;
si = TextContext->getStringInfo (ucStrLetter); si = TextContext->getStringInfo (ucStrLetter);
if ((rWidthCurrentLine + si.StringWidth + dotWidth) > _LineMaxW) if ((rWidthCurrentLine + si.StringWidth + dotWidth) > fLineMaxW)
{ {
break; break;
} }