From fcac3986960a02eb2179f5e7f304676187d1925e Mon Sep 17 00:00:00 2001 From: Nimetu Date: Thu, 6 Dec 2018 15:19:54 +0200 Subject: [PATCH] Fixed: More fixes for LineMaxW with scaling --HG-- branch : experimental-ui-scaling --- code/nel/src/gui/view_text.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/code/nel/src/gui/view_text.cpp b/code/nel/src/gui/view_text.cpp index 7ac1bf8a4..8d36c046d 100644 --- a/code/nel/src/gui/view_text.cpp +++ b/code/nel/src/gui/view_text.cpp @@ -920,9 +920,8 @@ namespace NLGUI // *************************************************************************** sint CViewText::getCurrentMultiLineMaxW() const { - sint maxw = ceilf(_LineMaxW * _Scale); if(_MultiLineMaxWOnly) - return maxw; + return _LineMaxW; else { sint offset = (sint)_XReal - (sint)_Parent->getXReal(); @@ -2021,7 +2020,7 @@ namespace NLGUI _W = (sint)ceilf(_Info.StringWidth / _Scale); // Rare case: clamp W => recompute slowly, cut letters - if(_Info.StringWidth > _LineMaxW) + if(_W > _LineMaxW) { TextContext->erase (_Index); @@ -2038,6 +2037,8 @@ namespace NLGUI dotWidth = si.StringWidth; } + // scale LineMaxW to actual font size + float fLineMaxW = (float)_LineMaxW * _Scale; float rWidthCurrentLine = 0; // for all the text if (_ClampRight) @@ -2048,7 +2049,7 @@ namespace NLGUI ucstring ucStrLetter; ucStrLetter= ucLetter; si = TextContext->getStringInfo (ucStrLetter); - if ((rWidthCurrentLine + si.StringWidth + dotWidth) > _LineMaxW) + if ((rWidthCurrentLine + si.StringWidth + dotWidth) > fLineMaxW) { break; } @@ -2074,7 +2075,7 @@ namespace NLGUI ucstring ucStrLetter; ucStrLetter= ucLetter; si = TextContext->getStringInfo (ucStrLetter); - if ((rWidthCurrentLine + si.StringWidth + dotWidth) > _LineMaxW) + if ((rWidthCurrentLine + si.StringWidth + dotWidth) > fLineMaxW) { break; }