1
0
mirror of git://projects.qi-hardware.com/gmenu2x.git synced 2025-04-21 12:27:27 +03:00

Made Font ownership explicit using unique_ptr

This commit is contained in:
Maarten ter Huurne
2014-07-31 23:20:31 +02:00
parent 902145b698
commit e32964bb50
4 changed files with 13 additions and 19 deletions

View File

@@ -5,20 +5,26 @@
#define FONT_H
#include <SDL_ttf.h>
#include <memory>
#include <string>
class Surface;
/**
* Wrapper around a TrueType or other FreeType-supported font.
* The wrapper is valid even if the font couldn't be loaded, but in that case
* nothing will be drawn.
*/
class Font {
public:
enum HAlign { HAlignLeft, HAlignRight, HAlignCenter };
enum VAlign { VAlignTop, VAlignBottom, VAlignMiddle };
/**
* Returns a newly created Font object for the default font,
* or nullptr if there was a problem creating it.
* Returns a newly created Font object for the default font.
*/
static Font *defaultFont();
static std::unique_ptr<Font> defaultFont();
Font(const std::string &path, unsigned int size);
~Font();