ScummVM API documentation
amigafont.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_FONTS_AMIGAFONT_H
23#define GRAPHICS_FONTS_AMIGAFONT_H
24
25#include "graphics/font.h"
26
27namespace Common {
28class SeekableReadStream;
29}
30
31namespace Graphics {
32
33class AmigaFont : public Font {
34
35#include "common/pack-start.h"
36 struct CharLoc {
37 uint16 _offset;
38 uint16 _length;
39 };
40
41 struct AmigaDiskFont {
42 uint16 _ySize;
43 byte _style;
44 byte _flags;
45 uint16 _xSize;
46 uint16 _baseline;
47 uint16 _boldSmear;
48 uint16 _accessors; // unused
49 byte _loChar;
50 byte _hiChar;
51 uint32 _charData;
52 uint16 _modulo;
53 uint32 _charLoc;
54 uint32 _charSpace;
55 uint32 _charKern;
56 };
57#include "common/pack-end.h"
58
59public:
60 enum Topaz9Builtin {
61 kTopaz9Builtin
62 };
63
64private:
65 AmigaDiskFont *_font;
66 byte *_data;
67 byte *_charData;
68 CharLoc *_charLoc;
69 uint16 *_charSpace;
70 uint16 *_charKern;
71
72 byte *_cp;
73 uint32 _pitch;
74 int _maxCharWidth;
75
76private:
77 void initFromData(const byte *data, uint32 dataSize, uint32 fontOffset);
78 bool isProportional() const;
79 int16 getCharSpace(byte c) const;
80 int16 getCharKern(byte c) const;
81 uint16 getPixels(byte c) const;
82 uint16 getOffset(byte c) const;
83
84 uint32 mapChar(uint32 c) const;
85
86public:
94 AmigaFont(Topaz9Builtin);
95 virtual ~AmigaFont();
96
97 int getFontHeight() const override;
98 int getCharWidth(uint32 chr) const override;
99 int getMaxCharWidth() const override;
100 int getKerningOffset(uint32 left, uint32 right) const override;
101 int getCharAdvanceWidth(uint32 chr) const;
102 int getCharDrawOffset(uint32 chr) const;
103 int getCharInkWidth(uint32 chr) const;
104 int getCharRenderWidth(uint32 chr) const;
105 void drawCharDoubleHeight(Surface *dst, uint32 chr, int x, int y, uint32 color) const;
106 void drawChar(Surface *dst, uint32 chr, int x, int y, uint32 color) const override;
107
108 int getLoChar() const { return _font->_loChar; }
109 int getHiChar() const { return _font->_hiChar; }
110};
111
112} // End of namespace Graphics
113
114#endif
Definition: stream.h:745
Definition: amigafont.h:33
void drawChar(Surface *dst, uint32 chr, int x, int y, uint32 color) const override
int getMaxCharWidth() const override
AmigaFont(Common::SeekableReadStream *stream=NULL)
int getFontHeight() const override
int getKerningOffset(uint32 left, uint32 right) const override
int getCharWidth(uint32 chr) const override
Definition: font.h:83
Definition: algorithm.h:29
Definition: formatinfo.h:28
Definition: surface.h:67