X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fgraphics%2FFont.hpp;h=d52d43f63e179df4539d4687f50d30609815e6cd;hb=7570271f7e1ede3ef65808f859597001338a7fe6;hp=2219452b86f8b71a11737402e508db5c2c802e4f;hpb=282d731ea8f10342efa82012028de7043b3dd639;p=blank.git diff --git a/src/graphics/Font.hpp b/src/graphics/Font.hpp index 2219452..d52d43f 100644 --- a/src/graphics/Font.hpp +++ b/src/graphics/Font.hpp @@ -1,8 +1,9 @@ #ifndef BLANK_GRAPHICS_FONT_HPP_ #define BLANK_GRAPHICS_FONT_HPP_ +#include "glm.hpp" + #include -#include namespace blank { @@ -11,6 +12,21 @@ class Texture; class Font { +public: + enum FontStyle { + STYLE_NORMAL = TTF_STYLE_NORMAL, + STYLE_BOLD = TTF_STYLE_BOLD, + STYLE_ITALIC = TTF_STYLE_ITALIC, + STYLE_UNDERLINE = TTF_STYLE_UNDERLINE, + STYLE_STRIKE = TTF_STYLE_STRIKETHROUGH, + }; + enum FontHinting { + HINT_NORMAL = TTF_HINTING_NORMAL, + HINT_LIGHT = TTF_HINTING_LIGHT, + HINT_MONO = TTF_HINTING_MONO, + HINT_NONE = TTF_HINTING_NONE, + }; + public: Font(const char *src, int size, long index = 0); ~Font(); @@ -22,6 +38,13 @@ public: Font &operator =(const Font &) = delete; public: + int Style() const noexcept; + void Style(int) const noexcept; + int Outline() const noexcept; + void Outline(int) noexcept; + + int Hinting() const noexcept; + void Hinting(int) const noexcept; bool Kerning() const noexcept; void Kerning(bool) noexcept; @@ -30,11 +53,15 @@ public: int Descent() const noexcept; int LineSkip() const noexcept; + const char *FamilyName() const noexcept; + const char *StyleName() const noexcept; + bool HasGlyph(Uint16) const noexcept; - glm::tvec2 TextSize(const char *) const; + glm::ivec2 TextSize(const char *) const; - Texture Render(const char *, SDL_Color) const; + Texture Render(const char *) const; + void Render(const char *, Texture &) const; private: TTF_Font *handle;