GRAPHICS: MACGUI: set fgcolor as default color, fix the behaviour for appendText when _str is empty

This commit is contained in:
ysj1173886760 2021-04-14 16:19:58 +08:00 committed by Eugene Sandulenko
parent 803cd6d715
commit a98097e8d2

View File

@ -204,6 +204,8 @@ MacText::MacText(const Common::String &s, MacWindowManager *wm, const MacFont *m
if (macFont) {
_defaultFormatting = MacFontRun(_wm, macFont->getId(), macFont->getSlant(), macFont->getSize(), 0, 0, 0);
_defaultFormatting.font = wm->_fontMan->getFont(*macFont);
// try to set fgcolor as default color in chunks
_defaultFormatting.fgcolor = _fgcolor;
} else {
_defaultFormatting.font = NULL;
}
@ -864,6 +866,15 @@ void MacText::appendText(const Common::U32String &str, int fontId, int fontSize,
_currentFormatting = fontRun;
// we check _str here, if _str is empty but _textLines is not empty, and they are not the end of paragraph
// then we remove those empty lines
// too many special check may cause some strange problem in the future
if (_str.empty()) {
while (!_textLines.empty() && !_textLines.back().paragraphEnd) {
removeLastLine();
}
}
if (!skipAdd) {
_str += fontRun.toString();
_str += str;