aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--graphics/macgui/mactext.cpp11
-rw-r--r--graphics/macgui/mactext.h19
2 files changed, 17 insertions, 13 deletions
diff --git a/graphics/macgui/mactext.cpp b/graphics/macgui/mactext.cpp
index 8d83c19ceb..4e86fcff49 100644
--- a/graphics/macgui/mactext.cpp
+++ b/graphics/macgui/mactext.cpp
@@ -56,6 +56,8 @@ MacText::MacText(Common::String s, MacWindowManager *wm, const Font *font, int f
_defaultFormatting.font = font;
_defaultFormatting.wm = wm;
+
+ _currentFormatting = _defaultFormatting;
}
void MacText::splitString(Common::String &str) {
@@ -64,6 +66,8 @@ void MacText::splitString(Common::String &str) {
Common::String tmp;
bool prevCR = false;
+ int curLine = _text.empty() ? 0 : _text.size() - 1;
+
while (*s) {
if (*s == '\001') {
s++;
@@ -84,6 +88,13 @@ void MacText::splitString(Common::String &str) {
debug(8, "******** splitString: fontId: %d, textSlant: %d, unk3: %d, fontSize: %d, p0: %x p1: %x p2: %x",
fontId, textSlant, unk3f, fontSize, palinfo1, palinfo2, palinfo3);
+ _currentFormatting.setValues(_wm, fontId, textSlant, unk3f, fontSize, palinfo1, palinfo2, palinfo3);
+
+ if (_formatting.empty())
+ _formatting.resize(1);
+
+ _formatting[curLine].push_back(_currentFormatting);
+
continue;
}
}
diff --git a/graphics/macgui/mactext.h b/graphics/macgui/mactext.h
index 241ad65314..17c3b394bd 100644
--- a/graphics/macgui/mactext.h
+++ b/graphics/macgui/mactext.h
@@ -45,26 +45,18 @@ struct MacFontRun {
MacFontRun() {
wm = nullptr;
- fontId = textSlant = unk3f = fontSize;
- palinfo1 = palinfo2 = palinfo3;
+ fontId = textSlant = unk3f = fontSize = 0;
+ palinfo1 = palinfo2 = palinfo3 = 0;
font = nullptr;
}
MacFontRun(MacWindowManager *wm_, uint16 fontId_, byte textSlant_, byte unk3f_, uint16 fontSize_,
uint16 palinfo1_, uint16 palinfo2_, uint16 palinfo3_) {
- wm = wm_;
- fontId = fontId_;
- textSlant = textSlant_;
- unk3f = unk3f_;
- fontSize = fontSize_;
- palinfo1 = palinfo1_;
- palinfo2 = palinfo2_;
- palinfo3 = palinfo3_;
- font = nullptr;
+ setValues(wm_, fontId_, textSlant_, unk3f_, fontSize_, palinfo1_, palinfo2_, palinfo3_);
}
void setValues(MacWindowManager *wm_, uint16 fontId_, byte textSlant_, byte unk3f_, uint16 fontSize_,
- uint16 palinfo1_, uint16 palinfo2_, uint16 palinfo3_, const Font *font_) {
+ uint16 palinfo1_, uint16 palinfo2_, uint16 palinfo3_) {
wm = wm_;
fontId = fontId_;
textSlant = textSlant_;
@@ -73,7 +65,7 @@ struct MacFontRun {
palinfo1 = palinfo1_;
palinfo2 = palinfo2_;
palinfo3 = palinfo3_;
- font = font_;
+ font = nullptr;
}
const Font *getFont();
@@ -120,6 +112,7 @@ private:
Common::Array< Common::Array<MacFontRun> > _formatting;
MacFontRun _defaultFormatting;
+ MacFontRun _currentFormatting;
};
} // End of namespace Graphics