ScummVM API documentation
te_i_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 TETRAEDGE_TE_TE_I_FONT_H
23 #define TETRAEDGE_TE_TE_I_FONT_H
24 
25 #include "common/str.h"
26 #include "graphics/font.h"
27 #include "tetraedge/te/te_color.h"
28 #include "tetraedge/te/te_image.h"
29 #include "tetraedge/te/te_resource.h"
30 #include "tetraedge/te/te_vector3f32.h"
31 
32 namespace Tetraedge {
33 
37 class TeIFont : public TeResource {
38 public:
39  enum AlignStyle {
40  AlignLeft,
41  AlignRight,
42  AlignJustify,
43  AlignCenter
44  };
45 
46  struct GlyphData {
47  uint32 _charcode;
48  Common::Rect _bitmapSize;
50  };
51 
52  TeIFont();
53  virtual ~TeIFont();
54  virtual Graphics::Font *getAtSize(uint size) = 0;
55 
56  virtual float ascender(uint pxSize);
57  virtual float descender(uint pxSize);
58  virtual float height(uint pxSize);
59  virtual TeVector3f32 kerning(uint pxSize, uint isocode1, uint isocode2);
60 
61  virtual void draw(TeImage &destImage, const Common::String &str, int fontSize, int yoff, const TeColor &col, AlignStyle alignMode);
62  virtual Common::Rect getBBox(const Common::String &str, int fontSize);
63  virtual int getHeight(int fontSize);
64  virtual int wordWrapText(const Common::String &str, int fontSize, int maxWidth, Common::Array<Common::String> &lines);
65 
66  virtual TeIFont::GlyphData glyph(uint pxSize, uint charcode);
67 
68 protected:
69  Common::CodePage _codePage;
70 
71 private:
72  Common::CodePage codePage() const;
73 
74 };
75 
76 } // end namespace Tetraedge
77 
78 #endif // TETRAEDGE_TE_TE_I_FONT_H
Definition: te_image.h:40
Definition: str.h:59
Definition: font.h:83
Definition: detection.h:27
Definition: te_resource.h:31
Definition: te_color.h:30
Definition: rect.h:144
Definition: te_i_font.h:37
Definition: te_i_font.h:46
Definition: te_intrusive_ptr.h:31
Definition: te_vector3f32.h:33