28 #ifndef WINTERMUTE_BASE_FONTTT_H 29 #define WINTERMUTE_BASE_FONTTT_H 31 #include "engines/wintermute/base/font/base_font_storage.h" 32 #include "engines/wintermute/base/font/base_font.h" 33 #include "engines/wintermute/base/gfx/base_surface.h" 34 #include "common/rect.h" 35 #include "graphics/surface.h" 36 #include "graphics/font.h" 38 #define NUM_CACHED_TEXTS 30 45 class BaseCachedTTFontText {
58 BaseCachedTTFontText() : _text() {
60 _width = _maxHeight = _maxLength = -1;
69 virtual ~BaseCachedTTFontText() {
81 _offsetX = _offsetY = 0;
86 persistMgr->transferSint32(TMEMBER(_offsetX));
87 persistMgr->transferSint32(TMEMBER(_offsetY));
88 persistMgr->transferUint32(TMEMBER(_color));
108 int32 getWidth()
const {
123 int getTextWidth(
const byte *text,
int maxLength = -1)
override;
124 int getTextHeight(
const byte *text,
int width)
override;
125 void drawText(
const byte *text,
int x,
int y,
int width, TTextAlign align = TAL_LEFT,
int max_height = -1,
int maxLength = -1)
override;
126 int getLetterHeight()
override;
128 bool loadBuffer(
char *buffer);
129 bool loadFile(
const char *filename);
131 float getLineHeight()
const {
135 void afterLoad()
override;
136 void initLoop()
override;
141 int32 wrapText(
const WideString &text, int32 maxWidth, int32 maxHeight, TextLineList &lines);
142 void measureText(
const WideString &text,
int maxWidth,
int maxHeight,
int &textWidth,
int &textHeight);
143 float getKerning(
wchar_t leftChar,
wchar_t rightChar);
145 BaseSurface *renderTextToTexture(
const WideString &text,
int width, TTextAlign align,
int maxHeight,
int &textOffset);
147 BaseCachedTTFontText *_cachedTexts[NUM_CACHED_TEXTS];
157 size_t _maxCharWidth;
158 size_t _maxCharHeight;
167 TTextCharset _charset;
Definition: base_game.h:79
Definition: base_persistence_manager.h:43
Definition: base_font_truetype.h:42
Definition: base_surface.h:37
Definition: base_font_truetype.h:78
Definition: base_font_truetype.h:98
Definition: coll_templ.h:345
Definition: base_font.h:37
Definition: achievements_tables.h:27