Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
Loading...
Searching...
No Matches
CGUIFontTTF Class Referenceabstract

#include <GUIFontTTF.h>

Inheritance diagram for CGUIFontTTF:
CGUIFontTTFDX CGUIFontTTFGL CGUIFontTTFGLES

Classes

struct  Character
 
struct  CTranslatedVertices
 
struct  Glyph
 
struct  RunInfo
 

Public Member Functions

virtual ~CGUIFontTTF ()
 
void Clear ()
 
bool Load (const std::string &strFilename, float height=20.0f, float aspect=1.0f, float lineSpacing=1.0f, bool border=false)
 
void Begin ()
 
void End ()
 
virtual CVertexBuffer CreateVertexBuffer (const std::vector< SVertex > &vertices) const
 
virtual void DestroyVertexBuffer (CVertexBuffer &bufferHandle) const
 
const std::string & GetFontIdent () const
 

Static Public Member Functions

static CGUIFontTTFCreateGUIFontTTF (const std::string &fontIdent)
 

Protected Member Functions

 CGUIFontTTF (const std::string &fontIdent)
 
void AddReference ()
 
void RemoveReference ()
 
std::vector< GlyphGetHarfBuzzShapedGlyphs (const vecText &text)
 
float GetTextWidthInternal (const vecText &text)
 
float GetTextWidthInternal (const vecText &text, const std::vector< Glyph > &glyph)
 
float GetCharWidthInternal (character_t ch)
 
float GetTextHeight (float lineSpacing, int numLines) const
 
float GetTextBaseLine () const
 
float GetLineHeight (float lineSpacing) const
 
float GetFontHeight () const
 
void DrawTextInternal (CGraphicContext &context, float x, float y, const std::vector< KODI::UTILS::COLOR::Color > &colors, const vecText &text, uint32_t alignment, float maxPixelWidth, bool scrolling, float dx=0.0f, float dy=0.0f)
 
CharacterGetCharacter (character_t letter, FT_UInt glyphIndex)
 
bool CacheCharacter (FT_UInt glyphIndex, uint32_t style, Character *ch)
 
void RenderCharacter (CGraphicContext &context, float posX, float posY, const Character *ch, KODI::UTILS::COLOR::Color color, bool roundX, std::vector< SVertex > &vertices)
 
void ClearCharacterCache ()
 
virtual std::unique_ptr< CTextureReallocTexture (unsigned int &newHeight)=0
 
virtual bool CopyCharToTexture (FT_BitmapGlyph bitGlyph, unsigned int x1, unsigned int y1, unsigned int x2, unsigned int y2)=0
 
virtual void DeleteHardwareTexture ()=0
 
void SetGlyphStrength (FT_GlyphSlot slot, int glyphStrength)
 
unsigned int GetTextureLineHeight () const
 the height of each line in the texture. Accounts for spacing between lines to avoid characters overlapping.
 
unsigned int GetMaxFontHeight () const
 

Static Protected Member Functions

static void ObliqueGlyph (FT_GlyphSlot slot)
 

Protected Attributes

float m_height {0.0f}
 
std::unique_ptr< CTexturem_texture
 
unsigned int m_textureWidth {0}
 
unsigned int m_textureHeight {0}
 
int m_posX {0}
 
int m_posY {0}
 
KODI::UTILS::COLOR::Color m_color {KODI::UTILS::COLOR::NONE}
 
std::vector< Characterm_char
 
Characterm_charquick [LOOKUPTABLE_SIZE] {nullptr}
 
bool m_ellipseCached {false}
 
float m_ellipsesWidth {0.0f}
 
unsigned int m_cellBaseLine {0}
 
unsigned int m_cellHeight {0}
 
unsigned int m_maxFontHeight {0}
 
unsigned int m_nestedBeginCount {0}
 
FT_Face m_face {nullptr}
 
FT_Stroker m_stroker {nullptr}
 
hb_font_t * m_hbFont {nullptr}
 
float m_originX {0.0f}
 
float m_originY {0.0f}
 
unsigned int m_nTexture {0}
 
std::vector< CTranslatedVerticesm_vertexTrans
 
std::vector< SVertexm_vertex
 
float m_textureScaleX {0.0f}
 
float m_textureScaleY {0.0f}
 
const std::string m_fontIdent
 
std::vector< uint8_tm_fontFileInMemory
 
CGUIFontCache< CGUIFontCacheStaticPosition, CGUIFontCacheStaticValuem_staticCache
 
