Kanzi  3.9.7
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

kanzi::FontRuntime::~FontRuntime ( )

Destructor.

Member Function Documentation

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.
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.
float kanzi::FontRuntime::getLineHeight ( ) const

Returns the line height of a runtime font.

Returns
Line height of the font.
float kanzi::FontRuntime::getAscender ( ) const

Returns the ascender of a font.

Returns
Ascender of the font.
float kanzi::FontRuntime::getDescender ( ) const

Returns the descender of a font.

Returns
Descender of the font.
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.
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.
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.
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.
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.
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.

FontFamilySharedPtr kanzi::FontRuntime::getFontFamily ( ) const

Gets the font family the runtime font object uses.

Returns
The font family the runtime font object uses.
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

friend class FontManager
friend

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