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 
29 namespace MM {
30 namespace Xeen {
31 
32 #define FONT_WIDTH 8
33 #define FONT_HEIGHT 8
34 #define DEFAULT_BG_COLOR 0x99
35 
36 enum Justify { JUSTIFY_NONE = 0, JUSTIFY_CENTER = 1, JUSTIFY_RIGHT = 2 };
37 
38 struct 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 
49 private:
50  const char *_displayString;
51  bool _msgWraps;
52  bool _isBig5;
53 
54  Common::Language lang;
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);
96 public:
97  Common::Point &_writePos;
98 public:
99  FontSurface();
100  FontSurface(int wv, int hv);
101  ~FontSurface() override {}
102 
107  void writeSymbol(int symbolId);
108 
117  const char *writeString(const Common::String &s, const Common::Rect &clipRect);
118  bool isSpace(char c);
124  void writeCharacter(uint16_t c, const Common::Rect &clipRect);
125 };
126 
127 } // End of namespace Xeen
128 } // End of namespace MM
129 
130 #endif
Definition: big5.h:32
Definition: str.h:59
Definition: xsurface.h:45
bool isSpace(int c)
Definition: rect.h:144
Definition: font.h:38
Definition: font.h:48
Definition: detection.h:27
Definition: rect.h:45
Language
Definition: language.h:45