Kanzi 3.9.10
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.
 
virtual FontFileSharedPtr createFontFromFile (string_view filePath)
 Creates a font from a file.
 
virtual FontFileSharedPtr createFontFromMemory (const byte *data, size_t size, string_view name, bool createMemoryCopy)
 Creates a FontFile object from the memory.
 
 FontLoader (Domain *domain)
 Constructor.
 
virtual ~FontLoader ()
 Destructor.
 

Protected Member Functions

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

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::BitmapFontLoader, kanzi::FreeTypeFontLoader, and kanzi::ItypeFontLoader.

◆ 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::BitmapFontLoader, kanzi::FreeTypeFontLoader, and kanzi::ItypeFontLoader.

◆ 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::BitmapFontLoader, kanzi::FreeTypeFontLoader, 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: