ScummVM API documentation
korfont.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 GRAPHICS_KORFONT_H
23#define GRAPHICS_KORFONT_H
24
25#include "common/str.h"
26#include "graphics/surface.h"
27
28namespace Graphics {
29
43public:
44 virtual ~FontKorean() {}
45
53 static FontKorean *createFont(const char * fontFile);
54
58 virtual bool loadData(const char *fontFile) = 0;
59
67 kDefaultMode,
68 kOutlineMode,
69 kShadowMode
70 };
71
72 virtual void setDrawingMode(DrawingMode mode) {}
73
77 virtual void toggleFlippedMode(bool enable) {}
78
82 virtual void setCharSpacing(int spacing) {}
83 virtual void setLineSpacing(int spacing) {}
84
88 virtual uint getFontHeight() const = 0;
89
93 virtual uint getMaxFontWidth() const = 0;
94
98 virtual uint getCharWidth(uint16 ch) const = 0;
99
103 void drawChar(Graphics::Surface &dst, uint16 ch, int x, int y, uint32 c1, uint32 c2) const;
104
117 virtual void drawChar(void *dst, uint16 ch, int pitch, int bpp, uint32 c1, uint32 c2, int maxW, int maxH) const = 0;
118};
119
124public:
126
127 void setDrawingMode(DrawingMode mode) override;
128
129 void toggleFlippedMode(bool enable) override;
130
131 uint getFontHeight() const override;
132
133 uint getMaxFontWidth() const override;
134
135 uint getCharWidth(uint16 ch) const override;
136
137 void drawChar(void *dst, uint16 ch, int pitch, int bpp, uint32 c1, uint32 c2, int maxW, int maxH) const override;
138private:
139 template<typename Color>
140 void blitCharacter(const uint8 *glyph, const int w, const int h, uint8 *dst, int pitch, Color c) const;
141 void createOutline(uint8 *outline, const uint8 *glyph, const int w, const int h) const;
142
143protected:
144 DrawingMode _drawMode;
145 bool _flippedMode;
146 int _fontWidth, _fontHeight;
147 uint8 _bitPosNewLineMask;
148
149 bool isASCII(uint16 ch) const;
150
151 virtual const uint8 *getCharData(uint16 c) const = 0;
152
153 enum DrawingFeature {
154 kFeatDefault = 1 << 0,
155 kFeatOutline = 1 << 1,
156 kFeatShadow = 1 << 2,
157 kFeatFMTownsShadow = 1 << 3,
158 kFeatFlipped = 1 << 4
159 };
160
161 virtual bool hasFeature(int feat) const = 0;
162};
163
168public:
174 bool loadData(const char *fontFile) override;
175private:
176 uint8 *_fontData16x16;
177 uint _fontData16x16Size;
178
179 uint8 *_fontData8x16;
180 uint _fontData8x16Size;
181
182 uint8 *_fontData8x8;
183 uint _fontData8x8Size;
184
185 const uint8 *getCharData(uint16 c) const override;
186
187 bool hasFeature(int feat) const override;
188
189 const uint8 *getCharDataPCE(uint16 c) const;
190 const uint8 *getCharDataDefault(uint16 c) const;
191
192 enum {
193 kKoreanFontVersion = 3
194 };
195};
196
201public:
207 bool loadData(const char *fontFile) override;
208private:
209 enum {
210 eFontNumChars = 256,
211 kFontNumChars = 2530
212 };
213
214 int _fontShadow;
215 uint8 *_fontData;
216 uint _fontDataSize;
217
218 int _englishFontWidth;
219 int _englishFontHeight;
220 uint8 *_englishFontData;
221 uint _englishFontDataSize;
222
223
224 const uint8 *getCharData(uint16 c) const override;
225
226 bool hasFeature(int feat) const override;
227
228 bool englishLoadData(const char *fontFile);
229};
231} // End of namespace Graphics
232
233#endif
Definition: korfont.h:123
uint getCharWidth(uint16 ch) const override
uint getFontHeight() const override
uint getMaxFontWidth() const override
void drawChar(void *dst, uint16 ch, int pitch, int bpp, uint32 c1, uint32 c2, int maxW, int maxH) const override
void toggleFlippedMode(bool enable) override
Definition: korfont.h:42
virtual void drawChar(void *dst, uint16 ch, int pitch, int bpp, uint32 c1, uint32 c2, int maxW, int maxH) const =0
virtual uint getMaxFontWidth() const =0
virtual uint getFontHeight() const =0
DrawingMode
Definition: korfont.h:66
virtual bool loadData(const char *fontFile)=0
virtual void toggleFlippedMode(bool enable)
Definition: korfont.h:77
static FontKorean * createFont(const char *fontFile)
void drawChar(Graphics::Surface &dst, uint16 ch, int x, int y, uint32 c1, uint32 c2) const
virtual uint getCharWidth(uint16 ch) const =0
virtual void setCharSpacing(int spacing)
Definition: korfont.h:82
Definition: korfont.h:167
bool loadData(const char *fontFile) override
Definition: korfont.h:200
bool loadData(const char *fontFile) override
Definition: formatinfo.h:28
Definition: surface.h:67