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#ifndef MACS2_TEXT_H
23#define MACS2_TEXT_H
24
25#include "common/file.h"
26#include "common/str.h"
27#include "common/str-array.h"
28#include "common/stream.h"
29#include "macs2/sprite.h"
30
31namespace Macs2 {
32
33struct GlyphData : public Sprite {
34 char _ascii = 0;
35
36 void readFromeFile(Common::File &file);
37 void readFromMemory(Common::SeekableReadStream *stream);
38};
39
40class Text {
41public:
42 static constexpr uint kMaxGlyphs = 256;
43
44 GlyphData _glyphs[kMaxGlyphs];
45 GlyphData _panelGlyphs[kMaxGlyphs];
46 GlyphData _overlayGlyphs[kMaxGlyphs];
47 uint16 _numGlyphs = 79;
48 uint16 _maxGlyphHeight = 0;
49 uint16 numOverlayGlyphs = 0;
50 uint16 maxOverlayGlyphHeight = 0;
51 uint16 numPanelGlyphs = 0;
52 uint16 maxPanelGlyphHeight = 0;
53 uint16 amigaTextLinePitch = 0;
54
55 void addDialogueFontFallbacks();
56 void addIntroFontFallbacks();
57
58 bool findGlyph(char c, GlyphData &out) const;
59 bool findGlyph(char c, GlyphData &out, const GlyphData *glyphs, uint16 numGlyphs) const;
60
61 int measureString(const Common::String &s) const;
62 int measureString(const Common::String &s, const GlyphData *glyphs, uint16 numGlyphs) const;
63 int measureStrings(const Common::StringArray &sa) const;
64 int measureStringsVertically(const Common::StringArray &sa, int lineHeight) const;
65};
66
67} // namespace Macs2
68
69#endif
Definition: file.h:47
Definition: stream.h:745
Definition: str.h:59
Definition: text.h:40
Definition: text.h:33
Definition: sprite.h:30