Blamite Game Engine - blam!  00296.01.12.21.0102.blamite
The core library for the Blamite Game Engine.
fonts.cpp File Reference
#include "fonts.h"
#include <fstream>
#include <Strings/components/3rdparty/rapidxml/rapidxml.hpp>
#include <Strings/components/utils/converters/converters.h>
#include <Strings/components/utils/string/string.h>
#include <Strings/components/utils/io/io.h>
#include "components/rendering/rendering.h"
#include "components/rendering/directx11/direct2d/drawing.h"
#include "components/rendering/directx11/dw_font_loader/FontLoader.h"
#include "components/diagnostics/logger/logger.h"
#include "components/diagnostics/errors/errors.h"
#include "components/resources/cache/cache.h"
#include "components/settings/config/config.h"
#include "res/mc/errors.h"

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