29 #ifndef NOMLIB_SDL2_TRUETYPE_FONT_HEADERS
30 #define NOMLIB_SDL2_TRUETYPE_FONT_HEADERS
38 #include "nomlib/config.hpp"
39 #include "nomlib/graphics/IFont.hpp"
40 #include "nomlib/math/Coords.hpp"
41 #include "nomlib/math/Rect-inl.hpp"
42 #include "nomlib/math/Color.hpp"
43 #include "nomlib/graphics/Texture.hpp"
44 #include "nomlib/graphics/Window.hpp"
45 #include "nomlib/SDL_helpers.hpp"
61 IFont::SharedPtr
clone (
void )
const;
64 bool valid (
void )
const;
67 const std::string&
getText (
void )
const;
77 const Color& getColor (
void )
const;
78 const Coords& getPosition (
void )
const;
86 IFont::TextAlignment getTextJustification (
void )
const;
96 void setText (
const std::string& text );
130 void draw ( SDL_Renderer* target )
const;
143 std::shared_ptr<TTF_Font>
font;
167 enum IFont::TextAlignment text_alignment;
181 #endif // include guard defined
bool load(const std::string &filename, const Color &colorkey, bool use_cache=false)
Load a new font in from a file.
std::shared_ptr< TTF_Font > font
Font file data, used by SDL_ttf extension.
void draw(SDL_Renderer *target) const
Draw the set text string to the video surface.
void setText(const std::string &text)
Set a new text string for drawing; defaults to \0.
int32 getFontHeight(void) const
Compute the height in pixels of the set text string; defaults to zero (0)
void setFontOutline(int32 depth)
Set a new vector outline – in pixels – for the loaded font.
const std::string & getText(void) const
Obtains set text string buffer; defaults to \0.
void setFontStyle(int32 style, uint8 options=150)
IFont::SharedPtr clone(void) const
Return a std::shared_ptr copy of this instance.
int32 getFontOutline(void) const
Getter for obtaining the vector outline of the loaded font.
RenderStyle
Text rendering qualities.
int32 getFontWidth(void) const
Compute the width in pixels of the set text string; defaults to zero (0)
FontStyle text_style
Current text effect set.
~TrueTypeFont(void)
Default destructor; we shutdown the SDL_ttf extension here.
std::string filename
Store the file path so we can change font sizes on the fly.
Texture font_buffer
Surface where font for drawing is rendered to.
FontStyle
Text effect styling.
void setSpacing(uint32 spaces)
Not implemented.
uint32 getSpacing(void) const
Not implemented.
Coords coords
Positioning coordinates (including width and height)
IFont::RenderStyle getRenderingStyle(void) const
Getter for obtaining the current font rendering style in use.
uint32 getNewline(void) const
Not implemented.
std::string text_buffer
holds contents of text as a string buffer
TrueTypeFont(void)
Default constructor; we initialize the SDL_ttf extension here.
bool valid(void) const
Is this object initialized – not nullptr?
Coordinate values (x, y, z, width, height ) wrapper.
bool use_cache
Whether or not to use caching features of nom::ObjectCache.
int32 font_size
Font point (pixel) size; defaults to 12.
void setTextJustification(IFont::TextAlignment alignment)
Not implemented.
Utility class container for RGBA colors.
void setRenderingStyle(IFont::RenderStyle)
Set a new font rendering style.
void setFontSize(int32 point_size)
Set a new text point size.