From 7d044c570cd9476b28af6261d69e39bf43ab5a9f Mon Sep 17 00:00:00 2001 From: stevenhoefel Date: Tue, 7 Feb 2017 16:26:59 +1100 Subject: GRAPHICS: Recalculate text area sizing if interLinear is changed. --- graphics/macgui/mactext.cpp | 7 ++++++- graphics/macgui/mactext.h | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'graphics/macgui') diff --git a/graphics/macgui/mactext.cpp b/graphics/macgui/mactext.cpp index e15c8f8da6..180b08175b 100644 --- a/graphics/macgui/mactext.cpp +++ b/graphics/macgui/mactext.cpp @@ -298,6 +298,11 @@ int MacText::getLineHeight(int line) { return _textLines[line].height; } +void MacText::setInterLinear(int interLinear) { + _interLinear = interLinear; + recalcDims(); +} + void MacText::recalcDims() { int y = 0; _textMaxWidth = 0; @@ -309,7 +314,7 @@ void MacText::recalcDims() { _textMaxWidth = MAX(_textMaxWidth, getLineWidth(i, true)); } - _textMaxHeight = y; + _textMaxHeight = y - _interLinear; } void MacText::draw(ManagedSurface *g, int x, int y, int w, int h, int xoff, int yoff) { diff --git a/graphics/macgui/mactext.h b/graphics/macgui/mactext.h index 4df4f1c3aa..85c855950f 100644 --- a/graphics/macgui/mactext.h +++ b/graphics/macgui/mactext.h @@ -91,7 +91,7 @@ public: MacText(Common::String s, MacWindowManager *wm, const Graphics::Font *font, int fgcolor, int bgcolor, int maxWidth = -1, TextAlign textAlignment = kTextAlignLeft); - void setInterLinear(int interLinear) { _interLinear = interLinear; } + void setInterLinear(int interLinear); void draw(ManagedSurface *g, int x, int y, int w, int h, int xoff, int yoff); void appendText(Common::String str); -- cgit v1.2.3