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 * This file is dual-licensed.
22 * In addition to the GPLv3 license mentioned above, MojoTouch has
23 * exclusively licensed this code on March 23th, 2024, to be used in
24 * closed-source products.
25 * Therefore, any contributions (commits) to it will also be dual-licensed.
26 *
27 */
28
29#ifndef TOON_FONT_H
30#define TOON_FONT_H
31
32#include "toon/toon.h"
33
34namespace Toon {
35
36class DemoFont;
37
39public:
42
43 void setFont(Animation *font);
44 bool loadDemoFont(const Common::Path &filename);
45 void computeSize(const Common::String &origText, int16 *retX, int16 *retY);
46 void renderText(int16 x, int16 y, const Common::String &origText, int32 mode);
47 void renderMultiLineText(int16 x, int16 y, const Common::String &origText, int32 mode, Graphics::Surface &frame);
48 void setFontColorByCharacter(int32 characterId);
49 void setFontColor(int32 fontColor1, int32 fontColor2, int32 fontColor3);
50protected:
51 Animation *_currentFont;
52 DemoFont *_currentDemoFont;
53 ToonEngine *_vm;
54 byte _currentFontColor[4];
55 byte textToFont(byte c);
56};
57
59 uint8 width;
60 uint8 heightOffset; // # lines from top
61 uint8 height;
62
64 width = 0;
65 heightOffset = 0;
66 height = 0;
67 }
68};
69
70// The font format used by the English demo.
71class DemoFont {
72public:
73 DemoFont(uint8 glyphWidth, uint8 glyphHeight, uint16 numGlyphs);
74 ~DemoFont();
75
76 uint8 *getGlyphData();
77 uint8 *getGlyphData(uint8 glyphNum);
78
79 uint8 getGlyphWidth(uint8 glyphNum);
80 uint8 getHeight();
81 void setGlyphDimensions(uint8 glyphNum, GlyphDimensions &glyphDimensions);
82
83 void drawGlyph(Graphics::Surface &surface, int32 glyphNum, int16 xx, int16 yy, byte *colorMap);
84
85protected:
86 uint16 _numGlyphs;
87 uint8 _glyphWidth;
88 uint8 _glyphHeight;
89
90 uint8 *_glyphData;
91 GlyphDimensions *_glyphDimensions;
92};
93
94} // End of namespace Toon
95
96#endif
Definition: path.h:52
Definition: str.h:59
Definition: anim.h:54
Definition: font.h:71
Definition: font.h:38
Definition: toon.h:118
Definition: anim.h:39
Definition: surface.h:67
Definition: font.h:58