aboutsummaryrefslogtreecommitdiff
path: root/engines/wintermute/base/font
diff options
context:
space:
mode:
authorEinar Johan Trøan Sømåen2012-07-26 15:59:26 +0200
committerEinar Johan Trøan Sømåen2012-07-26 15:59:26 +0200
commitef11f9d0c53cbdd9d88a99143de6f43f34d7e24d (patch)
tree8dfaee0ba16e18a8e3772dd5afc9123d5c4e78d2 /engines/wintermute/base/font
parent38507fa9895620639d8733dbb4e085dfb2282a33 (diff)
downloadscummvm-rg350-ef11f9d0c53cbdd9d88a99143de6f43f34d7e24d.tar.gz
scummvm-rg350-ef11f9d0c53cbdd9d88a99143de6f43f34d7e24d.tar.bz2
scummvm-rg350-ef11f9d0c53cbdd9d88a99143de6f43f34d7e24d.zip
WINTERMUTE: Run Astyle with add-braces to break one-line statements into easier-to-read-code.
Diffstat (limited to 'engines/wintermute/base/font')
-rw-r--r--engines/wintermute/base/font/base_font.cpp7
-rw-r--r--engines/wintermute/base/font/base_font_bitmap.cpp115
-rw-r--r--engines/wintermute/base/font/base_font_storage.cpp16
-rw-r--r--engines/wintermute/base/font/base_font_truetype.cpp119
-rw-r--r--engines/wintermute/base/font/base_font_truetype.h4
5 files changed, 185 insertions, 76 deletions
diff --git a/engines/wintermute/base/font/base_font.cpp b/engines/wintermute/base/font/base_font.cpp
index d576b834a2..937557f4d7 100644
--- a/engines/wintermute/base/font/base_font.cpp
+++ b/engines/wintermute/base/font/base_font.cpp
@@ -187,7 +187,9 @@ bool BaseFont::isTrueType(BaseGame *gameRef, const char *filename) {
byte *buffer = gameRef->_fileManager->readWholeFile(filename);
- if (buffer == NULL) return false;
+ if (buffer == NULL) {
+ return false;
+ }
byte *WorkBuffer = buffer;
@@ -195,8 +197,9 @@ bool BaseFont::isTrueType(BaseGame *gameRef, const char *filename) {
BaseParser parser(gameRef);
bool ret = false;
- if (parser.getCommand((char **)&WorkBuffer, commands, (char **)&params) == TOKEN_TTFONT)
+ if (parser.getCommand((char **)&WorkBuffer, commands, (char **)&params) == TOKEN_TTFONT) {
ret = true;
+ }
delete[] buffer;
return ret;
diff --git a/engines/wintermute/base/font/base_font_bitmap.cpp b/engines/wintermute/base/font/base_font_bitmap.cpp
index dd6c6da327..9cce8ca9ee 100644
--- a/engines/wintermute/base/font/base_font_bitmap.cpp
+++ b/engines/wintermute/base/font/base_font_bitmap.cpp
@@ -91,8 +91,9 @@ int BaseFontBitmap::getTextWidth(byte *text, int maxLength) {
str = AnsiString((char *)text);
}
- if (maxLength >= 0 && str.size() > (uint32)maxLength)
+ if (maxLength >= 0 && str.size() > (uint32)maxLength) {
str = Common::String(str.c_str(), (uint32)maxLength);
+ }
//str.substr(0, maxLength); // TODO: Remove
int textWidth = 0;
@@ -106,9 +107,13 @@ int BaseFontBitmap::getTextWidth(byte *text, int maxLength) {
//////////////////////////////////////////////////////////////////////
int BaseFontBitmap::textHeightDraw(byte *text, int x, int y, int width, TTextAlign align, bool draw, int maxHeight, int maxLength) {
- if (maxLength == 0) return 0;
+ if (maxLength == 0) {
+ return 0;
+ }
- if (text == NULL || text[0] == '\0') return _tileHeight;
+ if (text == NULL || text[0] == '\0') {
+ return _tileHeight;
+ }
AnsiString str;
@@ -118,7 +123,9 @@ int BaseFontBitmap::textHeightDraw(byte *text, int x, int y, int width, TTextAli
} else {
str = AnsiString((char *)text);
}
- if (str.empty()) return 0;
+ if (str.empty()) {
+ return 0;
+ }
int LineLength = 0;
int RealLength = 0;
@@ -135,11 +142,15 @@ int BaseFontBitmap::textHeightDraw(byte *text, int x, int y, int width, TTextAli
bool new_line = false;
bool long_line = false;
- if (draw) _gameRef->_renderer->startSpriteBatch();
+ if (draw) {
+ _gameRef->_renderer->startSpriteBatch();
+ }
while (!done) {
if (maxHeight > 0 && (NumLines + 1)*_tileHeight > maxHeight) {
- if (draw) _gameRef->_renderer->endSpriteBatch();
+ if (draw) {
+ _gameRef->_renderer->endSpriteBatch();
+ }
return NumLines * _tileHeight;
}
@@ -170,10 +181,14 @@ int BaseFontBitmap::textHeightDraw(byte *text, int x, int y, int width, TTextAli
LineLength += getCharWidth(str[index]);
RealLength = LineLength;
}
- } else LineLength += getCharWidth(str[index]);
+ } else {
+ LineLength += getCharWidth(str[index]);
+ }
if ((LineLength > width) || done || new_line) {
- if (end < 0) done = true;
+ if (end < 0) {
+ done = true;
+ }
int StartX;
switch (align) {
case TAL_CENTER:
@@ -190,12 +205,16 @@ int BaseFontBitmap::textHeightDraw(byte *text, int x, int y, int width, TTextAli
break;
}
for (i = start; i < end + 1; i++) {
- if (draw) drawChar(str[i], StartX, y);
+ if (draw) {
+ drawChar(str[i], StartX, y);
+ }
StartX += getCharWidth(str[i]);
}
y += _tileHeight;
last_end = end;
- if (long_line) end--;
+ if (long_line) {
+ end--;
+ }
start = end + 2;
index = end + 1;
LineLength = 0;
@@ -205,7 +224,9 @@ int BaseFontBitmap::textHeightDraw(byte *text, int x, int y, int width, TTextAli
}
}
- if (draw) _gameRef->_renderer->endSpriteBatch();
+ if (draw) {
+ _gameRef->_renderer->endSpriteBatch();
+ }
return NumLines * _tileHeight;
}
@@ -213,7 +234,9 @@ int BaseFontBitmap::textHeightDraw(byte *text, int x, int y, int width, TTextAli
//////////////////////////////////////////////////////////////////////
void BaseFontBitmap::drawChar(byte c, int x, int y) {
- if (_fontextFix) c--;
+ if (_fontextFix) {
+ c--;
+ }
int row, col;
@@ -223,8 +246,11 @@ void BaseFontBitmap::drawChar(byte c, int x, int y) {
Rect32 rect;
/* l t r b */
int tileWidth;
- if (_wholeCell) tileWidth = _tileWidth;
- else tileWidth = _widths[c];
+ if (_wholeCell) {
+ tileWidth = _tileWidth;
+ } else {
+ tileWidth = _widths[c];
+ }
BasePlatform::setRect(&rect, col * _tileWidth, row * _tileHeight, col * _tileWidth + tileWidth, (row + 1)*_tileHeight);
bool handled = false;
@@ -237,7 +263,9 @@ void BaseFontBitmap::drawChar(byte c, int x, int y) {
handled = true;
}
}
- if (!handled && _subframe) _subframe->_surface->displayTrans(x, y, rect);
+ if (!handled && _subframe) {
+ _subframe->_surface->displayTrans(x, y, rect);
+ }
}
@@ -253,7 +281,9 @@ bool BaseFontBitmap::loadFile(const char *filename) {
setFilename(filename);
- if (DID_FAIL(ret = loadBuffer(buffer))) _gameRef->LOG(0, "Error parsing FONT file '%s'", filename);
+ if (DID_FAIL(ret = loadBuffer(buffer))) {
+ _gameRef->LOG(0, "Error parsing FONT file '%s'", filename);
+ }
delete[] buffer;
@@ -408,8 +438,11 @@ bool BaseFontBitmap::loadBuffer(byte *buffer) {
if (surfaceFile != NULL && !_sprite) {
_subframe = new BaseSubFrame(_gameRef);
- if (custoTrans) _subframe->setSurface(surfaceFile, false, r, g, b);
- else _subframe->setSurface(surfaceFile);
+ if (custoTrans) {
+ _subframe->setSurface(surfaceFile, false, r, g, b);
+ } else {
+ _subframe->setSurface(surfaceFile);
+ }
}
@@ -425,25 +458,32 @@ bool BaseFontBitmap::loadBuffer(byte *buffer) {
// do we need to modify widths?
if (expandWidth != 0) {
for (i = 0; i < NUM_CHARACTERS; i++) {
- int NewWidth = (int)_widths[i] + expandWidth;
- if (NewWidth < 0) NewWidth = 0;
+ int newWidth = (int)_widths[i] + expandWidth;
+ if (newWidth < 0) {
+ newWidth = 0;
+ }
- _widths[i] = (byte)NewWidth;
+ _widths[i] = (byte)newWidth;
}
}
// handle space character
uint32 spaceChar = ' ';
- if (_fontextFix) spaceChar--;
+ if (_fontextFix) {
+ spaceChar--;
+ }
- if (spaceWidth != 0) _widths[spaceChar] = spaceWidth;
- else {
+ if (spaceWidth != 0) {
+ _widths[spaceChar] = spaceWidth;
+ } else {
if (_widths[spaceChar] == expandWidth || _widths[spaceChar] == 0) {
_widths[spaceChar] = (_widths['m'] + _widths['i']) / 2;
}
}
} else {
- for (i = lastWidth; i < NUM_CHARACTERS; i++) _widths[i] = default_width;
+ for (i = lastWidth; i < NUM_CHARACTERS; i++) {
+ _widths[i] = default_width;
+ }
}
@@ -463,10 +503,11 @@ bool BaseFontBitmap::persist(BasePersistenceManager *persistMgr) {
persistMgr->transfer(TMEMBER(_sprite));
persistMgr->transfer(TMEMBER(_widthsFrame));
- if (persistMgr->getIsSaving())
+ if (persistMgr->getIsSaving()) {
persistMgr->putBytes(_widths, sizeof(_widths));
- else
+ } else {
persistMgr->getBytes(_widths, sizeof(_widths));
+ }
persistMgr->transfer(TMEMBER(_fontextFix));
@@ -479,7 +520,9 @@ bool BaseFontBitmap::persist(BasePersistenceManager *persistMgr) {
//////////////////////////////////////////////////////////////////////////
int BaseFontBitmap::getCharWidth(byte index) {
- if (_fontextFix) index--;
+ if (_fontextFix) {
+ index--;
+ }
return _widths[index];
}
@@ -495,8 +538,12 @@ bool BaseFontBitmap::getWidths() {
}
}
}
- if (surf == NULL && _subframe) surf = _subframe->_surface;
- if (!surf || DID_FAIL(surf->startPixelOp())) return STATUS_FAILED;
+ if (surf == NULL && _subframe) {
+ surf = _subframe->_surface;
+ }
+ if (!surf || DID_FAIL(surf->startPixelOp())) {
+ return STATUS_FAILED;
+ }
for (int i = 0; i < NUM_CHARACTERS; i++) {
@@ -507,14 +554,18 @@ bool BaseFontBitmap::getWidths() {
int minCol = -1;
for (int row = 0; row < _tileHeight; row++) {
for (int col = _tileWidth - 1; col >= minCol + 1; col--) {
- if (xxx + col < 0 || xxx + col >= surf->getWidth() || yyy + row < 0 || yyy + row >= surf->getHeight()) continue;
+ if (xxx + col < 0 || xxx + col >= surf->getWidth() || yyy + row < 0 || yyy + row >= surf->getHeight()) {
+ continue;
+ }
if (!surf->isTransparentAtLite(xxx + col, yyy + row)) {
//min_col = col;
minCol = MAX(col, minCol);
break;
}
}
- if (minCol == _tileWidth - 1) break;
+ if (minCol == _tileWidth - 1) {
+ break;
+ }
}
_widths[i] = minCol + 1;
diff --git a/engines/wintermute/base/font/base_font_storage.cpp b/engines/wintermute/base/font/base_font_storage.cpp
index 84c80c73cb..8b4fa74181 100644
--- a/engines/wintermute/base/font/base_font_storage.cpp
+++ b/engines/wintermute/base/font/base_font_storage.cpp
@@ -52,7 +52,9 @@ BaseFontStorage::~BaseFontStorage() {
//////////////////////////////////////////////////////////////////////////
bool BaseFontStorage::cleanup(bool warn) {
for (int i = 0; i < _fonts.getSize(); i++) {
- if (warn) _gameRef->LOG(0, "Removing orphan font '%s'", _fonts[i]->getFilename());
+ if (warn) {
+ _gameRef->LOG(0, "Removing orphan font '%s'", _fonts[i]->getFilename());
+ }
delete _fonts[i];
}
_fonts.removeAll();
@@ -70,7 +72,9 @@ bool BaseFontStorage::initLoop() {
//////////////////////////////////////////////////////////////////////////
BaseFont *BaseFontStorage::addFont(const char *filename) {
- if (!filename) return NULL;
+ if (!filename) {
+ return NULL;
+ }
for (int i = 0; i < _fonts.getSize(); i++) {
if (scumm_stricmp(_fonts[i]->getFilename(), filename) == 0) {
@@ -104,7 +108,9 @@ BaseFont *BaseFontStorage::addFont(const char *filename) {
//////////////////////////////////////////////////////////////////////////
bool BaseFontStorage::removeFont(BaseFont *font) {
- if (!font) return STATUS_FAILED;
+ if (!font) {
+ return STATUS_FAILED;
+ }
for (int i = 0; i < _fonts.getSize(); i++) {
if (_fonts[i] == font) {
@@ -123,7 +129,9 @@ bool BaseFontStorage::removeFont(BaseFont *font) {
//////////////////////////////////////////////////////////////////////////
bool BaseFontStorage::persist(BasePersistenceManager *persistMgr) {
- if (!persistMgr->getIsSaving()) cleanup(false);
+ if (!persistMgr->getIsSaving()) {
+ cleanup(false);
+ }
persistMgr->transfer(TMEMBER(_gameRef));
_fonts.persist(persistMgr);
diff --git a/engines/wintermute/base/font/base_font_truetype.cpp b/engines/wintermute/base/font/base_font_truetype.cpp
index 0a97370cb7..420df58b74 100644
--- a/engines/wintermute/base/font/base_font_truetype.cpp
+++ b/engines/wintermute/base/font/base_font_truetype.cpp
@@ -57,7 +57,9 @@ BaseFontTT::BaseFontTT(BaseGame *inGame): BaseFont(inGame) {
_fallbackFont = NULL;
_deletableFont = NULL;
- for (int i = 0; i < NUM_CACHED_TEXTS; i++) _cachedTexts[i] = NULL;
+ for (int i = 0; i < NUM_CACHED_TEXTS; i++) {
+ _cachedTexts[i] = NULL;
+ }
#if 0
_fTFace = NULL;
@@ -98,7 +100,9 @@ BaseFontTT::~BaseFontTT(void) {
//////////////////////////////////////////////////////////////////////////
void BaseFontTT::clearCache() {
for (int i = 0; i < NUM_CACHED_TEXTS; i++) {
- if (_cachedTexts[i]) delete _cachedTexts[i];
+ if (_cachedTexts[i]) {
+ delete _cachedTexts[i];
+ }
_cachedTexts[i] = NULL;
}
}
@@ -109,12 +113,16 @@ void BaseFontTT::initLoop() {
if (_gameRef->_constrainedMemory) {
// purge all cached images not used in the last frame
for (int i = 0; i < NUM_CACHED_TEXTS; i++) {
- if (_cachedTexts[i] == NULL) continue;
+ if (_cachedTexts[i] == NULL) {
+ continue;
+ }
if (!_cachedTexts[i]->_marked) {
delete _cachedTexts[i];
_cachedTexts[i] = NULL;
- } else _cachedTexts[i]->_marked = false;
+ } else {
+ _cachedTexts[i]->_marked = false;
+ }
}
}
}
@@ -123,11 +131,15 @@ void BaseFontTT::initLoop() {
int BaseFontTT::getTextWidth(byte *text, int maxLength) {
WideString textStr;
- if (_gameRef->_textEncoding == TEXT_UTF8) textStr = StringUtil::utf8ToWide((char *)text);
- else textStr = StringUtil::ansiToWide((char *)text);
+ if (_gameRef->_textEncoding == TEXT_UTF8) {
+ textStr = StringUtil::utf8ToWide((char *)text);
+ } else {
+ textStr = StringUtil::ansiToWide((char *)text);
+ }
- if (maxLength >= 0 && textStr.size() > (uint32)maxLength)
+ if (maxLength >= 0 && textStr.size() > (uint32)maxLength) {
textStr = Common::String(textStr.c_str(), (uint32)maxLength);
+ }
//text = text.substr(0, MaxLength); // TODO: Remove
int textWidth, textHeight;
@@ -140,8 +152,11 @@ int BaseFontTT::getTextWidth(byte *text, int maxLength) {
int BaseFontTT::getTextHeight(byte *text, int width) {
WideString textStr;
- if (_gameRef->_textEncoding == TEXT_UTF8) textStr = StringUtil::utf8ToWide((char *)text);
- else textStr = StringUtil::ansiToWide((char *)text);
+ if (_gameRef->_textEncoding == TEXT_UTF8) {
+ textStr = StringUtil::utf8ToWide((char *)text);
+ } else {
+ textStr = StringUtil::ansiToWide((char *)text);
+ }
int textWidth, textHeight;
@@ -153,7 +168,9 @@ int BaseFontTT::getTextHeight(byte *text, int width) {
//////////////////////////////////////////////////////////////////////////
void BaseFontTT::drawText(byte *text, int x, int y, int width, TTextAlign align, int maxHeight, int maxLength) {
- if (text == NULL || strcmp((char *)text, "") == 0) return;
+ if (text == NULL || strcmp((char *)text, "") == 0) {
+ return;
+ }
WideString textStr = (char *)text;
@@ -161,8 +178,9 @@ void BaseFontTT::drawText(byte *text, int x, int y, int width, TTextAlign align,
/* if (_gameRef->_textEncoding == TEXT_UTF8) text = StringUtil::Utf8ToWide((char *)Text);
else text = StringUtil::AnsiToWide((char *)Text);*/
- if (maxLength >= 0 && textStr.size() > (uint32)maxLength)
+ if (maxLength >= 0 && textStr.size() > (uint32)maxLength) {
textStr = Common::String(textStr.c_str(), (uint32)maxLength);
+ }
//text = text.substr(0, MaxLength); // TODO: Remove
BaseRenderer *renderer = _gameRef->_renderer;
@@ -199,7 +217,9 @@ void BaseFontTT::drawText(byte *text, int x, int y, int width, TTextAlign align,
surface = renderTextToTexture(textStr, width, align, maxHeight, textOffset);
if (surface) {
// write surface to cache
- if (_cachedTexts[minIndex] != NULL) delete _cachedTexts[minIndex];
+ if (_cachedTexts[minIndex] != NULL) {
+ delete _cachedTexts[minIndex];
+ }
_cachedTexts[minIndex] = new BaseCachedTTFontText;
_cachedTexts[minIndex]->_surface = surface;
@@ -261,10 +281,11 @@ BaseSurface *BaseFontTT::renderTextToTexture(const WideString &text, int width,
debugC(kWinterMuteDebugFont, "%s %d %d %d %d", text.c_str(), RGBCOLGetR(_layers[0]->_color), RGBCOLGetG(_layers[0]->_color), RGBCOLGetB(_layers[0]->_color), RGBCOLGetA(_layers[0]->_color));
// void drawString(Surface *dst, const Common::String &str, int x, int y, int w, uint32 color, TextAlign align = kTextAlignLeft, int deltax = 0, bool useEllipsis = true) const;
Graphics::Surface *surface = new Graphics::Surface();
- if (_deletableFont) // We actually have a TTF
+ if (_deletableFont) { // We actually have a TTF
surface->create((uint16)width, (uint16)(_lineHeight * lines.size()), Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0));
- else // We are using a fallback, they can't do 32bpp
+ } else { // We are using a fallback, they can't do 32bpp
surface->create((uint16)width, (uint16)(_lineHeight * lines.size()), Graphics::PixelFormat(2, 5, 5, 5, 1, 11, 6, 1, 0));
+ }
uint32 useColor = 0xffffffff;
Common::Array<Common::String>::iterator it;
int heightOffset = 0;
@@ -309,7 +330,9 @@ BaseSurface *BaseFontTT::renderTextToTexture(const WideString &text, int width,
wchar_t ch = line->GetText()[i];
GlyphInfo *glyph = _glyphCache->GetGlyph(ch);
- if (!glyph) continue;
+ if (!glyph) {
+ continue;
+ }
textOffset = MAX(textOffset, glyph->GetBearingY());
}
@@ -322,10 +345,14 @@ BaseSurface *BaseFontTT::renderTextToTexture(const WideString &text, int width,
wchar_t ch = line->GetText()[i];
GlyphInfo *glyph = _glyphCache->GetGlyph(ch);
- if (!glyph) continue;
+ if (!glyph) {
+ continue;
+ }
float kerning = 0;
- if (prevChar != L'\0') kerning = GetKerning(prevChar, ch);
+ if (prevChar != L'\0') {
+ kerning = GetKerning(prevChar, ch);
+ }
posX += (int)kerning;
@@ -381,7 +408,9 @@ void BaseFontTT::blitSurface(Graphics::Surface *src, Graphics::Surface *target,
warning("BaseFontTT::BlitSurface - not ported yet");
#if 0
for (int y = 0; y < src->h; y++) {
- if (targetRect->y + y < 0 || targetRect->y + y >= target->h) continue;
+ if (targetRect->y + y < 0 || targetRect->y + y >= target->h) {
+ continue;
+ }
uint8 *srcBuf = (uint8 *)src->pixels + y * src->pitch;
@@ -391,7 +420,9 @@ void BaseFontTT::blitSurface(Graphics::Surface *src, Graphics::Surface *target,
uint32 *tgtBuf32 = (uint32 *)tgtBuf;
for (int x = 0; x < src->w; x++) {
- if (targetRect->x + x < 0 || targetRect->x + x >= target->w) continue;
+ if (targetRect->x + x < 0 || targetRect->x + x >= target->w) {
+ continue;
+ }
tgtBuf32[x + targetRect->x] = srcBuf32[x];
}
@@ -417,7 +448,9 @@ bool BaseFontTT::loadFile(const char *filename) {
setFilename(filename);
- if (DID_FAIL(ret = loadBuffer(buffer))) _gameRef->LOG(0, "Error parsing TTFONT file '%s'", filename);
+ if (DID_FAIL(ret = loadBuffer(buffer))) {
+ _gameRef->LOG(0, "Error parsing TTFONT file '%s'", filename);
+ }
delete[] buffer;
@@ -468,7 +501,7 @@ bool BaseFontTT::loadBuffer(byte *buffer) {
}
buffer = (byte *)params;
- uint32 BaseColor = 0x00000000;
+ uint32 baseColor = 0x00000000;
while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
switch (cmd) {
@@ -507,23 +540,24 @@ bool BaseFontTT::loadBuffer(byte *buffer) {
case TOKEN_COLOR: {
int r, g, b;
parser.scanStr(params, "%d,%d,%d", &r, &g, &b);
- BaseColor = BYTETORGBA(r, g, b, RGBCOLGetA(BaseColor));
+ baseColor = BYTETORGBA(r, g, b, RGBCOLGetA(baseColor));
}
break;
case TOKEN_ALPHA: {
int a;
parser.scanStr(params, "%d", &a);
- BaseColor = BYTETORGBA(RGBCOLGetR(BaseColor), RGBCOLGetG(BaseColor), RGBCOLGetB(BaseColor), a);
+ baseColor = BYTETORGBA(RGBCOLGetR(baseColor), RGBCOLGetG(baseColor), RGBCOLGetB(baseColor), a);
}
break;
case TOKEN_LAYER: {
- BaseTTFontLayer *Layer = new BaseTTFontLayer;
- if (Layer && DID_SUCCEED(parseLayer(Layer, (byte *)params))) _layers.add(Layer);
- else {
- delete Layer;
- Layer = NULL;
+ BaseTTFontLayer *layer = new BaseTTFontLayer;
+ if (layer && DID_SUCCEED(parseLayer(layer, (byte *)params))) {
+ _layers.add(layer);
+ } else {
+ delete layer;
+ layer = NULL;
cmd = PARSERR_TOKENNOTFOUND;
}
}
@@ -538,12 +572,14 @@ bool BaseFontTT::loadBuffer(byte *buffer) {
// create at least one layer
if (_layers.getSize() == 0) {
- BaseTTFontLayer *Layer = new BaseTTFontLayer;
- Layer->_color = BaseColor;
- _layers.add(Layer);
+ BaseTTFontLayer *layer = new BaseTTFontLayer;
+ layer->_color = baseColor;
+ _layers.add(layer);
}
- if (!_fontFile) BaseUtils::setString(&_fontFile, "arial.ttf");
+ if (!_fontFile) {
+ BaseUtils::setString(&_fontFile, "arial.ttf");
+ }
return initFont();
}
@@ -587,8 +623,11 @@ bool BaseFontTT::parseLayer(BaseTTFontLayer *layer, byte *buffer) {
break;
}
}
- if (cmd != PARSERR_EOF) return STATUS_FAILED;
- else return STATUS_OK;
+ if (cmd != PARSERR_EOF) {
+ return STATUS_FAILED;
+ } else {
+ return STATUS_OK;
+ }
}
@@ -609,7 +648,9 @@ bool BaseFontTT::persist(BasePersistenceManager *persistMgr) {
if (persistMgr->getIsSaving()) {
numLayers = _layers.getSize();
persistMgr->transfer(TMEMBER(numLayers));
- for (int i = 0; i < numLayers; i++) _layers[i]->persist(persistMgr);
+ for (int i = 0; i < numLayers; i++) {
+ _layers[i]->persist(persistMgr);
+ }
} else {
numLayers = _layers.getSize();
persistMgr->transfer(TMEMBER(numLayers));
@@ -621,7 +662,9 @@ bool BaseFontTT::persist(BasePersistenceManager *persistMgr) {
}
if (!persistMgr->getIsSaving()) {
- for (int i = 0; i < NUM_CACHED_TEXTS; i++) _cachedTexts[i] = NULL;
+ for (int i = 0; i < NUM_CACHED_TEXTS; i++) {
+ _cachedTexts[i] = NULL;
+ }
_fallbackFont = _font = _deletableFont = NULL;
}
@@ -636,7 +679,9 @@ void BaseFontTT::afterLoad() {
//////////////////////////////////////////////////////////////////////////
bool BaseFontTT::initFont() {
- if (!_fontFile) return STATUS_FAILED;
+ if (!_fontFile) {
+ return STATUS_FAILED;
+ }
Common::SeekableReadStream *file = _gameRef->_fileManager->openFile(_fontFile);
if (!file) {
diff --git a/engines/wintermute/base/font/base_font_truetype.h b/engines/wintermute/base/font/base_font_truetype.h
index 8a8459b070..f8c5eee74d 100644
--- a/engines/wintermute/base/font/base_font_truetype.h
+++ b/engines/wintermute/base/font/base_font_truetype.h
@@ -67,7 +67,9 @@ private:
}
virtual ~BaseCachedTTFontText() {
- if (_surface) delete _surface;
+ if (_surface) {
+ delete _surface;
+ }
}
};