CGUIFontCache< CGUIFontCacheDynamicPosition, CGUIFontCacheDynamicValuem_dynamicCache
 
CRenderSystemBasem_renderSystem
 

Friends

class CGUIFont
 

Constructor & Destructor Documentation

◆ ~CGUIFontTTF()

CGUIFontTTF::~CGUIFontTTF ( void )
virtual

◆ CGUIFontTTF()

CGUIFontTTF::CGUIFontTTF ( const std::string & fontIdent)
explicitprotected

Member Function Documentation

◆ AddReference()

void CGUIFontTTF::AddReference ( )
protected

◆ Begin()

void CGUIFontTTF::Begin ( )

◆ CacheCharacter()

bool CGUIFontTTF::CacheCharacter ( FT_UInt glyphIndex,
uint32_t style,
Character * ch )
protected

◆ Clear()

void CGUIFontTTF::Clear ( )

◆ ClearCharacterCache()

void CGUIFontTTF::ClearCharacterCache ( )
protected

◆ CopyCharToTexture()

virtual bool CGUIFontTTF::CopyCharToTexture ( FT_BitmapGlyph bitGlyph,
unsigned int x1,
unsigned int y1,
unsigned int x2,
unsigned int y2 )
protectedpure virtual

◆ CreateGUIFontTTF()

CGUIFontTTF * CGUIFontTTF::CreateGUIFontTTF ( const std::string & fontIdent)
static

◆ CreateVertexBuffer()

virtual CVertexBuffer CGUIFontTTF::CreateVertexBuffer ( const std::vector< SVertex > & vertices) const
inlinevirtual

Reimplemented in CGUIFontTTFDX, CGUIFontTTFGL, and CGUIFontTTFGLES.

◆ DeleteHardwareTexture()

virtual void CGUIFontTTF::DeleteHardwareTexture ( )
protectedpure virtual

◆ DestroyVertexBuffer()

virtual void CGUIFontTTF::DestroyVertexBuffer ( CVertexBuffer & bufferHandle) const
inlinevirtual

Reimplemented in CGUIFontTTFDX, CGUIFontTTFGL, and CGUIFontTTFGLES.

◆ DrawTextInternal()

void CGUIFontTTF::DrawTextInternal ( CGraphicContext & context,
float x,
float y,
const std::vector< KODI::UTILS::COLOR::Color > & colors,
const vecText & text,
uint32_t alignment,
float maxPixelWidth,
bool scrolling,
float dx = 0.0f,
float dy = 0.0f )
protected
Todo
: This validate is the last resort and can result in a bad rendered text because the alignment it is used also by caller components for other operations this inform the problem on the log, potentially can be improved by add validating alignments from each parent caller component

◆ End()

void CGUIFontTTF::End ( )

◆ GetCharacter()

CGUIFontTTF::Character * CGUIFontTTF::GetCharacter ( character_t letter,
FT_UInt glyphIndex )
protected

◆ GetCharWidthInternal()

float CGUIFontTTF::GetCharWidthInternal ( character_t ch)
protected

◆ GetFontHeight()

float CGUIFontTTF::GetFontHeight ( ) const
inlineprotected

◆ GetFontIdent()

const std::string & CGUIFontTTF::GetFontIdent ( ) const
inline

◆ GetHarfBuzzShapedGlyphs()

std::vector< CGUIFontTTF::Glyph > CGUIFontTTF::GetHarfBuzzShapedGlyphs ( const vecText & text)
protected

◆ GetLineHeight()

float CGUIFontTTF::GetLineHeight ( float lineSpacing) const
protected

◆ GetMaxFontHeight()

unsigned int CGUIFontTTF::GetMaxFontHeight ( ) const
protected

◆ GetTextBaseLine()

float CGUIFontTTF::GetTextBaseLine ( ) const
inlineprotected

◆ GetTextHeight()

float CGUIFontTTF::GetTextHeight ( float lineSpacing,
int numLines ) const
protected

◆ GetTextureLineHeight()

unsigned int CGUIFontTTF::GetTextureLineHeight ( ) const
protected

the height of each line in the texture. Accounts for spacing between lines to avoid characters overlapping.

◆ GetTextWidthInternal() [1/2]

float CGUIFontTTF::GetTextWidthInternal ( const vecText & text)
protected

◆ GetTextWidthInternal() [2/2]

