ScummVM API documentation
shape_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 ULTIMA8_GFX_FONTS_SHAPEFONT_H
23 #define ULTIMA8_GFX_FONTS_SHAPEFONT_H
24 
25 #include "ultima/ultima8/gfx/fonts/font.h"
26 #include "ultima/ultima8/gfx/shape.h"
27 
28 namespace Ultima {
29 namespace Ultima8 {
30 
31 class ShapeFont : public Font, public Shape {
32  int _height;
33  int _baseLine;
34  int _vLead;
35  int _hLead;
36  bool _crusaderCharMap;
37 
38 public:
39  ShapeFont(const uint8 *data, uint32 size, const ConvertShapeFormat *format,
40  const uint16 flexId, const uint32 shapenum);
41  ~ShapeFont() override;
42 
43  int getHeight() override;
44  int getBaseline() override;
45  int getBaselineSkip() override;
46 
47  int getWidth(char c);
48  int getVlead() const {
49  return _vLead;
50  }
51  int getHlead() const {
52  return _hLead;
53  }
54 
55  void setVLead(int vl) {
56  _vLead = vl;
57  }
58  void setHLead(int hl) {
59  _hLead = hl;
60  }
61 
62  int charToFrameNum(char c) const;
63 
64  void getStringSize(const Std::string &text,
65  int32 &width, int32 &height) override;
66 
67  RenderedText *renderText(const Std::string &text,
68  unsigned int &remaining, int32 width = 0, int32 height = 0,
69  TextAlign align = TEXT_LEFT, bool u8specials = false,
70  bool pagebreaks = false,
71  Std::string::size_type cursor = Std::string::npos) override;
72 };
73 
74 } // End of namespace Ultima8
75 } // End of namespace Ultima
76 
77 #endif
Definition: font.h:41
Definition: shape_font.h:31
RenderedText * renderText(const Std::string &text, unsigned int &remaining, int32 width=0, int32 height=0, TextAlign align=TEXT_LEFT, bool u8specials=false, bool pagebreaks=false, Std::string::size_type cursor=Std::string::npos) override
int getBaselineSkip() override
get the baselineskip of the font (distance between two baselines)
int getBaseline() override
get the baseline of the font (relative from the top)
Definition: convert_shape.h:35
Definition: rendered_text.h:30
Definition: detection.h:27
int getHeight() override
get the height of the font
void getStringSize(const Std::string &text, int32 &width, int32 &height) override
Definition: string.h:30
Definition: shape.h:38