Kanzi  3.9.4
Kanzi Engine API
kanzi::FontRuntime Class Reference

Runtime font. More...

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

Public Member Functions

float getAdvance (unsigned int glyphIndex) const
 Returns the advance metric of the given glyph. More...
 
float getAscender () const
 Returns the ascender of a font. More...
 
RectangleFloat getBoundingBox (unsigned int glyphIndex) const
 Returns the bounding box of the given glyph. More...
 
float getDescender () const
 Returns the descender of a font. More...
 
FontFamilySharedPtr getFontFamily () const
 Gets the font family the runtime font object uses. More...
 
FontFilegetFontFile () const
 Returns the font file that this runtime font is using. More...
 
const FontStyleDefinitiongetFontStyleDefinition () const
 Returns the font style definition of the runtime font. More...
 
GlyphCachegetGlyphCache () const
 Gets the glyph cache that the runtime font object uses. More...
 
FontFile::GlyphDataSharedPtr getGlyphData (unsigned int glyphIndex) const
 Returns the bitmap data for the given glyph. More...
 
unsigned int getGlyphIndex (char32_t character) const
 Returns the glyph index in a font for the given unicode code point. More...
 
float getKerning (unsigned int previousGlyphIndex, unsigned int glyphIndex) const
 Returns the kerning between the given pair of glyphs. More...
 
float getLineHeight () const
 Returns the line height of a runtime font. More...
 
void setupFontFile () const
 Sets the size of the underlying font file object. More...
 
 ~FontRuntime ()
 Destructor. More...
 

Friends

class FontManager
 

Detailed Description

Runtime font.

Use FontRuntime to draw text using TextFormat. To acquire the runtime font, use FontManager::getRuntimeFont.

Since
Kanzi 3.8.0

Constructor & Destructor Documentation

◆ ~FontRuntime()

kanzi::FontRuntime::~FontRuntime ( )

Destructor.

Member Function Documentation

◆ getFontFile()

FontFile& kanzi::FontRuntime::getFontFile ( ) const

Returns the font file that this runtime font is using.

Returns
The font file that this runtime font is using.

◆ getFontStyleDefinition()

const FontStyleDefinition& kanzi::FontRuntime::getFontStyleDefinition ( ) const

Returns the font style definition of the runtime font.

Returns
Reference to the font style definition that the runtime font holds.

◆ getLineHeight()

float kanzi::FontRuntime::getLineHeight ( ) const

Returns the line height of a runtime font.

Returns
Line height of the font.

◆ getAscender()

float kanzi::FontRuntime::getAscender ( ) const

Returns the ascender of a font.

Returns
Ascender of the font.

◆ getDescender()

float kanzi::FontRuntime::getDescender ( ) const

Returns the descender of a font.

Returns
Descender of the font.

◆ getGlyphIndex()

unsigned int kanzi::FontRuntime::getGlyphIndex ( char32_t  character) const

Returns the glyph index in a font for the given unicode code point.

Parameters
characterThe unicode code point to use.
Returns
Glyph index for the given code point.

◆ getAdvance()

float kanzi::FontRuntime::getAdvance ( unsigned int  glyphIndex) const

Returns the advance metric of the given glyph.

Parameters
glyphIndexIndex of the font glyph data acquired from getGlyphIndex().
Returns
Advance for the given glyph.

◆ getBoundingBox()

RectangleFloat kanzi::FontRuntime::getBoundingBox ( unsigned int  glyphIndex) const

Returns the bounding box of the given glyph.

Parameters
glyphIndexIndex of the font glyph data acquired from getGlyphIndex().
Returns
Bounding box of the given glyph.

◆ getKerning()

float kanzi::FontRuntime::getKerning ( unsigned int  previousGlyphIndex,
unsigned int  glyphIndex 
) const

Returns the kerning between the given pair of glyphs.

Parameters
previousGlyphIndexIndex of the font glyph data of the preceding glyph.
glyphIndexIndex of the font glyph data acquired from getGlyphIndex().
Returns
Kerning between the given glyph pair.

◆ getGlyphData()

FontFile::GlyphDataSharedPtr kanzi::FontRuntime::getGlyphData ( unsigned int  glyphIndex) const

Returns the bitmap data for the given glyph.

Parameters
glyphIndexIndex of the font glyph data acquired from getGlyphIndex().
Returns
Bitmap data for the given glyph.

◆ setupFontFile()

void kanzi::FontRuntime::setupFontFile ( ) const

Sets the size of the underlying font file object.

Several font and font family objects can share the same font file object. Call this function before all other operations.

◆ getFontFamily()

FontFamilySharedPtr kanzi::FontRuntime::getFontFamily ( ) const

Gets the font family the runtime font object uses.

Returns
The font family the runtime font object uses.

◆ getGlyphCache()

GlyphCache& kanzi::FontRuntime::getGlyphCache ( ) const

Gets the glyph cache that the runtime font object uses.

Returns
The glyph cache that the runtime font object uses.

Friends And Related Function Documentation

◆ FontManager

friend class FontManager
friend

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