float CGUIFontTTF::GetTextWidthInternal ( const vecText & text,
const std::vector< Glyph > & glyph )
protected

◆ Load()

bool CGUIFontTTF::Load ( const std::string & strFilename,
float height = 20.0f,
float aspect = 1.0f,
float lineSpacing = 1.0f,
bool border = false )

◆ ObliqueGlyph()

void CGUIFontTTF::ObliqueGlyph ( FT_GlyphSlot slot)
staticprotected

◆ ReallocTexture()

virtual std::unique_ptr< CTexture > CGUIFontTTF::ReallocTexture ( unsigned int & newHeight)
protectedpure virtual

◆ RemoveReference()

void CGUIFontTTF::RemoveReference ( )
protected

◆ RenderCharacter()

void CGUIFontTTF::RenderCharacter ( CGraphicContext & context,
float posX,
float posY,
const Character * ch,
KODI::UTILS::COLOR::Color color,
bool roundX,
std::vector< SVertex > & vertices )
protected

◆ SetGlyphStrength()

void CGUIFontTTF::SetGlyphStrength ( FT_GlyphSlot slot,
int glyphStrength )
protected

Friends And Related Symbol Documentation

◆ CGUIFont

friend class CGUIFont
friend

Member Data Documentation

◆ m_cellBaseLine

unsigned int CGUIFontTTF::m_cellBaseLine {0}
protected

◆ m_cellHeight

unsigned int CGUIFontTTF::m_cellHeight {0}
protected

◆ m_char

std::vector<Character> CGUIFontTTF::m_char
protected

◆ m_charquick

Character* CGUIFontTTF::m_charquick[LOOKUPTABLE_SIZE] {nullptr}
protected

◆ m_color

KODI::UTILS::COLOR::Color CGUIFontTTF::m_color {KODI::UTILS::COLOR::NONE}
protected

◆ m_dynamicCache

CGUIFontCache<CGUIFontCacheDynamicPosition, CGUIFontCacheDynamicValue> CGUIFontTTF::m_dynamicCache
protected

◆ m_ellipseCached

bool CGUIFontTTF::m_ellipseCached {false}
protected

◆ m_ellipsesWidth

float CGUIFontTTF::m_ellipsesWidth {0.0f}
protected

◆ m_face

FT_Face CGUIFontTTF::m_face {nullptr}
protected

◆ m_fontFileInMemory

std::vector<uint8_t> CGUIFontTTF::m_fontFileInMemory
protected

◆ m_fontIdent

const std::string CGUIFontTTF::m_fontIdent
protected

◆ m_hbFont

hb_font_t* CGUIFontTTF::m_hbFont {nullptr}
protected

◆ m_height

float CGUIFontTTF::m_height {0.0f}
protected

◆ m_maxFontHeight

unsigned int CGUIFontTTF::m_maxFontHeight {0}
protected

◆ m_nestedBeginCount

unsigned int CGUIFontTTF::m_nestedBeginCount {0}
protected

◆ m_nTexture

unsigned int CGUIFontTTF::m_nTexture {0}
protected

◆ m_originX

float CGUIFontTTF::m_originX {0.0f}
protected

◆ m_originY

float CGUIFontTTF::m_originY {0.0f}
protected

◆ m_posX

int CGUIFontTTF::m_posX {0}
protected

◆ m_posY

int CGUIFontTTF::m_posY {0}
protected

◆ m_renderSystem

CRenderSystemBase* CGUIFontTTF::m_renderSystem
protected

◆ m_staticCache

CGUIFontCache<CGUIFontCacheStaticPosition, CGUIFontCacheStaticValue> CGUIFontTTF::m_staticCache
protected

◆ m_stroker

FT_Stroker CGUIFontTTF::m_stroker {nullptr}
protected

◆ m_texture

std::unique_ptr<CTexture> CGUIFontTTF::m_texture
protected

◆ m_textureHeight

unsigned int CGUIFontTTF::m_textureHeight {0}
protected

◆ m_textureScaleX

float CGUIFontTTF::m_textureScaleX {0.0f}
protected

◆ m_textureScaleY

float CGUIFontTTF::m_textureScaleY {0.0f}
protected

◆ m_textureWidth

unsigned int CGUIFontTTF::m_textureWidth {0}
protected

◆ m_vertex

std::vector<SVertex> CGUIFontTTF::m_vertex
protected

◆ m_vertexTrans

std::vector<CTranslatedVertices> CGUIFontTTF::m_vertexTrans
protected

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