ScummVM API documentation
string_v7.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 SCUMM_STRING_V7_H
23#define SCUMM_STRING_V7_H
24
25#ifdef ENABLE_SCUMM_7_8
26
27#include "common/scummsys.h"
28#include "scumm/charset_v7.h"
29
30namespace Scumm {
31
32class ScummEngine;
33
34class TextRenderer_v7 {
35public:
36 TextRenderer_v7(ScummEngine *vm, GlyphRenderer_v7 *gr);
37 ~TextRenderer_v7() {}
38
39 void drawString(const char *str, byte *buffer, Common::Rect &clipRect, int x, int y, int pitch, int16 col, TextStyleFlags flags);
40 void drawStringWrap(const char *str, byte *buffer, Common::Rect &clipRect, int x, int y, int pitch, int16 col, TextStyleFlags flags);
41
42 int getStringWidth(const char *str) { return getStringWidth(str, 100000); }
43 int getStringHeight(const char *str) { return getStringHeight(str, 100000); }
44
45 Common::Rect calcStringDimensions(const char *str, int x, int y, TextStyleFlags flags);
46
47 static inline bool is2ByteCharacter(Common::Language lang, byte c) {
48 if (lang == Common::JA_JPN)
49 return (c >= 0x80 && c <= 0x9F) || (c >= 0xE0 && c <= 0xFD);
50 else if (lang == Common::KO_KOR)
51 return (c >= 0xB0 && c <= 0xD0);
52 else if (lang == Common::ZH_TWN || lang == Common::ZH_CHN)
53 return (c >= 0x80);
54 return false;
55 }
56
57private:
58 int getStringWidth(const char *str, uint numBytesMax);
59 int getStringHeight(const char *str, uint numBytesMax);
60 void drawSubstring(const char *str, uint numBytesMax, byte *buffer, Common::Rect &clipRect, int x, int y, int pitch, int16 &col, TextStyleFlags flags);
61
62 const Common::Language _lang;
63 const byte _gameId;
64 const bool _useCJKMode;
65 const int _direction;
66 const int _rtlCenteredOffset;
67 const int _spacing;
68 const byte _2byteCharWidth;
69 const char _lineBreakMarker;
70 const bool _newStyle;
71 const uint16 _screenWidth;
72 GlyphRenderer_v7 *_gr;
73};
74
75} // End of namespace Scumm
76
77#endif
78#endif
Language
Definition: language.h:45
Definition: actor.h:30
Definition: rect.h:536