29#ifndef NOMLIB_SDL2_TRUETYPE_FONT_HEADERS
30#define NOMLIB_SDL2_TRUETYPE_FONT_HEADERS
36#include "nomlib/config.hpp"
37#include "nomlib/graphics/fonts/IFont.hpp"
38#include "nomlib/graphics/fonts/FontMetrics.hpp"
39#include "nomlib/graphics/fonts/FontPage.hpp"
61 typedef self_type* RawPtr;
62 typedef std::shared_ptr<self_type> SharedPtr;
78 IFont::raw_ptr
clone(
void )
const override;
81 bool valid (
void )
const override;
83 enum IFont::FontType type (
void )
const override;
85 TTF_Font* font (
void )
const;
91 const Image*
image(uint32 character_size)
const override;
97 sint
spacing ( uint32 character_size )
const override;
99 int point_size()
const;
106 int newline( uint32 character_size )
const override;
115 int kerning( uint32 first_char, uint32 second_char, uint32 character_size )
const override;
131 const Glyph&
glyph ( uint32 codepoint, uint32 character_size )
const override;
193 bool load(
const std::string& filename )
override;
205 bool build ( uint32 character_size );
207 const GlyphPage& pages (
void )
const;
209 sint sheet_width (
void )
const;
210 sint sheet_height (
void )
const;
Bitmap storage container.
std::shared_ptr< TTF_Font > font_
Font file data, used by SDL_ttf extension.
int outline(void)
Obtain font's outline size.
uint32 font_style(void) const override
Get the rendering style of the font.
int hinting(void) const override
Get the font's hinting style.
bool set_hinting(int type) override
Set the requested font hinting style.
void set_font_style(uint32 style) override
Set the rendering style of the font.
bool set_point_size(int point_size) override
Set a new font point size.
bool set_outline(int outline) override
Set font's outline size.
TrueTypeFont(const TrueTypeFont ©)
Copy constructor.
bool build(uint32 character_size)
Trigger a rebuild of the font metrics from the current font; this recalculates character sizes,...
FontMetrics metrics_
General font metric data, such as the proper value for newline spacing.
sint sheet_width_
Width – in pixels – of overall texture atlas sheet.
bool load(const std::string &filename) override
Load a new TrueType font from a file.
~TrueTypeFont(void)
Destructor.
const Glyph & glyph(uint32 codepoint, uint32 character_size) const override
Obtain a glyph.
const IntRect glyph_rect(FontPage &page, int width, int height) const
Find a suitable rectangle within the texture for a glyph.
TrueTypeFont(void)
Default constructor; initialize the object to sane defaults.
void set_font_kerning(bool state) override
Set the use of kerning for the font.
sint spacing(uint32 character_size) const override
Obtain text character spacing width in pixels.
const FontMetrics & metrics(void) const override
Obtain information about the loaded font.
const Image * image(uint32 character_size) const override
sint sheet_height_
Height – in pixels – of overall texture atlas sheet.
bool valid(void) const override
Validity check.
bool use_kerning_
Whether or not to use font kerning.
IFont::raw_ptr clone(void) const override
Construct a clone of the existing instance.
int kerning(uint32 first_char, uint32 second_char, uint32 character_size) const override
Obtain the kerning pair offsets between two glyphs.
enum IFont::FontType type_
The type of font we are.
int newline(uint32 character_size) const override
Obtain font's line spacing.
Container structure for global font metric data.
Container structure for font data.
Container structure for font data.