Skylicht Engine
Loading...
Searching...
No Matches
Skylicht::CGlyphFont Class Reference

This object class loads fonts from .ttf and .otf files, converting them into sprite images. More...

#include <Graphics2D/SpriteFrame/CGlyphFont.h>

Inheritance diagram for Skylicht::CGlyphFont:
Skylicht::CSpriteFrame Skylicht::IFont

Public Member Functions

 CGlyphFont (const char *fontName, float sizePt)
void setFont (const char *fontName, float sizePt)
const char * getFontName ()
virtual SModuleOffsetgetCharacterModule (wchar_t character)
virtual void getListModule (const wchar_t *string, std::vector< int > &format, std::vector< SModuleOffset * > &output, std::vector< int > &outputFormat)
virtual void updateFontTexture ()
std::vector< SImage * > & getImages ()
Public Member Functions inherited from Skylicht::CSpriteFrame
bool load (const char *fileName)
std::vector< SFrame * > & getFrames ()
SFramegetFrameByName (const char *name)
SFramegetFrameById (const char *id)
const char * getId ()
const char * getPath ()
Public Member Functions inherited from Skylicht::IFont
virtual bool dropFont ()
virtual void grabFont ()

Protected Member Functions

SImagegetImage (CAtlas *atlas)

Protected Attributes

float m_fontSizePt
std::map< u32, SModuleOffset * > m_moduleOffset
std::string m_fontName
Protected Attributes inherited from Skylicht::CSpriteFrame
std::vector< SImage * > m_images
std::vector< SFrame * > m_frames
std::vector< SModuleRect * > m_modules
std::map< std::string, SFrame * > m_names
std::map< std::string, SFrame * > m_ids
bool m_deleteAtlas
std::string m_id
std::string m_path

Detailed Description

This object class loads fonts from .ttf and .otf files, converting them into sprite images.

To load the font file, you'll require assistance from the CGlyphFreetype object class. Then, use the CGraphics2D object to draw text with the font.

CGlyphFreetype* freetypeFont = CGlyphFreetype::getInstance();
freetypeFont->initFont("Segoe UI Light", "BuiltIn/Fonts/segoeui/segoeuil.ttf");
CGlyphFont* font = new CGlyphFont();
font->setFont("Segoe UI Light", 25);
Definition CGlyphFreetype.h:83

Member Function Documentation

◆ getCharacterModule()

virtual SModuleOffset * Skylicht::CGlyphFont::getCharacterModule ( wchar_t character)
virtual

Implements Skylicht::IFont.

◆ getListModule()

virtual void Skylicht::CGlyphFont::getListModule ( const wchar_t * string,
std::vector< int > & format,
std::vector< SModuleOffset * > & output,
std::vector< int > & outputFormat )
virtual

Reimplemented from Skylicht::IFont.

◆ updateFontTexture()

virtual void Skylicht::CGlyphFont::updateFontTexture ( )
virtual

Reimplemented from Skylicht::IFont.


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