Blamite Game Engine - Blam (Core)
fonts.cpp File Reference

Functions

HRESULT LoadGlyph (char character, int width, int height, std::string bitmap_path, std::string format, Font *font)
 Creates a FontGlyph from the provided data. More...
 
bool resolve_glyph_character (std::string xml_glyph, char *character)
 Identify the character of the font glyph from the XML attribute. More...
 
FontGlyphFormat GetGlyphFormatFromString (std::string format)
 Evaluates a string into the appropriate FontGlyphFormat. More...
 
void CleanupFontData (std::string id)
 Cleans up all data for the specified font. More...
 

Variables

std::map< std::string, Fontfont_list
 

Function Documentation

◆ CleanupFontData()

void CleanupFontData ( std::string  id)

Cleans up all data for the specified font.

This is called automatically from Blam::Content::Fonts::Cleanup, and does not need to be called elsewhere.

Parameters
id- The ID of the font to reload.

◆ GetGlyphFormatFromString()

FontGlyphFormat GetGlyphFormatFromString ( std::string  format)

Evaluates a string into the appropriate FontGlyphFormat.

Parameters
format- The glyph format
Returns
The matching FontGlyphFormat, or PNG as a default.

◆ LoadGlyph()

HRESULT LoadGlyph ( char  character,
int  width,
int  height,
std::string  bitmap_path,
std::string  format,
Font font 
)

Creates a FontGlyph from the provided data.

Parameters
character- The character of the glyph
width- The width of the glyph image
height- The height of the glyph image
bitmap_path- The path to the glyph image file
format- The format of the glyph image file
font- Pointer to the font to add the glyph to
Returns
S_OK if the glyph was loaded without error, otherwise will return an error code. The following code is returned if the file was not found:

◆ resolve_glyph_character()

bool resolve_glyph_character ( std::string  xml_glyph,
char *  character 
)

Identify the character of the font glyph from the XML attribute.

Parameters
xml_glyph- The original string containing the glyph value from fontinfo.xml
character- Pointer to a character to set to the resolved character
Returns
true if the character was resolved, false if the character could not be resolved

Variable Documentation

◆ font_list

std::map<std::string, Font> font_list