nomlib
Loading...
Searching...
No Matches
nom::IFont Class Referenceabstract

Pure abstract interface for a font resource. More...

#include <IFont.hpp>

Inheritance diagram for nom::IFont:
[legend]

Public Types

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

virtual IFont::raw_ptr clone (void) const =0
virtual bool valid (void) const =0
virtual const Imageimage (uint32) const =0
virtual enum IFont::FontType type (void) const =0
virtual const Glyphglyph (uint32, uint32) const =0
virtual int newline (uint32) const =0
virtual sint spacing (uint32) const =0
virtual int kerning (uint32, uint32, uint32) const =0
virtual int hinting (void) const =0
virtual uint32 font_style (void) const =0
virtual const FontMetricsmetrics (void) const =0
virtual bool set_point_size (int)=0
virtual bool set_hinting (int)=0
virtual bool set_outline (int)=0
virtual void set_font_style (uint32 style)=0
virtual void set_font_kerning (bool state)=0
virtual bool load (const std::string &filename)=0

Detailed Description

Pure abstract interface for a font resource.

/

nomlib's built-in font classes all derive from this pure abstract class. nom::Text focuses solely on text rendering, utilizing this common interface defined here.

In short: a font resource class is responsible for computing available glyphs (including their bounds, sizes, etc.) and most importantly, a complete cache of usable glyph bitmaps laid out in a texture atlas (in no particular packing order). nom::Text uses the font's texture atlas in addition to the font's glyph metrics (the bounds being most critical for rendering from this atlas to the screen).

See the source files of nom::BitmapFont for a complete example of how to write a custom font resource class that is suitable for nom::Text to render from. Supporting data structures include: nom::FontMetrics, nom::FontPage, nom::FontRow, nom::Glyph and so on.

[USAGE EXAMPLE STUB]

Reference: ASCII Table

Definition at line 45 of file IFont.hpp.

Member Typedef Documentation

◆ raw_ptr

typedef self_type* nom::IFont::raw_ptr

Definition at line 50 of file IFont.hpp.

◆ self_type

typedef IFont nom::IFont::self_type

Definition at line 48 of file IFont.hpp.

◆ shared_ptr

typedef std::shared_ptr<self_type> nom::IFont::shared_ptr

Definition at line 51 of file IFont.hpp.

◆ unique_ptr

typedef std::unique_ptr<self_type> nom::IFont::unique_ptr

Definition at line 52 of file IFont.hpp.

Member Enumeration Documentation

◆ FontType

enum nom::IFont::FontType

Definition at line 54 of file IFont.hpp.

Constructor & Destructor Documentation

◆ IFont()

nom::IFont::IFont ( void )
inline

Definition at line 62 of file IFont.hpp.

◆ ~IFont()

virtual nom::IFont::~IFont ( void )
inlinevirtual

Definition at line 67 of file IFont.hpp.

Member Function Documentation

◆ clone()

virtual IFont::raw_ptr nom::IFont::clone ( void ) const
pure virtual

Implemented in nom::BitmapFont, and nom::TrueTypeFont.

◆ font_style()

virtual uint32 nom::IFont::font_style ( void ) const
pure virtual

◆ glyph()

virtual const Glyph & nom::IFont::glyph ( uint32 ,
uint32  ) const
pure virtual

◆ hinting()

virtual int nom::IFont::hinting ( void ) const
pure virtual

◆ image()

virtual const Image * nom::IFont::image ( uint32 ) const
pure virtual

Implemented in nom::BMFont, and nom::TrueTypeFont.

◆ kerning()

virtual int nom::IFont::kerning ( uint32 ,
uint32 ,
uint32  ) const
pure virtual

◆ load()

virtual bool nom::IFont::load ( const std::string & filename)
pure virtual
Todo
Rename to load_file.

Implemented in nom::BitmapFont, nom::BMFont, and nom::TrueTypeFont.

◆ metrics()

virtual const FontMetrics & nom::IFont::metrics ( void ) const
pure virtual

Implemented in nom::BitmapFont, and nom::TrueTypeFont.

◆ newline()

virtual int nom::IFont::newline ( uint32 ) const
pure virtual

◆ set_font_kerning()

virtual void nom::IFont::set_font_kerning ( bool state)
pure virtual

◆ set_font_style()

virtual void nom::IFont::set_font_style ( uint32 style)
pure virtual

◆ set_hinting()

virtual bool nom::IFont::set_hinting ( int )
pure virtual
Todo
Rename to set_font_hinting..?

Implemented in nom::BitmapFont, nom::BMFont, and nom::TrueTypeFont.

◆ set_outline()

virtual bool nom::IFont::set_outline ( int )
pure virtual
Todo
Rename to set_font_outline..?

Implemented in nom::BitmapFont, nom::BMFont, and nom::TrueTypeFont.

◆ set_point_size()

virtual bool nom::IFont::set_point_size ( int )
pure virtual

Implemented in nom::BMFont, and nom::TrueTypeFont.

◆ spacing()

virtual sint nom::IFont::spacing ( uint32 ) const
pure virtual

◆ valid()

virtual bool nom::IFont::valid ( void ) const
pure virtual

Implemented in nom::BitmapFont, and nom::TrueTypeFont.


The documentation for this class was generated from the following file: