WINTERMUTE: Clean up BFonTT a little.

This commit is contained in:
Einar Johan Trøan Sømåen 2012-06-15 00:48:42 +02:00
parent cac5db7dfe
commit 407a881800
4 changed files with 22 additions and 28 deletions

View File

@ -756,7 +756,7 @@ void CBFontTT::FTCloseProc(FT_Stream stream) {
}*/
#if 0
//////////////////////////////////////////////////////////////////////////
void CBFontTT::WrapText(const WideString &text, int maxWidth, int maxHeight, TextLineList &lines) {
int currWidth = 0;
@ -837,7 +837,7 @@ void CBFontTT::WrapText(const WideString &text, int maxWidth, int maxHeight, Tex
currWidth += charWidth;
}
}
#endif
//////////////////////////////////////////////////////////////////////////
void CBFontTT::MeasureText(const WideString &text, int maxWidth, int maxHeight, int &textWidth, int &textHeight) {
//TextLineList lines;
@ -873,10 +873,10 @@ void CBFontTT::MeasureText(const WideString &text, int maxWidth, int maxHeight,
}*/
}
#if 0
//////////////////////////////////////////////////////////////////////////
float CBFontTT::GetKerning(wchar_t leftChar, wchar_t rightChar) {
#if 0
GlyphInfo *infoLeft = _glyphCache->GetGlyph(leftChar);
GlyphInfo *infoRight = _glyphCache->GetGlyph(rightChar);
@ -887,23 +887,25 @@ float CBFontTT::GetKerning(wchar_t leftChar, wchar_t rightChar) {
if (error) return 0;
return delta.x * (1.0f / 64.0f);
#endif
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) {
#if 0
FT_UInt glyphIndex = FT_Get_Char_Index(_fTFace, ch);
if (!glyphIndex) return;
@ -939,7 +941,6 @@ void CBFontTT::CacheGlyph(wchar_t ch) {
_glyphCache->AddGlyph(ch, glyphIndex, _fTFace->glyph, _fTFace->glyph->bitmap.width, _fTFace->glyph->bitmap.rows, pixels, stride);
if (tempBuffer) delete [] tempBuffer;
#endif
}
#endif
} // end of namespace WinterMute

View File

@ -120,16 +120,13 @@ public:
CBFontTT(CBGame *inGame);
virtual ~CBFontTT(void);
virtual int GetTextWidth(byte *text, int MaxLenght = -1);
virtual int GetTextWidth(byte *text, int maxLenght = -1);
virtual int GetTextHeight(byte *text, int width);
virtual void DrawText(byte *text, int x, int y, int width, TTextAlign align = TAL_LEFT, int max_height = -1, int MaxLenght = -1);
virtual void DrawText(byte *text, int x, int y, int width, TTextAlign align = TAL_LEFT, int max_height = -1, int maxLenght = -1);
virtual int GetLetterHeight();
HRESULT LoadBuffer(byte *Buffer);
HRESULT LoadFile(const char *Filename);
/* static unsigned long FTReadSeekProc(FT_Stream stream, unsigned long offset, unsigned char *buffer, unsigned long count);
static void FTCloseProc(FT_Stream stream);*/
HRESULT LoadBuffer(byte *buffer);
HRESULT LoadFile(const char *filename);
FontGlyphCache *GetGlyphCache() {
return _glyphCache;
@ -143,13 +140,10 @@ public:
void InitLoop();
private:
HRESULT ParseLayer(CBTTFontLayer *Layer, byte *Buffer);
HRESULT ParseLayer(CBTTFontLayer *layer, byte *buffer);
void WrapText(const WideString &text, int maxWidth, int maxHeight, TextLineList &lines);
void MeasureText(const WideString &text, int maxWidth, int maxHeight, int &textWidth, int &textHeight);
float GetKerning(wchar_t leftChar, wchar_t rightChar);
void PrepareGlyphs(const WideString &text);
void CacheGlyph(wchar_t ch);
CBSurface *RenderTextToTexture(const WideString &text, int width, TTextAlign align, int maxHeight, int &textOffset);
void BlitSurface(Graphics::Surface *src, Graphics::Surface *target, Common::Rect *targetRect);
@ -158,8 +152,7 @@ private:
CBCachedTTFontText *_cachedTexts[NUM_CACHED_TEXTS];
HRESULT InitFont();
//FT_Stream _fTStream;
//FT_Face _fTFace;
Graphics::Font *_deletableFont;
const Graphics::Font *_font;
const Graphics::Font *_fallbackFont;

View File

@ -29,7 +29,7 @@
#include "FontGlyphCache.h"
namespace WinterMute {
#if 0
//////////////////////////////////////////////////////////////////////////
FontGlyphCache::FontGlyphCache() {
}
@ -98,5 +98,5 @@ void GlyphInfo::SetGlyphImage(size_t width, size_t height, size_t stride, byte *
SDL_UnlockSurface(_image);
#endif
}
#endif
} // end of namespace WinterMute

View File

@ -34,7 +34,7 @@
#include "graphics/surface.h"
namespace WinterMute {
#if 0
//////////////////////////////////////////////////////////////////////////
class GlyphInfo {
public:
@ -119,7 +119,7 @@ private:
typedef Common::HashMap<char, GlyphInfo *> GlyphInfoMap; // TODO
GlyphInfoMap _glyphs;
};
#endif
} // end of namespace WinterMute
#endif // WINTERMUTE_FONTGLYPHCACHE_H