ScummVM API documentation
tt_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_TTFONT_H
23 #define ULTIMA8_GFX_FONTS_TTFONT_H
24 
25 #include "ultima/ultima8/gfx/fonts/font.h"
26 #include "graphics/font.h"
27 #include "graphics/pixelformat.h"
28 
29 namespace Ultima {
30 namespace Ultima8 {
31 
32 class TTFont : public Font {
33 public:
34  TTFont(Graphics::Font *font, uint32 rgb, int bordersize,
35  bool antiAliased, bool SJIS);
36  ~TTFont() override;
37 
38  int getHeight() override;
39  int getBaseline() override;
40  int getBaselineSkip() override;
41 
42  bool isAntialiased() {
43  return _antiAliased;
44  }
45 
46  void getStringSize(const Std::string &text,
47  int32 &width, int32 &height) override;
48 
49  void getTextSize(const Std::string &text,
50  int32 &resultwidth, int32 &resultheight, unsigned int &remaining,
51  int32 width = 0, int32 height = 0, TextAlign align = TEXT_LEFT,
52  bool u8specials = false, bool pagebreaks = false) override;
53 
54  RenderedText *renderText(const Std::string &text,
55  unsigned int &remaining, int32 width = 0, int32 height = 0,
56  TextAlign align = TEXT_LEFT, bool u8specials = false,
57  bool pagebreaks = false,
58  Std::string::size_type cursor = Std::string::npos) override;
59 
60 protected:
61  Graphics::Font *_ttfFont;
62  uint32 _color;
63  int _borderSize;
64  bool _antiAliased;
65  bool _SJIS;
66  Graphics::PixelFormat _PF_RGBA;
67 
68  uint16 _bullet;
69 
70  void addTextBorder(Graphics::ManagedSurface &textSurf, uint32 *texBuf, const Ultima::Ultima8::Rect &dims, int32 resultWidth, int32 resultHeight, uint32 borderColor);
71 };
72 
73 } // End of namespace Ultima8
74 } // End of namespace Ultima
75 
76 #endif
Definition: managed_surface.h:51
Definition: font.h:41
int getBaselineSkip() override
get the baselineskip of the font (distance between two baselines)
Definition: font.h:82
Definition: rect.h:32
void getStringSize(const Std::string &text, int32 &width, int32 &height) override
Definition: pixelformat.h:138
Definition: tt_font.h:32
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
Definition: rendered_text.h:30
int getBaseline() override
get the baseline of the font (relative from the top)
Definition: detection.h:27
int getHeight() override
get the height of the font
Definition: string.h:30
void getTextSize(const Std::string &text, int32 &resultwidth, int32 &resultheight, unsigned int &remaining, int32 width=0, int32 height=0, TextAlign align=TEXT_LEFT, bool u8specials=false, bool pagebreaks=false) override