Debian Codegraph @

src/effect/Font.h

raw
1 #ifndef HEADER_FONT_H
2 #define HEADER_FONT_H
3
4 class Path;
5
6 #include "NoCopy.h"
7
8 #include "SDL.h"
9 #include "SDL_ttf.h"
10
11 #include <string>
12
13 /**
14 * TrueType UTF-8 font.
15 */
16 class Font : public NoCopy {
17 private:
18 TTF_Font *m_ttfont;
19 SDL_Color m_bg;
20 private:
21 static std::string biditize(const std::string &text);
22 public:
23 Font(const Path &file_ttf, int height);
24 ~Font();
25 static void init();
26 static void shutdown();
27
28 int getHeight() { return TTF_FontHeight(m_ttfont); }
29 int calcTextWidth(const std::string &text);
30 SDL_Surface *renderText(const std::string &text,
31 const SDL_Color &color) const;
32 SDL_Surface *renderTextOutlined(const std::string &text,
33 const SDL_Color &color, int outlineWidth=1) const;
34 };
35
36 #endif