From 2098aaece5df32e293ff22398b72a30e6eb6e920 Mon Sep 17 00:00:00 2001 From: kervala Date: Sun, 26 Jun 2016 15:17:32 +0200 Subject: [PATCH] Fixed: The height of a CViewText was wrong in some cases because "|" is not the tallest character of the current font (ryzom.ttf) --- code/nel/src/gui/view_text.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/code/nel/src/gui/view_text.cpp b/code/nel/src/gui/view_text.cpp index 022347525..8c2ca96d3 100644 --- a/code/nel/src/gui/view_text.cpp +++ b/code/nel/src/gui/view_text.cpp @@ -2718,9 +2718,18 @@ namespace NLGUI TextContext->setOblique (_Oblique); // Letter size - UTextContext::CStringInfo si = TextContext->getStringInfo(ucstring("|")); // for now we can't now that directly from UTextContext - _FontHeight = (uint) si.StringHeight; // + (_Shadow?(_ShadowOutline?2:1):0); - _FontLegHeight = (uint) si.StringLine; // + (_Shadow?(_ShadowOutline?2:1):0); + ucstring chars; + // instead of using the height of "|" that depends on font, + // we're using 2 characters: + // - "_" that should be the character with the lowest part + // - A with an accent for the highest part + chars.fromUtf8("_\xc3\x84"); + + // for now we can't know that directly from UTextContext + UTextContext::CStringInfo si = TextContext->getStringInfo(chars); + // add a padding of 1 pixel else the top will be truncated + _FontHeight = (uint) si.StringHeight+1; + _FontLegHeight = (uint) si.StringLine; // Space width si = TextContext->getStringInfo(ucstring(" "));