29#ifndef NOMLIB_GRAPHICS_TEXT_HPP
30#define NOMLIB_GRAPHICS_TEXT_HPP
35#include "nomlib/config.hpp"
36#include "nomlib/graphics/IDrawable.hpp"
37#include "nomlib/math/Transformable.hpp"
38#include "nomlib/math/Point2.hpp"
39#include "nomlib/math/Size2.hpp"
40#include "nomlib/graphics/Texture.hpp"
41#include "nomlib/graphics/fonts/Font.hpp"
45class Text:
public Transformable
48 typedef Text self_type;
49 typedef Transformable derived_type;
76 const std::string&
text,
78 uint character_size = nom::DEFAULT_FONT_SIZE,
79 const Color4i& text_color = Color4i::White
85 const std::string&
text,
87 uint character_size = nom::DEFAULT_FONT_SIZE,
88 const Color4i& text_color = Color4i::White
97 Text(
const self_type& rhs);
120 const Font& font()
const;
157 const std::string&
text (
void )
const;
234 multiline_width(
const std::string& text_buffer, nom::size_type pos)
const;
Font interface wrapper for nom::IFont derived objects.
const RenderWindow RenderTarget
Run-time type information (RTTI) container class.
uint32 style(void) const
Get text style.
virtual void set_position(const Point2i &pos) override
Set the position of the rendered text.
const Color4i & color(void) const
Get text color.
std::unique_ptr< Texture > rendered_text_
The texture containing the rendered text.
sint text_height(const std::string &text_string) const
Obtain the text height in pixels of the set text.
int width() const
Get the current text width.
bool valid(void) const
Obtain validity of the Text object.
void draw(RenderTarget &target) const override
uint text_size(void) const
Get text character size (in pixels?).
void set_text(const std::string &text)
Set the text string to be rendered.
const std::string & text(void) const
Get text string.
void set_text_kerning(bool state)
Set the use of rendering glyphs with respect to kerning offsets, when supported by the underlying fon...
Text(const self_type &rhs)
Copy constructor.
void set_text_size(uint character_size)
Set the text's font point size.
void set_font(const Font &font)
Set the font to use in rendering text.
void set_color(const Color4i &text_color)
Set text's font color.
Texture * clone_texture() const
Get a deep-copy instance of the underlying texture used for the text rendering.
void update() override
Apply requested transformations, styles, etc.
Text(void)
Default constructor.
uint32 style_
Current text effect set.
ObjectTypeInfo type() const override
Re-implements the IObject::type method.
Text * clone() const
Implements the required IDrawable::clone method.
Text(const std::string &text, Font *font, uint character_size=nom::DEFAULT_FONT_SIZE, const Color4i &text_color=Color4i::White)
Construct a Text, initializing it with a text string, a nom::Font object pointer and character size.
Style
Font face style; multiple styles can be combined from bitwise masks.
std::string text_
Holds contents of text as a string buffer.
void set_style(uint32 style)
Set the text's rendering style for the font.
Texture glyphs_texture_
A texture atlas created from the nom::Font instance that is referred to in rendering a text.
int height() const
Get the current text height.
void set_font(Font *font)
Set the font to use in rendering text.
int text_width(const std::string &text_buffer) const
Obtain the text width (in pixels) of the set text.
Text(const std::string &text, const Font &font, uint character_size=nom::DEFAULT_FONT_SIZE, const Color4i &text_color=Color4i::White)
Construct a Text, initializing it with a text string, a nom::Font object reference and character size...
self_type & operator=(const self_type &rhs)
Copy assignment operator.