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 
31 namespace Macs2 {
32 
33 struct GlyphData : public Sprite {
34  char _ascii = 0;
35 
36  void readFromeFile(Common::File &file);
37  void readFromMemory(Common::SeekableReadStream *stream);
38 };
39 
40 class Text {
41 public:
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  bool findGlyph(char c, GlyphData &out) const;
56  bool findGlyph(char c, GlyphData &out, const GlyphData *glyphs, uint16 numGlyphs) const;
57 
58  int measureString(const Common::String &s) const;
59  int measureString(const Common::String &s, const GlyphData *glyphs, uint16 numGlyphs) const;
60  int measureStrings(const Common::StringArray &sa) const;
61  int measureStringsVertically(const Common::StringArray &sa, int lineHeight) const;
62 };
63 
64 } // namespace Macs2
65 
66 #endif
Definition: str.h:59
Definition: stream.h:745
Definition: text.h:40
Definition: file.h:47
Definition: text.h:33
Definition: sprite.h:30
Definition: actionbar.h:31