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 
27 namespace Common {
28 class SeekableReadStream;
29 }
30 
31 namespace Graphics {
32 
33 class 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 
59  AmigaDiskFont *_font;
60  byte *_data;
61  byte *_charData;
62  CharLoc *_charLoc;
63  uint16 *_charSpace;
64  uint16 *_charKern;
65 
66  byte *_cp;
67  uint32 _pitch;
68  int _maxCharWidth;
69 
70 private:
71  uint16 getPixels(byte c) const;
72  uint16 getOffset(byte c) const;
73 
74  uint32 mapChar(uint32 c) const;
75 
76 public:
83  AmigaFont(Common::SeekableReadStream *stream = NULL);
84  virtual ~AmigaFont();
85 
86  virtual int getFontHeight() const;
87  virtual int getCharWidth(uint32 chr) const;
88  virtual int getMaxCharWidth() const;
89  virtual int getKerningOffset(uint32 left, uint32 right) const;
90  virtual void drawChar(Surface *dst, uint32 chr, int x, int y, uint32 color) const;
91 
92  int getLoChar() { return _font->_loChar; }
93  int getHiChar() { return _font->_hiChar; }
94 };
95 
96 } // End of namespace Graphics
97 
98 #endif
Definition: font.h:83
Definition: surface.h:67
Definition: stream.h:745
Definition: algorithm.h:29
Definition: formatinfo.h:28
Definition: amigafont.h:33