DIRECTOR: implement linespacing for text castmember, set line spacing default to 1 in D4

This commit is contained in:
ysj1173886760 2021-07-05 19:42:30 +08:00 committed by Eugene Sandulenko
parent 1492a06a84
commit 8c70bab234
3 changed files with 12 additions and 5 deletions

View File

@ -569,6 +569,9 @@ TextCastMember::TextCastMember(Cast *cast, uint16 castId, Common::SeekableReadSt
_bgpalinfo1 = _bgpalinfo2 = _bgpalinfo3 = 0;
_fgpalinfo1 = _fgpalinfo2 = _fgpalinfo3 = 0xff;
// seems like the line spacing is default to 1 in D4
_lineSpacing = g_director->getVersion() >= 400 ? 1 : 0;
if (version < kFileVer400) {
_flags1 = flags1; // region: 0 - auto, 1 - matte, 2 - disabled
_borderSize = static_cast<SizeType>(stream.readByte());
@ -790,11 +793,12 @@ void TextCastMember::setText(const char *text) {
}
}
// D4 dictionary book said this is line spacing
int TextCastMember::getTextHeight() {
if (_widget)
return ((Graphics::MacText *)_widget)->getTextHeight();
return ((Graphics::MacText *)_widget)->getLineSpacing();
else
warning("TextCastMember::getTextHeight: getting text height when there is no widget, returning 0");
warning("TextCastMember::getTextHeight: getting text line spacing when there is no widget, returning 0");
return 0;
}

View File

@ -259,6 +259,7 @@ public:
uint16 _fgpalinfo1, _fgpalinfo2, _fgpalinfo3;
ButtonType _buttonType;
bool _editable;
int _lineSpacing;
Common::String _ftext;
Common::String _ptext;

View File

@ -958,19 +958,21 @@ bool TextCastMember::setField(int field, const Datum &d) {
_textAlign = align;
_modified = true;
}
}
return true;
case kTheTextFont:
warning("TextCastMember::setField(): Unprocessed setting field \"%s\" of field %d", g_lingo->field2str(field), _castId);
return false;
case kTheTextHeight:
warning("TextCastMember::setField(): Unprocessed setting field \"%s\" of field %d", g_lingo->field2str(field), _castId);
_lineSpacing = d.asInt();
_modified = true;
return false;
case kTheTextSize:
warning("TextCastMember::setField(): Unprocessed setting field \"%s\" of field %d", g_lingo->field2str(field), _castId);
return false;
case kTheTextStyle:
warning("TextCastMember::setField(): Unprocessed setting field \"%s\" of field %d", g_lingo->field2str(field), _castId);
_textSlant = d.asInt();
_modified = true;
return false;
default:
break;