aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEinar Johan Trøan Sømåen2012-06-26 14:51:00 +0200
committerEinar Johan Trøan Sømåen2012-06-26 14:51:00 +0200
commiteb02d6db23bb340f08a24b6c11a300511eec8d7d (patch)
tree679ba4d3a6d876a80215f21659fcc4eb4fd074a4
parent79cb18ff38b3c79db10ee09fc21cc678fc75b74a (diff)
downloadscummvm-rg350-eb02d6db23bb340f08a24b6c11a300511eec8d7d.tar.gz
scummvm-rg350-eb02d6db23bb340f08a24b6c11a300511eec8d7d.tar.bz2
scummvm-rg350-eb02d6db23bb340f08a24b6c11a300511eec8d7d.zip
WINTERMUTE: Remove some old code from BFontTT
-rw-r--r--engines/wintermute/Base/BFontTT.cpp181
1 files changed, 0 insertions, 181 deletions
diff --git a/engines/wintermute/Base/BFontTT.cpp b/engines/wintermute/Base/BFontTT.cpp
index c0f7f4a75b..2eee39e9c9 100644
--- a/engines/wintermute/Base/BFontTT.cpp
+++ b/engines/wintermute/Base/BFontTT.cpp
@@ -721,117 +721,6 @@ HRESULT CBFontTT::initFont() {
return S_OK;
}
-
-//////////////////////////////////////////////////////////////////////////
-// I/O bridge between FreeType and WME file system
-//////////////////////////////////////////////////////////////////////////
-/*
-unsigned long CBFontTT::FTReadSeekProc(FT_Stream stream, unsigned long offset, unsigned char *buffer, unsigned long count) {
- CBFile *f = static_cast<CBFile *>(stream->descriptor.pointer);
- if (!f) return 0;
-
- f->Seek(offset, SEEK_TO_BEGIN);
- if (count) {
- uint32 oldPos = f->GetPos();
- f->Read(buffer, count);
- return f->GetPos() - oldPos;
- } else return 0;
-}
-
-//////////////////////////////////////////////////////////////////////////
-void CBFontTT::FTCloseProc(FT_Stream stream) {
- CBFile *f = static_cast<CBFile *>(stream->descriptor.pointer);
- if (!f) return;
-
- CBGame *Game = f->Game;
-
- Game->_fileManager->closeFile(f);
- stream->descriptor.pointer = NULL;
-}*/
-
-
-#if 0
-//////////////////////////////////////////////////////////////////////////
-void CBFontTT::WrapText(const WideString &text, int maxWidth, int maxHeight, TextLineList &lines) {
- int currWidth = 0;
- wchar_t prevChar = L'\0';
- int prevSpaceIndex = -1;
- int prevSpaceWidth = 0;
- int lineStartIndex = 0;
-
- PrepareGlyphs(text);
-
- for (size_t i = 0; i < text.size(); i++) {
- wchar_t ch = text[i];
-
- if (ch == L' ') {
- prevSpaceIndex = i;
- prevSpaceWidth = currWidth;
- }
-
- int charWidth = 0;
-
- if (ch != L'\n') {
- GlyphInfo *glyphInfo = GetGlyphCache()->GetGlyph(ch);
- if (!glyphInfo) continue;
-
- float kerning = 0;
- if (prevChar != L'\0') kerning = GetKerning(prevChar, ch);
- prevChar = ch;
-
- charWidth = (int)(glyphInfo->GetAdvanceX() + kerning);
- }
-
- bool lineTooLong = maxWidth >= 0 && currWidth + charWidth > maxWidth;
- bool breakOnSpace = false;
-
- // we can't fit even a single character
- if (lineTooLong && currWidth == 0) break;
-
-
- if (ch == L'\n' || i == text.size() - 1 || lineTooLong) {
- int breakPoint, breakWidth;
-
- if (prevSpaceIndex >= 0 && lineTooLong) {
- breakPoint = prevSpaceIndex;
- breakWidth = prevSpaceWidth;
- breakOnSpace = true;
- } else {
- breakPoint = i;
- breakWidth = currWidth;
-
- breakOnSpace = (ch == L'\n');
-
- // we're at the end
- if (i == text.size() - 1) {
- breakPoint++;
- breakWidth += charWidth;
- }
- }
-
- if (maxHeight >= 0 && (lines.size() + 1) * GetLineHeight() > maxHeight) break;
-
- //WideString line = text.substr(lineStartIndex, breakPoint - lineStartIndex); // TODO: Remove
- WideString line = Common::String(text.c_str() + lineStartIndex, breakPoint - lineStartIndex);
- lines.push_back(new TextLine(line, breakWidth));
-
- currWidth = 0;
- prevChar = L'\0';
- prevSpaceIndex = -1;
-
- if (breakOnSpace) breakPoint++;
-
- lineStartIndex = breakPoint;
- i = breakPoint - 1;
-
- continue;
- }
-
- //if (ch == L' ' && currLine.empty()) continue;
- currWidth += charWidth;
- }
-}
-#endif
//////////////////////////////////////////////////////////////////////////
void CBFontTT::measureText(const WideString &text, int maxWidth, int maxHeight, int &textWidth, int &textHeight) {
//TextLineList lines;
@@ -867,74 +756,4 @@ void CBFontTT::measureText(const WideString &text, int maxWidth, int maxHeight,
}*/
}
-#if 0
-//////////////////////////////////////////////////////////////////////////
-float CBFontTT::GetKerning(wchar_t leftChar, wchar_t rightChar) {
-
- GlyphInfo *infoLeft = _glyphCache->GetGlyph(leftChar);
- GlyphInfo *infoRight = _glyphCache->GetGlyph(rightChar);
-
- if (!infoLeft || !infoRight) return 0;
-
- FT_Vector delta;
- FT_Error error = FT_Get_Kerning(_fTFace, infoLeft->GetGlyphIndex(), infoRight->GetGlyphIndex(), ft_kerning_unfitted, &delta);
- if (error) return 0;
-
- return delta.x * (1.0f / 64.0f);
-
- return 0;
-}
-#endif
-#if 0
-//////////////////////////////////////////////////////////////////////////
-void CBFontTT::PrepareGlyphs(const WideString &text) {
-
- // make sure we have all the glyphs we need
- for (size_t i = 0; i < text.size(); i++) {
- wchar_t ch = text[i];
- if (!_glyphCache->HasGlyph(ch)) CacheGlyph(ch);
- }
-
-}
-#endif
-#if 0
-//////////////////////////////////////////////////////////////////////////
-void CBFontTT::CacheGlyph(wchar_t ch) {
- FT_UInt glyphIndex = FT_Get_Char_Index(_fTFace, ch);
- if (!glyphIndex) return;
-
- FT_Error error = FT_Load_Glyph(_fTFace, glyphIndex, FT_LOAD_DEFAULT);
- if (error) return;
-
- error = FT_Render_Glyph(_fTFace->glyph, FT_RENDER_MODE_NORMAL);
- if (error) return;
-
- byte *pixels = _fTFace->glyph->bitmap.buffer;
- size_t stride = _fTFace->glyph->bitmap.pitch;
-
-
- // convert from monochrome to grayscale if needed
- byte *tempBuffer = NULL;
- if (pixels != NULL && _fTFace->glyph->bitmap.pixel_mode == FT_PIXEL_MODE_MONO) {
- tempBuffer = new byte[_fTFace->glyph->bitmap.width * _fTFace->glyph->bitmap.rows];
- for (int j = 0; j < _fTFace->glyph->bitmap.rows; j++) {
- int rowOffset = stride * j;
- for (int i = 0; i < _fTFace->glyph->bitmap.width; i++) {
- int byteOffset = i / 8;
- int bitOffset = 7 - (i % 8);
- byte bit = (pixels[rowOffset + byteOffset] & (1 << bitOffset)) >> bitOffset;
- tempBuffer[_fTFace->glyph->bitmap.width * j + i] = 255 * bit;
- }
- }
-
- pixels = tempBuffer;
- stride = _fTFace->glyph->bitmap.width;
- }
-
- // add glyph to cache
- _glyphCache->AddGlyph(ch, glyphIndex, _fTFace->glyph, _fTFace->glyph->bitmap.width, _fTFace->glyph->bitmap.rows, pixels, stride);
-
- if (tempBuffer) delete [] tempBuffer;
-}
-#endif
} // end of namespace WinterMute