Elaztek Developer Hub
Blamite Game Engine - blam!  00423.10.27.24.0533.blamite
The core library for the Blamite Game Engine.
BlamFontPackage Class Reference

Class representing a Blamite font package. More...

#include <fonts.h>

Public Member Functions

 BlamFontPackage ()
 Constructor. More...
 
 ~BlamFontPackage ()
 Destructor. More...
 
BlamFontGlyphGetGlyph (char character)
 Retrieves font glyph information from a character. More...
 
Ogre::HlmsDatablock * CreateCopiedDatablock ()
 Creates a copy of this glyph's datablock, intended to allow for it to be recolored on a per-instance basis. More...
 

Public Attributes

std::string name = ""
 The name/ID of the font. Must be unique. More...
 
std::string file_path = ""
 The file path of the font information or package file. More...
 
BlamFontPackageType type = BlamFontPackageType::Unknown
 The format of the font pacakge. See BlamFontPackageType for details. More...
 
BlamMap< char, BlamFontGlyph * > glyphs = BlamMap<char, BlamFontGlyph*>()
 Map containing all glyphs within the font package. More...
 
bool monospace = false
 Whether or not the font is monospaced. More...
 
int monospace_width = 0
 The monospaced width of each character. Only used when monospace is set to true. More...
 
int charspacing = 0
 The amount of spacing between each character, in pixels. More...
 
int line_height = 0
 The height of each line of text, in pixels. More...
 
int space_width = 0
 The width of the space character, in pixels. Only used when monospace is false. More...
 
bool use_point_filtering = false
 Whether or not glyphs in this font package should use point filtering or not. More...
 
uint32_t glyphs_per_row = 0
 The number of glyphs per row within the texture atlas. Only used in fonts that use a texture atlas. More...
 
uint32_t glyphs_per_column = 0
 The number of glyphs per column within the texture atlas. Only used in fonts that use a texture atlas. More...
 
Ogre::TextureGpu * font_atlas = nullptr
 The font atlas texture. Only used in fonts that use a texture atlas. More...
 
Ogre::HlmsDatablock * font_datablock = nullptr
 The font atlas datablock. Only used in fonts that use a texture atlas. More...
 
Ogre::FontPtr ttf_font
 Unused. More...
 

Detailed Description

Class representing a Blamite font package.

Font packages are used to store font data in either an unpacked (XML) format, or in a single package (.bin) file. They are used throughout the engine to display text.

Constructor & Destructor Documentation

◆ BlamFontPackage()

BlamFontPackage::BlamFontPackage ( )

Constructor.

Does not perform any tasks.

To load a font, use one of the appropriate functions within Blam::Content::Fonts.

◆ ~BlamFontPackage()

BlamFontPackage::~BlamFontPackage ( )

Destructor.

Ensures that all glyph data is properly released.

Member Function Documentation

◆ CreateCopiedDatablock()

Ogre::HlmsDatablock * BlamFontPackage::CreateCopiedDatablock ( )

Creates a copy of this glyph's datablock, intended to allow for it to be recolored on a per-instance basis.

This method is only supported if this glyph's font package stores glyphs in a single texture atlas. For fonts which store glyphs in their own separate bitmaps, use the CreateCopiedDatablock method within BlamFontGlyph instead.

Note
The copied datablock is not tracked internally, it is the responsibility of the caller to ensure the datablock is properly released.
Returns
The newly created datablock.

◆ GetGlyph()

BlamFontGlyph * BlamFontPackage::GetGlyph ( char  character)

Retrieves font glyph information from a character.

Parameters
character- The character to look up.
Returns
Pointer to the matching font glyph information. If the font package does not support the specified character, then nullptr is returned.

Member Data Documentation

◆ charspacing

int BlamFontPackage::charspacing = 0

The amount of spacing between each character, in pixels.

◆ file_path

std::string BlamFontPackage::file_path = ""

The file path of the font information or package file.

◆ font_atlas

Ogre::TextureGpu* BlamFontPackage::font_atlas = nullptr

The font atlas texture. Only used in fonts that use a texture atlas.

◆ font_datablock

Ogre::HlmsDatablock* BlamFontPackage::font_datablock = nullptr

The font atlas datablock. Only used in fonts that use a texture atlas.

◆ glyphs

BlamMap<char, BlamFontGlyph*> BlamFontPackage::glyphs = BlamMap<char, BlamFontGlyph*>()

Map containing all glyphs within the font package.

◆ glyphs_per_column

uint32_t BlamFontPackage::glyphs_per_column = 0

The number of glyphs per column within the texture atlas. Only used in fonts that use a texture atlas.

◆ glyphs_per_row

uint32_t BlamFontPackage::glyphs_per_row = 0

The number of glyphs per row within the texture atlas. Only used in fonts that use a texture atlas.

◆ line_height

int BlamFontPackage::line_height = 0

The height of each line of text, in pixels.

◆ monospace

bool BlamFontPackage::monospace = false

Whether or not the font is monospaced.

◆ monospace_width

int BlamFontPackage::monospace_width = 0

The monospaced width of each character. Only used when monospace is set to true.

◆ name

std::string BlamFontPackage::name = ""

The name/ID of the font. Must be unique.

◆ space_width

int BlamFontPackage::space_width = 0

The width of the space character, in pixels. Only used when monospace is false.

◆ ttf_font

Ogre::FontPtr BlamFontPackage::ttf_font

Unused.

◆ type

The format of the font pacakge. See BlamFontPackageType for details.

◆ use_point_filtering

bool BlamFontPackage::use_point_filtering = false

Whether or not glyphs in this font package should use point filtering or not.


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