ScummVM API documentation
font.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#ifndef XEEN_FONT_H
23#define XEEN_FONT_H
24
25#include "common/language.h"
26#include "mm/shared/xeen/xsurface.h"
27#include "graphics/big5.h"
28
29namespace MM {
30namespace Xeen {
31
32#define FONT_WIDTH 8
33#define FONT_HEIGHT 8
34#define DEFAULT_BG_COLOR 0x99
35
36enum Justify { JUSTIFY_NONE = 0, JUSTIFY_CENTER = 1, JUSTIFY_RIGHT = 2 };
37
38struct FontData {
39 static const byte *_fontData;
40 static Common::Point *_fontWritePos;
41 static byte _textColors[4];
42 static byte _bgColor;
43 static bool _fontReduced;
44 static Justify _fontJustify;
45 static Graphics::Big5Font *_big5Font;
46};
47
49private:
50 const char *_displayString;
51 bool _msgWraps;
52 bool _isBig5;
53
58 int _fntEnOffset; // English characters
59 int _fntEnReducedOffset; // English characters (reduced)
60 int _fntNonEnOffset; // Non-English characters
61 int _fntNonEnReducedOffset; // Non-English characters (reduced)
62 int _fntEnWOffset; // English characters Width
63 int _fntEnReducedWOffset; // English characters (reduced) Width
64 int _fntNonEnWOffset; // Non-English characters Width
65 int _fntNonEnReducedWOffset; // Non-English characters (reduced) Width
66
70 uint16_t getNextChar();
71
75 bool getNextCharWidth(int &total);
76
80 bool newLine(const Common::Rect &bounds);
81
85 int fontAtoi(int len = 3);
86
90 void setTextColor(int idx);
91
95 void writeChar(uint16_t c, const Common::Rect &clipRect);
96public:
97 Common::Point &_writePos;
98public:
100 FontSurface(int wv, int hv);
101 ~FontSurface() override {}
102
107 void writeSymbol(int symbolId);
108
119 const char *writeString(const Common::String &s, const Common::Rect &clipRect, bool ttsVoiceText = true, Common::String *ttsMessage = nullptr);
120
129 const char *fitToWidth(const char *s, int maxWidth);
130 bool isSpace(char c);
136 void writeCharacter(uint16_t c, const Common::Rect &clipRect);
137};
138
139} // End of namespace Xeen
140} // End of namespace MM
141
142#endif
Definition: str.h:59
Definition: big5.h:32
Definition: xsurface.h:45
Definition: font.h:48
const char * fitToWidth(const char *s, int maxWidth)
const char * writeString(const Common::String &s, const Common::Rect &clipRect, bool ttsVoiceText=true, Common::String *ttsMessage=nullptr)
void writeCharacter(uint16_t c, const Common::Rect &clipRect)
void writeSymbol(int symbolId)
Language
Definition: language.h:45
Definition: detection.h:27
Definition: rect.h:144
Definition: rect.h:536
Definition: font.h:38