From 6dd5dfb7d0aa7e1d64f2e49ed3017dcceef6dbb1 Mon Sep 17 00:00:00 2001 From: Martin Kiewitz Date: Fri, 30 Jul 2010 16:08:27 +0000 Subject: SCI: fixing font code handling in kTextSize fixes incorrect window proportions in sq5 when hailing ship at clorox II svn-id: r51511 --- engines/sci/graphics/text16.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'engines/sci') diff --git a/engines/sci/graphics/text16.cpp b/engines/sci/graphics/text16.cpp index 08be203230..61737cad05 100644 --- a/engines/sci/graphics/text16.cpp +++ b/engines/sci/graphics/text16.cpp @@ -233,9 +233,6 @@ int16 GfxText16::GetLongest(const char *text, int16 maxWidth, GuiResourceId orgF void GfxText16::Width(const char *text, int16 from, int16 len, GuiResourceId orgFontId, int16 &textWidth, int16 &textHeight) { uint16 curChar; - GuiResourceId oldFontId = GetFontId(); - int16 oldPenColor = _ports->_curPort->penClr; - textWidth = 0; textHeight = 0; GetFont(); @@ -264,13 +261,17 @@ void GfxText16::Width(const char *text, int16 from, int16 len, GuiResourceId org } } } - SetFont(oldFontId); - _ports->penColor(oldPenColor); return; } void GfxText16::StringWidth(const char *str, GuiResourceId orgFontId, int16 &textWidth, int16 &textHeight) { + GuiResourceId oldFontId = GetFontId(); + int16 oldPenColor = _ports->_curPort->penClr; + Width(str, 0, (int16)strlen(str), orgFontId, textWidth, textHeight); + + SetFont(oldFontId); + _ports->penColor(oldPenColor); } void GfxText16::ShowString(const char *str, GuiResourceId orgFontId, int16 orgPenColor) { -- cgit v1.2.3