![]() |
nomlib
|
TrueType fonts renderer. More...
#include <TrueTypeFont.hpp>
Public Types | |
| typedef TrueTypeFont | self_type |
| typedef self_type * | RawPtr |
| typedef std::shared_ptr< self_type > | SharedPtr |
| Public Types inherited from nom::IFont | |
| enum | FontType { NotDefined = 0 , BitmapFont , TrueTypeFont , BMFont } |
| typedef IFont | self_type |
| typedef self_type * | raw_ptr |
| typedef std::shared_ptr< self_type > | shared_ptr |
| typedef std::unique_ptr< self_type > | unique_ptr |
Public Member Functions | |
| TrueTypeFont (void) | |
| Default constructor; initialize the object to sane defaults. | |
| ~TrueTypeFont (void) | |
| Destructor. | |
| TrueTypeFont (const TrueTypeFont ©) | |
| Copy constructor. | |
| IFont::raw_ptr | clone (void) const override |
| Construct a clone of the existing instance. | |
| bool | valid (void) const override |
| Validity check. | |
| enum IFont::FontType | type (void) const override |
| TTF_Font * | font (void) const |
| const Image * | image (uint32 character_size) const override |
| sint | spacing (uint32 character_size) const override |
| Obtain text character spacing width in pixels. | |
| int | point_size () const |
| int | newline (uint32 character_size) const override |
| Obtain font's line spacing. | |
| int | kerning (uint32 first_char, uint32 second_char, uint32 character_size) const override |
| Obtain the kerning pair offsets between two glyphs. | |
| int | hinting (void) const override |
| Get the font's hinting style. | |
| const Glyph & | glyph (uint32 codepoint, uint32 character_size) const override |
| Obtain a glyph. | |
| int | outline (void) |
| Obtain font's outline size. | |
| uint32 | font_style (void) const override |
| Get the rendering style of the font. | |
| bool | set_point_size (int point_size) override |
| Set a new font point size. | |
| bool | set_hinting (int type) override |
| Set the requested font hinting style. | |
| bool | set_outline (int outline) override |
| Set font's outline size. | |
| void | set_font_style (uint32 style) override |
| Set the rendering style of the font. | |
| void | set_font_kerning (bool state) override |
| Set the use of kerning for the font. | |
| bool | load (const std::string &filename) override |
| Load a new TrueType font from a file. | |
| const FontMetrics & | metrics (void) const override |
| Obtain information about the loaded font. | |
Private Member Functions | |
| bool | build (uint32 character_size) |
| Trigger a rebuild of the font metrics from the current font; this recalculates character sizes, coordinate origins, spacing, etc. | |
| const GlyphPage & | pages (void) const |
| sint | sheet_width (void) const |
| sint | sheet_height (void) const |
| const IntRect | glyph_rect (FontPage &page, int width, int height) const |
| Find a suitable rectangle within the texture for a glyph. | |
Private Attributes | |
| enum IFont::FontType | type_ |
| The type of font we are. | |
| sint | sheet_width_ |
| Width – in pixels – of overall texture atlas sheet. | |
| sint | sheet_height_ |
| Height – in pixels – of overall texture atlas sheet. | |
| std::shared_ptr< TTF_Font > | font_ |
| Font file data, used by SDL_ttf extension. | |
| GlyphPage | pages_ |
| FontMetrics | metrics_ |
| General font metric data, such as the proper value for newline spacing. | |
| std::string | filename_ |
| sint | point_size_ |
| bool | use_kerning_ |
| Whether or not to use font kerning. | |
TrueType fonts renderer.
[TO BE WRITTEN]
Definition at line 57 of file TrueTypeFont.hpp.
| typedef self_type* nom::TrueTypeFont::RawPtr |
Definition at line 61 of file TrueTypeFont.hpp.
| typedef TrueTypeFont nom::TrueTypeFont::self_type |
Definition at line 60 of file TrueTypeFont.hpp.
| typedef std::shared_ptr<self_type> nom::TrueTypeFont::SharedPtr |
Definition at line 62 of file TrueTypeFont.hpp.
| nom::TrueTypeFont::TrueTypeFont | ( | void | ) |
Default constructor; initialize the object to sane defaults.
| nom::TrueTypeFont::~TrueTypeFont | ( | void | ) |
Destructor.
|
private |
Trigger a rebuild of the font metrics from the current font; this recalculates character sizes, coordinate origins, spacing, etc.
| character_size | Font's point size, in pixels, to build glyphs for. |
|
overridevirtual |
Construct a clone of the existing instance.
Implements nom::IFont.
|
overridevirtual |
Get the rendering style of the font.
Implements nom::IFont.
|
overridevirtual |
Obtain a glyph.
| codepoint | ASCII character to lookup |
| character_size | Reserved for future implementation |
Implements nom::IFont.
|
private |
Find a suitable rectangle within the texture for a glyph.
| page | Page of glyphs to search in |
| width | Width of the rectangle |
| height | Height of the rectangle |
|
overridevirtual |
Get the font's hinting style.
Implements nom::IFont.
|
overridevirtual |
Obtain the texture atlas used internally for rendering glyphs from
Implements nom::IFont.
|
overridevirtual |
Obtain the kerning pair offsets between two glyphs.
Implements nom::IFont.
|
overridevirtual |
Load a new TrueType font from a file.
Implements nom::IFont.
|
overridevirtual |
|
overridevirtual |
Obtain font's line spacing.
| character_size | Point size in pixels |
Implements nom::IFont.
| int nom::TrueTypeFont::outline | ( | void | ) |
Obtain font's outline size.
| character_size | The point size to retrieve the outline size for |
|
overridevirtual |
Set the use of kerning for the font.
Implements nom::IFont.
|
overridevirtual |
Set the rendering style of the font.
| style | A bit-mask composed of one or more of the following styles: TTF_STYLE_BOLD, TTF_STYLE_ITALIC, TTF_STYLE_UNDERLINE, TTF_STYLE_STRIKETHROUGH. |
Implements nom::IFont.
|
overridevirtual |
Set the requested font hinting style.
Implements nom::IFont.
|
overridevirtual |
Set font's outline size.
| outline | The outline size in pixels |
Implements nom::IFont.
|
overridevirtual |
Set a new font point size.
| size | Point size in pixels |
Implements nom::IFont.
|
overridevirtual |
Obtain text character spacing width in pixels.
Implements nom::IFont.
|
overridevirtual |
Implements nom::IFont.
|
overridevirtual |
Validity check.
Implements nom::IFont.
|
private |
Store the file path so we can change font sizes on the fly
Definition at line 249 of file TrueTypeFont.hpp.
|
private |
Font file data, used by SDL_ttf extension.
Definition at line 235 of file TrueTypeFont.hpp.
|
private |
General font metric data, such as the proper value for newline spacing.
Definition at line 242 of file TrueTypeFont.hpp.
|
mutableprivate |
Table mapping a character size to its page – a texture atlas combined with corresponding glyphs data.
Definition at line 239 of file TrueTypeFont.hpp.
|
private |
Font point size (in pixels)
Definition at line 257 of file TrueTypeFont.hpp.
|
private |
Height – in pixels – of overall texture atlas sheet.
Definition at line 232 of file TrueTypeFont.hpp.
|
private |
Width – in pixels – of overall texture atlas sheet.
Definition at line 229 of file TrueTypeFont.hpp.
|
private |
The type of font we are.
Definition at line 226 of file TrueTypeFont.hpp.
|
private |
Whether or not to use font kerning.
Definition at line 262 of file TrueTypeFont.hpp.