nomlib
Loading...
Searching...
No Matches
nom::BitmapFont Class Reference
Inheritance diagram for nom::BitmapFont:
[legend]

Public Types

typedef BitmapFont 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

 BitmapFont (void)
 Default constructor.
 ~BitmapFont (void)
 Destructor.
 BitmapFont (const BitmapFont &copy)
 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
const Imageimage (uint32 character_size) const override
sint spacing (uint32 character_size) const override
 Obtain text character spacing width in pixels.
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.
uint32 font_style (void) const override
 Get the rendering style of the font.
const Glyphglyph (uint32 codepoint, uint32 character_size) const override
 Obtain a glyph.
bool set_point_size (sint size) override
 Set a new font point size.
bool set_hinting (int type) override
 Set the requested font hinting style.
bool set_outline (int) override
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
 Loads a new bitmap font from a file.
const FontMetricsmetrics (void) const override
 Obtain information about the loaded font.
Public Member Functions inherited from nom::IFont
virtual bool set_point_size (int)=0

Private Member Functions

bool build (uint32 character_size)
const GlyphPage & pages (void) const
sint sheet_width (void) const
sint sheet_height (void) const

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.
GlyphPage pages_
FontMetrics metrics_
 General font metric data, such as the proper value for newline spacing.
Color4i color_mask_
 The pixel color found at the texture atlas position 0, 0 is used as a color mask – to filter out non-glyph data.

Detailed Description

Definition at line 55 of file BitmapFont.hpp.

Member Typedef Documentation

◆ RawPtr

typedef self_type* nom::BitmapFont::RawPtr

Definition at line 59 of file BitmapFont.hpp.

◆ self_type

typedef BitmapFont nom::BitmapFont::self_type

Definition at line 58 of file BitmapFont.hpp.

◆ SharedPtr

typedef std::shared_ptr<self_type> nom::BitmapFont::SharedPtr

Definition at line 60 of file BitmapFont.hpp.

Member Function Documentation

◆ build()

bool nom::BitmapFont::build ( uint32 character_size)
private

Trigger a build of the font characteristics gleaned from the image file; recalculate the character sizes, coordinate origins, spacing, etc.

Parameters
character_sizeReserved for future implementation.

◆ clone()

IFont::raw_ptr nom::BitmapFont::clone ( void ) const
overridevirtual

Construct a clone of the existing instance.

Implements nom::IFont.

◆ font_style()

uint32 nom::BitmapFont::font_style ( void ) const
overridevirtual

Get the rendering style of the font.

Remarks
This method is not implemented.

Implements nom::IFont.

◆ glyph()

const Glyph & nom::BitmapFont::glyph ( uint32 codepoint,
uint32 character_size ) const
overridevirtual

Obtain a glyph.

Parameters
codepointASCII character to lookup
character_sizeReserved for future implementation
Returns
nom::Glyph structure

Implements nom::IFont.

◆ hinting()

int nom::BitmapFont::hinting ( void ) const
overridevirtual

Get the font's hinting style.

Remarks
This method is not implemented.
Returns
Zero.

Implements nom::IFont.

◆ image()

const Image * nom::BitmapFont::image ( uint32 character_size) const
overridevirtual

Implements nom::IFont.

◆ kerning()

int nom::BitmapFont::kerning ( uint32 first_char,
uint32 second_char,
uint32 character_size ) const
overridevirtual

Obtain the kerning pair offsets between two glyphs.

Returns
Zero (0) is always returned.
Remarks
This method is not implemented.

Implements nom::IFont.

◆ load()

bool nom::BitmapFont::load ( const std::string & filename)
overridevirtual

Loads a new bitmap font from a file.

Implements nom::IFont.

◆ metrics()

const FontMetrics & nom::BitmapFont::metrics ( void ) const
overridevirtual

Obtain information about the loaded font.

Remarks
Implements IFont::metrics.

Implements nom::IFont.

◆ newline()

int nom::BitmapFont::newline ( uint32 character_size) const
overridevirtual

Obtain font's line spacing.

Parameters
character_sizePoint size in pixels
Returns
Height offset in pixels

Implements nom::IFont.

◆ set_font_kerning()

void nom::BitmapFont::set_font_kerning ( bool state)
overridevirtual

Set the use of kerning for the font.

Remarks
This method is not implemented.

Implements nom::IFont.

◆ set_font_style()

void nom::BitmapFont::set_font_style ( uint32 style)
overridevirtual

Set the rendering style of the font.

Remarks
This method is not implemented.

Implements nom::IFont.

◆ set_hinting()

bool nom::BitmapFont::set_hinting ( int type)
overridevirtual

Set the requested font hinting style.

Remarks
This method is not implemented.

Implements nom::IFont.

◆ set_outline()

bool nom::BitmapFont::set_outline ( int )
overridevirtual
Remarks
This method is not implemented.

Implements nom::IFont.

◆ set_point_size()

bool nom::BitmapFont::set_point_size ( sint size)
override

Set a new font point size.

Parameters
sizePoint size in pixels
Remarks
Not implemented

◆ spacing()

sint nom::BitmapFont::spacing ( uint32 character_size) const
overridevirtual

Obtain text character spacing width in pixels.

Returns
The width applied when the space carriage is encountered when rendered.

Implements nom::IFont.

◆ type()

enum IFont::FontType nom::BitmapFont::type ( void ) const
overridevirtual

Implements nom::IFont.

◆ valid()

bool nom::BitmapFont::valid ( void ) const
overridevirtual

Validity check.

Implements nom::IFont.

Member Data Documentation

◆ color_mask_

Color4i nom::BitmapFont::color_mask_
private

The pixel color found at the texture atlas position 0, 0 is used as a color mask – to filter out non-glyph data.

See also
nom::BitmapFont::build

Definition at line 186 of file BitmapFont.hpp.

◆ metrics_

FontMetrics nom::BitmapFont::metrics_
private

General font metric data, such as the proper value for newline spacing.

Definition at line 180 of file BitmapFont.hpp.

◆ pages_

GlyphPage nom::BitmapFont::pages_
mutableprivate

Table mapping a character size to its page – a texture atlas combined with corresponding glyphs data.

Definition at line 177 of file BitmapFont.hpp.

◆ sheet_height_

sint nom::BitmapFont::sheet_height_
private

Height – in pixels – of overall texture atlas sheet.

Definition at line 173 of file BitmapFont.hpp.

◆ sheet_width_

sint nom::BitmapFont::sheet_width_
private

Width – in pixels – of overall texture atlas sheet.

Definition at line 170 of file BitmapFont.hpp.

◆ type_

enum IFont::FontType nom::BitmapFont::type_
private

The type of font we are.

Definition at line 167 of file BitmapFont.hpp.


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