GRAPHICS: Use MacFont in lieu of Graphics::Font in MacText
This commit is contained in:
parent
d602850b0c
commit
af664fe757
3 changed files with 14 additions and 10 deletions
|
@ -846,11 +846,10 @@ void Frame::renderText(Graphics::ManagedSurface &surface, uint16 spriteId, Commo
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Graphics::MacFont macFont = Graphics::MacFont(textCast->fontId, textCast->fontSize, textCast->textSlant);
|
Graphics::MacFont *macFont = new Graphics::MacFont(textCast->fontId, textCast->fontSize, textCast->textSlant);
|
||||||
|
// TODO: MacText must destroy me
|
||||||
|
|
||||||
const Graphics::Font *font = _vm->_wm->_fontMan->getFont(macFont);
|
debugC(3, kDebugText, "renderText: x: %d y: %d w: %d h: %d font: '%s'", x, y, width, height, _vm->_wm->_fontMan->getFontName(*macFont));
|
||||||
|
|
||||||
debugC(3, kDebugText, "renderText: x: %d y: %d w: %d h: %d font: '%s'", x, y, width, height, _vm->_wm->_fontMan->getFontName(macFont));
|
|
||||||
|
|
||||||
int alignment = (int)textCast->textAlign;
|
int alignment = (int)textCast->textAlign;
|
||||||
if (alignment == -1)
|
if (alignment == -1)
|
||||||
|
@ -866,7 +865,7 @@ void Frame::renderText(Graphics::ManagedSurface &surface, uint16 spriteId, Commo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Graphics::MacText mt(ftext, _vm->_wm, font, 0x00, 0xff, width, (Graphics::TextAlign)alignment);
|
Graphics::MacText mt(ftext, _vm->_wm, macFont, 0x00, 0xff, width, (Graphics::TextAlign)alignment);
|
||||||
mt.setInterLinear(1);
|
mt.setInterLinear(1);
|
||||||
mt.render();
|
mt.render();
|
||||||
const Graphics::ManagedSurface *textSurface = mt.getSurface();
|
const Graphics::ManagedSurface *textSurface = mt.getSurface();
|
||||||
|
|
|
@ -37,10 +37,10 @@ const Font *MacFontRun::getFont() {
|
||||||
return font;
|
return font;
|
||||||
}
|
}
|
||||||
|
|
||||||
MacText::MacText(Common::String s, MacWindowManager *wm, const Font *font, int fgcolor, int bgcolor, int maxWidth, TextAlign textAlignment) {
|
MacText::MacText(Common::String s, MacWindowManager *wm, const MacFont *macFont, int fgcolor, int bgcolor, int maxWidth, TextAlign textAlignment) {
|
||||||
_str = s;
|
_str = s;
|
||||||
_wm = wm;
|
_wm = wm;
|
||||||
_font = font;
|
_macFont = macFont;
|
||||||
_fgcolor = fgcolor;
|
_fgcolor = fgcolor;
|
||||||
_bgcolor = bgcolor;
|
_bgcolor = bgcolor;
|
||||||
_maxWidth = maxWidth;
|
_maxWidth = maxWidth;
|
||||||
|
@ -51,7 +51,12 @@ MacText::MacText(Common::String s, MacWindowManager *wm, const Font *font, int f
|
||||||
|
|
||||||
_interLinear = 0; // 0 pixels between the lines by default
|
_interLinear = 0; // 0 pixels between the lines by default
|
||||||
|
|
||||||
_defaultFormatting.font = font;
|
if (macFont) {
|
||||||
|
_defaultFormatting.font = wm->_fontMan->getFont(*macFont);
|
||||||
|
} else {
|
||||||
|
_defaultFormatting.font = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
_defaultFormatting.wm = wm;
|
_defaultFormatting.wm = wm;
|
||||||
|
|
||||||
_currentFormatting = _defaultFormatting;
|
_currentFormatting = _defaultFormatting;
|
||||||
|
|
|
@ -88,7 +88,7 @@ struct MacTextLine {
|
||||||
|
|
||||||
class MacText {
|
class MacText {
|
||||||
public:
|
public:
|
||||||
MacText(Common::String s, MacWindowManager *wm, const Graphics::Font *font, int fgcolor, int bgcolor,
|
MacText(Common::String s, MacWindowManager *wm, const MacFont *font, int fgcolor, int bgcolor,
|
||||||
int maxWidth = -1, TextAlign textAlignment = kTextAlignLeft);
|
int maxWidth = -1, TextAlign textAlignment = kTextAlignLeft);
|
||||||
|
|
||||||
void setInterLinear(int interLinear);
|
void setInterLinear(int interLinear);
|
||||||
|
@ -113,7 +113,7 @@ private:
|
||||||
MacWindowManager *_wm;
|
MacWindowManager *_wm;
|
||||||
|
|
||||||
Common::String _str;
|
Common::String _str;
|
||||||
const Graphics::Font *_font;
|
const MacFont *_macFont;
|
||||||
int _fgcolor, _bgcolor;
|
int _fgcolor, _bgcolor;
|
||||||
|
|
||||||
int _maxWidth;
|
int _maxWidth;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue