DDraceNetwork Docs
CGlyphMap Class Reference
Collaboration diagram for CGlyphMap:
[legend]

Public Types

enum  { FONT_TEXTURE_FILL = 0 , FONT_TEXTURE_OUTLINE , NUM_FONT_TEXTURES }
 

Public Member Functions

 CGlyphMap (IGraphics *pGraphics)
 
 ~CGlyphMap ()
 
FT_Face DefaultFace () const
 
FT_Face IconFace () const
 
void AddFace (FT_Face Face)
 
bool SetDefaultFaceByName (const char *pFamilyName)
 
bool SetIconFaceByName (const char *pFamilyName)
 
bool AddFallbackFaceByName (const char *pFamilyName)
 
bool SetVariantFaceByName (const char *pFamilyName)
 
void SetFontPreset (EFontPreset FontPreset)
 
void Clear ()
 
const SGlyphGetGlyph (int Chr, int FontSize)
 
vec2 Kerning (const SGlyph *pLeft, const SGlyph *pRight) const
 
void UploadEntityLayerText (const CImageInfo &TextImage, int TexSubWidth, int TexSubHeight, const char *pText, int Length, float x, float y, int FontSize)
 
size_t TextureDimension () const
 
IGraphics::CTextureHandle Texture (size_t TextureIndex) const
 

Private Member Functions

IGraphicsGraphics ()
 
FT_Face GetFaceByName (const char *pFamilyName)
 
bool IncreaseGlyphMapSize ()
 
void UploadTextures ()
 
void UnloadTextures ()
 
FT_UInt GetCharGlyph (int Chr, FT_Face *pFace, bool AllowReplacementCharacter)
 
void Grow (const unsigned char *pIn, unsigned char *pOut, int w, int h, int OutlineCount) const
 
int AdjustOutlineThicknessToFontSize (int OutlineThickness, int FontSize) const
 
void UploadGlyph (int TextureIndex, int PosX, int PosY, size_t Width, size_t Height, uint8_t *pData)
 
bool FitGlyph (size_t Width, size_t Height, int &PosX, int &PosY)
 
bool RenderGlyph (SGlyph &Glyph)
 

Private Attributes

IGraphicsm_pGraphics
 
IGraphics::CTextureHandle m_aTextures [NUM_FONT_TEXTURES]
 
size_t m_TextureDimension = INITIAL_ATLAS_DIMENSION
 
uint8_t * m_apTextureData [NUM_FONT_TEXTURES]
 
CAtlas m_TextureAtlas
 
std::unordered_map< std::tuple< FT_Face, int, int >, SGlyph, SGlyphKeyHash, SGlyphKeyEqualsm_Glyphs
 
FT_Face m_DefaultFace = nullptr
 
FT_Face m_IconFace = nullptr
 
FT_Face m_VariantFace = nullptr
 
FT_Face m_SelectedFace = nullptr
 
std::vector< FT_Face > m_vFallbackFaces
 
std::vector< FT_Face > m_vFtFaces
 

Static Private Attributes

static constexpr int INITIAL_ATLAS_DIMENSION = 1024
 
static constexpr int MAXIMUM_ATLAS_DIMENSION = 16 * 1024
 
static constexpr int MIN_FONT_SIZE = 6
 
static constexpr int MAX_FONT_SIZE = 128
 
static constexpr int REPLACEMENT_CHARACTER = 0x25a1
 

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
FONT_TEXTURE_FILL 
FONT_TEXTURE_OUTLINE 
NUM_FONT_TEXTURES 

Constructor & Destructor Documentation

◆ CGlyphMap()

CGlyphMap::CGlyphMap ( IGraphics pGraphics)
inline

◆ ~CGlyphMap()

CGlyphMap::~CGlyphMap ( )
inline

Member Function Documentation

◆ AddFace()

void CGlyphMap::AddFace ( FT_Face  Face)
inline

◆ AddFallbackFaceByName()

bool CGlyphMap::AddFallbackFaceByName ( const char *  pFamilyName)
inline

◆ AdjustOutlineThicknessToFontSize()

int CGlyphMap::AdjustOutlineThicknessToFontSize ( int  OutlineThickness,
int  FontSize 
) const
inlineprivate

◆ Clear()

void CGlyphMap::Clear ( )
inline

◆ DefaultFace()

FT_Face CGlyphMap::DefaultFace ( ) const
inline

◆ FitGlyph()

bool CGlyphMap::FitGlyph ( size_t  Width,
size_t  Height,
int &  PosX,
int &  PosY 
)
inlineprivate

◆ GetCharGlyph()

FT_UInt CGlyphMap::GetCharGlyph ( int  Chr,
FT_Face *  pFace,
bool  AllowReplacementCharacter 
)
inlineprivate

◆ GetFaceByName()

FT_Face CGlyphMap::GetFaceByName ( const char *  pFamilyName)
inlineprivate

◆ GetGlyph()

const SGlyph * CGlyphMap::GetGlyph ( int  Chr,
int  FontSize 
)
inline

◆ Graphics()

IGraphics * CGlyphMap::Graphics ( )
inlineprivate

◆ Grow()

void CGlyphMap::Grow ( const unsigned char *  pIn,
unsigned char *  pOut,
int  w,
int  h,
int  OutlineCount 
) const
inlineprivate

◆ IconFace()

FT_Face CGlyphMap::IconFace ( ) const
inline

◆ IncreaseGlyphMapSize()

bool CGlyphMap::IncreaseGlyphMapSize ( )
inlineprivate

◆ Kerning()

vec2 CGlyphMap::Kerning ( const SGlyph pLeft,
const SGlyph pRight 
) const
inline

◆ RenderGlyph()

bool CGlyphMap::RenderGlyph ( SGlyph Glyph)
inlineprivate

◆ SetDefaultFaceByName()

bool CGlyphMap::SetDefaultFaceByName ( const char *  pFamilyName)
inline

◆ SetFontPreset()

void CGlyphMap::SetFontPreset ( EFontPreset  FontPreset)
inline

◆ SetIconFaceByName()

bool CGlyphMap::SetIconFaceByName ( const char *  pFamilyName)
inline

◆ SetVariantFaceByName()

bool CGlyphMap::SetVariantFaceByName ( const char *  pFamilyName)
inline

◆ Texture()

IGraphics::CTextureHandle CGlyphMap::Texture ( size_t  TextureIndex) const
inline

◆ TextureDimension()

size_t CGlyphMap::TextureDimension ( ) const
inline

◆ UnloadTextures()

void CGlyphMap::UnloadTextures ( )
inlineprivate

◆ UploadEntityLayerText()

void CGlyphMap::UploadEntityLayerText ( const CImageInfo TextImage,
int  TexSubWidth,
int  TexSubHeight,
const char *  pText,
int  Length,
float  x,
float  y,
int  FontSize 
)
inline

◆ UploadGlyph()

void CGlyphMap::UploadGlyph ( int  TextureIndex,
int  PosX,
int  PosY,
size_t  Width,
size_t  Height,
uint8_t *  pData 
)
inlineprivate

◆ UploadTextures()

void CGlyphMap::UploadTextures ( )
inlineprivate

Member Data Documentation

◆ INITIAL_ATLAS_DIMENSION

constexpr int CGlyphMap::INITIAL_ATLAS_DIMENSION = 1024
staticconstexprprivate

The initial dimension of the atlas textures. Results in 1 MB of memory being used per texture.

◆ m_apTextureData

uint8_t* CGlyphMap::m_apTextureData[NUM_FONT_TEXTURES]
private

◆ m_aTextures

IGraphics::CTextureHandle CGlyphMap::m_aTextures[NUM_FONT_TEXTURES]
private

◆ m_DefaultFace

FT_Face CGlyphMap::m_DefaultFace = nullptr
private

◆ m_Glyphs

std::unordered_map<std::tuple<FT_Face, int, int>, SGlyph, SGlyphKeyHash, SGlyphKeyEquals> CGlyphMap::m_Glyphs
private

◆ m_IconFace

FT_Face CGlyphMap::m_IconFace = nullptr
private

◆ m_pGraphics

IGraphics* CGlyphMap::m_pGraphics
private

◆ m_SelectedFace

FT_Face CGlyphMap::m_SelectedFace = nullptr
private

◆ m_TextureAtlas

CAtlas CGlyphMap::m_TextureAtlas
private

◆ m_TextureDimension

size_t CGlyphMap::m_TextureDimension = INITIAL_ATLAS_DIMENSION
private

◆ m_VariantFace

FT_Face CGlyphMap::m_VariantFace = nullptr
private

◆ m_vFallbackFaces

std::vector<FT_Face> CGlyphMap::m_vFallbackFaces
private

◆ m_vFtFaces

std::vector<FT_Face> CGlyphMap::m_vFtFaces
private

◆ MAX_FONT_SIZE

constexpr int CGlyphMap::MAX_FONT_SIZE = 128
staticconstexprprivate

The maximum supported font size.

◆ MAXIMUM_ATLAS_DIMENSION

constexpr int CGlyphMap::MAXIMUM_ATLAS_DIMENSION = 16 * 1024
staticconstexprprivate

The maximum dimension of the atlas textures. Results in 256 MB of memory being used per texture.

◆ MIN_FONT_SIZE

constexpr int CGlyphMap::MIN_FONT_SIZE = 6
staticconstexprprivate

The minimum supported font size.

◆ REPLACEMENT_CHARACTER

constexpr int CGlyphMap::REPLACEMENT_CHARACTER = 0x25a1
staticconstexprprivate

White square to indicate missing glyph.


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