mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-03 07:30:56 +00:00
DIRECTOR: LINGO: Implement MacText::enforceTextFont() and use it to implement STUB kTheTextFont in TextCastMember::setField()
This commit is contained in:
parent
a982da07d7
commit
334bbd11a3
@ -1036,7 +1036,7 @@ void TextCastMember::importRTE(byte *text) {
|
||||
}
|
||||
|
||||
void TextCastMember::setText(const Common::U32String &text) {
|
||||
//Do nothing if text did not change
|
||||
// Do nothing if text did not change
|
||||
if (_ptext.equals(text))
|
||||
return;
|
||||
|
||||
|
@ -1041,8 +1041,9 @@ bool TextCastMember::setField(int field, const Datum &d) {
|
||||
}
|
||||
return true;
|
||||
case kTheTextFont:
|
||||
_fontId = g_director->_wm->_fontMan->getFontIdByName(d.asString());
|
||||
setText(this->_ptext);
|
||||
((Graphics::MacText *)toEdit->_widget)->enforceTextFont((uint16) g_director->_wm->_fontMan->getFontIdByName(d.asString()));
|
||||
_ptext = ((Graphics::MacText *)toEdit->_widget)->getPlainText();
|
||||
_ftext = ((Graphics::MacText *)toEdit->_widget)->getTextChunk(0, 0, -1, -1, true);
|
||||
_modified = true;
|
||||
return false;
|
||||
case kTheTextHeight:
|
||||
|
@ -337,6 +337,18 @@ void MacText::setColors(uint32 fg, uint32 bg) {
|
||||
_contentIsDirty = true;
|
||||
}
|
||||
|
||||
void MacText::enforceTextFont(uint16 fontId) {
|
||||
for (uint i = 0; i < _textLines.size(); i++) {
|
||||
for (uint j = 0; j < _textLines[i].chunks.size(); j++) {
|
||||
_textLines[i].chunks[j].fontId = fontId;
|
||||
}
|
||||
}
|
||||
|
||||
_fullRefresh = true;
|
||||
render();
|
||||
_contentIsDirty = true;
|
||||
}
|
||||
|
||||
void MacText::setTextSize(int textSize) {
|
||||
for (uint i = 0; i < _textLines.size(); i++) {
|
||||
for (uint j = 0; j < _textLines[i].chunks.size(); j++) {
|
||||
|
@ -194,6 +194,7 @@ public:
|
||||
void appendText(const Common::U32String &str, const Font *font, uint16 r = 0, uint16 g = 0, uint16 b = 0, bool skipAdd = false);
|
||||
|
||||
int getTextFont() { return _defaultFormatting.fontId; }
|
||||
void enforceTextFont(uint16 fontId);
|
||||
|
||||
// because currently, we are counting linespacing as font height
|
||||
int getTextSize() { return _defaultFormatting.fontSize; }
|
||||
|
Loading…
Reference in New Issue
Block a user