Skip to content

Commit

Permalink
GRAPHICS: MACGUI: Keep original string in MacText
Browse files Browse the repository at this point in the history
  • Loading branch information
sev- committed Aug 1, 2017
1 parent 2f5b1f0 commit 115a740
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
15 changes: 15 additions & 0 deletions graphics/macgui/mactext.cpp
Expand Up @@ -37,6 +37,15 @@ const Font *MacFontRun::getFont() {
return font;
}

const Common::String MacFontRun::toString() {
return Common::String::format("\001\015%c%c%c%c%c%c%c%c%c%c%c%c",
(fontId >> 8) & 0xff, fontId & 0xff,
textSlant & 0xff, unk3f & 0xff,
(fontSize >> 8) & 0xff, fontSize & 0xff,
(palinfo1 >> 8) & 0xff, palinfo1 & 0xff,
(palinfo2 >> 8) & 0xff, palinfo2 & 0xff,
(palinfo3 >> 8) & 0xff, palinfo3 & 0xff);
}

MacText::~MacText(){
delete _macFont;
Expand Down Expand Up @@ -370,6 +379,9 @@ void MacText::appendText(Common::String str, int fontId = kMacFontChicago, int f

MacFontRun fontRun = MacFontRun(_wm, fontId, fontSlant, 0, fontSize, 0, 0, 0);

_str += fontRun.toString();
_str += str;

resizeAndFormatLines(newLines, &fontRun);

splitString(str);
Expand All @@ -382,6 +394,9 @@ void MacText::appendTextDefault(Common::String str) {
uint oldLen = _textLines.size();
uint newLines = 1 + getNewlinesInString(str);

_str += _defaultFormatting.toString();
_str += str;

resizeAndFormatLines(newLines, &_defaultFormatting);

splitString(str);
Expand Down
2 changes: 2 additions & 0 deletions graphics/macgui/mactext.h
Expand Up @@ -71,6 +71,8 @@ struct MacFontRun {
}

const Font *getFont();

const Common::String toString();
};

struct MacTextLine {
Expand Down

0 comments on commit 115a740

Please sign in to comment.