ScummVM API documentation
text.h
1/* ScummVM - Graphic Adventure Engine
2 *
3 * ScummVM is the legal property of its developers, whose names
4 * are too numerous to list here. Please refer to the COPYRIGHT
5 * file distributed with this source distribution.
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 *
20 *
21 */
22
23#ifndef ZVISION_TEXT_H
24#define ZVISION_TEXT_H
25
26#include "zvision/zvision.h"
27#include "zvision/text/truetype_font.h"
28
29namespace ZVision {
30
31class ZVision;
32
33enum TextJustification {
34 TEXT_JUSTIFY_CENTER = 0,
35 TEXT_JUSTIFY_LEFT = 1,
36 TEXT_JUSTIFY_RIGHT = 2
37};
38
39enum TextChange {
40 TEXT_CHANGE_NONE = 0x0,
41 TEXT_CHANGE_FONT_TYPE = 0x1,
42 TEXT_CHANGE_FONT_STYLE = 0x2,
43 TEXT_CHANGE_NEWLINE = 0x4,
44 TEXT_CHANGE_HAS_STATE_BOX = 0x8
45};
46
48public:
50 TextChange parseStyle(const Common::String &str, int16 len);
51 void readAllStyles(const Common::U32String &txt);
52 void updateFontWithTextState(StyledTTFont &font);
53
54 uint32 getTextColor(ZVision *engine) {
55 return engine->_resourcePixelFormat.RGBToColor(_red, _green, _blue);
56 }
57
58public:
59 Common::String _fontname;
60 TextJustification _justification;
61 int16 _size;
62 uint8 _red; // 0-255
63 uint8 _green; // 0-255
64 uint8 _blue; // 0-255
65 bool _italic;
66 bool _bold;
67 bool _underline;
68 bool _strikeout;
69 int32 _statebox;
70 bool _sharp;
71};
72
74public:
75 TextRenderer(ZVision *engine): _engine(engine) {};
76
77 void drawTextWithJustification(const Common::U32String &text, StyledTTFont &font, uint32 color, Graphics::Surface &dest, int lineY, TextJustification jusification);
78 int32 drawText(const Common::U32String &text, TextStyleState &state, Graphics::Surface &dest);
79 void drawTextWithWordWrapping(const Common::U32String &text, Graphics::Surface &dest, bool blackFrame = false);
80
81private:
82 ZVision *_engine;
83};
84
86void fixPseudo1251(Common::U32String *str);
87
88} // End of namespace ZVision
89
90#endif
Definition: stream.h:745
Definition: str.h:59
Definition: ustr.h:57
Definition: truetype_font.h:47
Definition: text.h:73
Definition: text.h:47
Definition: focus_list.h:27
Definition: surface.h:67