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 "xeen/xsurface.h"
27 
28 namespace Xeen {
29 
30 #define FONT_WIDTH 8
31 #define FONT_HEIGHT 8
32 #define DEFAULT_BG_COLOR 0x99
33 
34 enum Justify { JUSTIFY_NONE = 0, JUSTIFY_CENTER = 1, JUSTIFY_RIGHT = 2 };
35 
36 struct FontData {
37  static const byte *_fontData;
38  static Common::Point *_fontWritePos;
39  static byte _textColors[4];
40  static byte _bgColor;
41  static bool _fontReduced;
42  static Justify _fontJustify;
43 };
44 
45 class FontSurface: public XSurface, public FontData {
46 private:
47  const char *_displayString;
48  bool _msgWraps;
49 
50  Common::Language lang;
54  int _fntEnOffset; // English characters
55  int _fntEnReducedOffset; // English characters (reduced)
56  int _fntNonEnOffset; // Non-English characters
57  int _fntNonEnReducedOffset; // Non-English characters (reduced)
58  int _fntEnWOffset; // English characters Width
59  int _fntEnReducedWOffset; // English characters (reduced) Width
60  int _fntNonEnWOffset; // Non-English characters Width
61  int _fntNonEnReducedWOffset; // Non-English characters (reduced) Width
62 
66  char getNextChar();
67 
71  bool getNextCharWidth(int &total);
72 
76  bool newLine(const Common::Rect &bounds);
77 
81  int fontAtoi(int len = 3);
82 
86  void setTextColor(int idx);
87 
91  void writeChar(char c, const Common::Rect &clipRect);
92 public:
93  Common::Point &_writePos;
94 public:
95  FontSurface();
96  FontSurface(int wv, int hv);
97  ~FontSurface() override {}
98 
103  void writeSymbol(int symbolId);
104 
113  const char *writeString(const Common::String &s, const Common::Rect &clipRect);
114  bool isSpace(char c);
120  void writeCharacter(char c, const Common::Rect &clipRect);
121 };
122 
123 } // End of namespace Xeen
124 
125 #endif /* XEEN_FONT_H */
Definition: str.h:59
Definition: xsurface.h:43
bool isSpace(int c)
Definition: rect.h:144
Definition: font.h:36
Definition: rect.h:45
Definition: font.h:45
Definition: character.h:33
Language
Definition: language.h:45