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 
22 #ifndef EEM_FONT_H
23 #define EEM_FONT_H
24 
25 #include "common/array.h"
26 #include "common/path.h"
27 #include "common/scummsys.h"
28 #include "common/str.h"
29 
30 #include "graphics/font.h"
31 
32 namespace Graphics {
33 class MacFONTFont;
34 }
35 
36 namespace EEM {
37 
39 struct FontGlyph {
40  uint8 height = 0;
41  uint8 widthBits = 0;
42  uint8 sizeBytes = 0;
43  Common::Array<byte> bitmap;
44 };
45 
55 class EEMFont : public Graphics::Font {
56 public:
57  EEMFont() = default;
58  ~EEMFont() override;
59 
60  bool load(const Common::Path &path);
61  bool loadMacResource(const Common::Path &path, uint16 resourceId, int size);
62  bool isLoaded() const { return _macFont || !_glyphs.empty(); }
63 
64  int getFontHeight() const override;
65  int getMaxCharWidth() const override;
66  int getCharWidth(uint32 chr) const override;
67  void drawChar(Graphics::Surface *dst, uint32 chr, int x, int y,
68  uint32 color) const override;
69  using Graphics::Font::drawChar; // keep ManagedSurface overload
70 
73  int drawWordWrapped(Graphics::ManagedSurface *dst, int x, int y,
74  int width, const Common::String &s, uint32 color) const;
75 
76 private:
77  void clear();
78 
80  Graphics::MacFONTFont *_macFont = nullptr;
81  uint16 _maxHeight = 0;
82  uint16 _maxWidth = 0;
83  uint16 _lineHeight = 0;
84 };
85 
86 } // End of namespace EEM
87 
88 #endif
Definition: managed_surface.h:51
One bitmap glyph, 1 bit per pixel, MSB first.
Definition: font.h:39
Definition: str.h:59
Definition: font.h:83
Definition: surface.h:67
Definition: path.h:52
Definition: macfont.h:165
Definition: font.h:55
Definition: animation.h:30
virtual void drawChar(Surface *dst, uint32 chr, int x, int y, uint32 color) const =0
Definition: formatinfo.h:28