Kanzi  3.9.4
Kanzi Engine API
kanzi::FontLoader Class Reference

Use FontLoader to create FontFile objects from memory or a file. More...

#include <kanzi/core.ui/font/font_loader.hpp>

Inheritance diagram for kanzi::FontLoader:
[legend]

Public Member Functions

virtual FontFileSharedPtr createFont (string_view name)
 Creates an empty font file object. More...
 
virtual FontFileSharedPtr createFontFromFile (string_view filePath)
 Creates a font from a file. More...
 
virtual FontFileSharedPtr createFontFromMemory (const byte *data, size_t size, string_view name, bool createMemoryCopy)
 Creates a FontFile object from the memory. More...
 
 FontLoader (Domain *domain)
 Constructor. More...
 
virtual ~FontLoader ()
 Destructor. More...
 

Protected Member Functions

DomaingetDomain ()
 Returns the domain used to construct the FontLoader. More...
 

Detailed Description

Use FontLoader to create FontFile objects from memory or a file.

You can create pure FontFile objects using the base class. However, in most cases, use the derived classes specific to a rasterizer.

Constructor & Destructor Documentation

◆ FontLoader()

kanzi::FontLoader::FontLoader ( Domain domain)
explicit

Constructor.

Parameters
domainPointer to domain object.

◆ ~FontLoader()

virtual kanzi::FontLoader::~FontLoader ( )
virtual

Destructor.

Member Function Documentation

◆ createFont()

virtual FontFileSharedPtr kanzi::FontLoader::createFont ( string_view  name)
virtual

Creates an empty font file object.

Load the font data using the FontFile::loadFromKZB() function.

Parameters
nameName of the created font file object.
Returns
Shared pointer to the created font file object.

Reimplemented in kanzi::FreeTypeFontLoader, kanzi::ItypeFontLoader, and kanzi::BitmapFontLoader.

◆ createFontFromFile()

virtual FontFileSharedPtr kanzi::FontLoader::createFontFromFile ( string_view  filePath)
virtual

Creates a font from a file.

Parameters
filePathFull path to the font file, including the file name. Kanzi uses the file name to set the font name.
Returns
Shared pointer to the created font file object.
Exceptions
KZS_EXCEPTION_FILE_OPEN_FAILEDif font file cannot be read.

Reimplemented in kanzi::FreeTypeFontLoader, kanzi::ItypeFontLoader, and kanzi::BitmapFontLoader.

◆ createFontFromMemory()

virtual FontFileSharedPtr kanzi::FontLoader::createFontFromMemory ( const byte data,
size_t  size,
string_view  name,
bool  createMemoryCopy 
)
virtual

Creates a FontFile object from the memory.

Parameters
dataPointer to the font data in the memory.
sizeSize of the font data in the memory.
nameName of the created FontFile object.
createMemoryCopyTrue if you want to create for the object a new copy of the given font data.
Returns
Shared pointer to the created font file object.

Reimplemented in kanzi::FreeTypeFontLoader, kanzi::BitmapFontLoader, and kanzi::ItypeFontLoader.

◆ getDomain()

Domain* kanzi::FontLoader::getDomain ( )
protected

Returns the domain used to construct the FontLoader.

Returns
Pointer to the domain.

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