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

#include <GUITextLayout.h>

Inheritance diagram for CGUITextLayout:
CGUITextBox

Public Member Functions

 CGUITextLayout (CGUIFont *font, bool wrap, float fHeight=0.0f, CGUIFont *borderFont=NULL)
 
bool UpdateScrollinfo (CScrollInfo &scrollInfo)
 
void Render (float x, float y, float angle, UTILS::COLOR::Color color, UTILS::COLOR::Color shadowColor, uint32_t alignment, float maxWidth, bool solid=false)
 
void RenderScrolling (float x, float y, float angle, UTILS::COLOR::Color color, UTILS::COLOR::Color shadowColor, uint32_t alignment, float maxWidth, const CScrollInfo &scrollInfo)
 
void RenderOutline (float x, float y, UTILS::COLOR::Color color, UTILS::COLOR::Color outlineColor, uint32_t alignment, float maxWidth)
 
void GetTextExtent (float &width, float &height) const
 Returns the precalculated width and height of the text to be rendered (in constant time).
 
float GetTextWidth () const
 Returns the precalculated width of the text to be rendered (in constant time).
 
float GetTextWidth (const std::wstring &text) const
 
float GetTextWidth (const vecText &text) const
 
float GetTextHeight () const
 Returns the precalculated height of the text to be rendered (in constant time).
 
bool Update (const std::string &text, float maxWidth=0, bool forceUpdate=false, bool forceLTRReadingOrder=false)
 
bool UpdateW (const std::wstring &text, float maxWidth=0, bool forceUpdate=false, bool forceLTRReadingOrder=false)
 
void UpdateStyled (const vecText &text, const std::vector< UTILS::COLOR::Color > &colors, float maxWidth=0, bool forceLTRReadingOrder=false)
 Update text from a pre-styled vecText/std::vector<UTILS::COLOR::Color> combination Allows styled text to be passed directly to the text layout.
 
unsigned int GetTextLength () const
 
void GetFirstText (vecText &text) const
 
void Reset ()
 
void SetWrap (bool bWrap=true)
 
void SetMaxHeight (float fHeight)
 

Static Public Member Functions

static void DrawText (CGUIFont *font, float x, float y, UTILS::COLOR::Color color, UTILS::COLOR::Color shadowColor, const std::string &text, uint32_t align)
 
static void Filter (std::string &text)
 

Protected Types

typedef std::vector< CGUIString >::iterator iLine
 

Protected Member Functions

void LineBreakText (const vecText &text, std::vector< CGUIString > &lines)
 
void WrapText (const vecText &text, float maxWidth)
 
void CalcTextExtent ()
 
void UpdateCommon (const std::wstring &text, float maxWidth, bool forceLTRReadingOrder)
 
std::string GetText () const
 Returns the text, utf8 encoded.
 
void SetMonoFont (CGUIFont *font)
 Set the monospaced font to use.
 
void UseMonoFont (bool use)
 Set whether or not to use the monospace font.
 

Static Protected Member Functions

static void BidiTransform (std::vector< CGUIString > &lines, bool forceLTRReadingOrder)
 
static std::wstring BidiFlip (const std::wstring &text, bool forceLTRReadingOrder, int *visualToLogicalMap=nullptr)
 

Protected Attributes

std::vector< UTILS::COLOR::Colorm_colors
 
std::vector< CGUIStringm_lines
 
CGUIFontm_font
 
CGUIFontm_borderFont
 
CGUIFontm_monoFont = nullptr
 Mono-space font to use.
 
CGUIFontm_varFont
 Varible-space font to use.
 
bool m_wrap
 
float m_maxHeight
 
UTILS::COLOR::Color m_textColor
 
std::string m_lastUtf8Text
 
std::wstring m_lastText
 
bool m_lastUpdateW
 true if the last string we updated was the wstring version
 
float m_textWidth
 
float m_textHeight
 

Member Typedef Documentation

◆ iLine

typedef std::vector<CGUIString>::iterator CGUITextLayout::iLine
protected

Constructor & Destructor Documentation

◆ CGUITextLayout()

CGUITextLayout::CGUITextLayout ( CGUIFont * font,
bool wrap,
float fHeight = 0.0f,
CGUIFont * borderFont = NULL )

Member Function Documentation

◆ BidiFlip()

std::wstring CGUITextLayout::BidiFlip ( const std::wstring & text,
bool forceLTRReadingOrder,
int * visualToLogicalMap = nullptr )
staticprotected

◆ BidiTransform()

void CGUITextLayout::BidiTransform ( std::vector< CGUIString > & lines,
bool forceLTRReadingOrder )
staticprotected

◆ CalcTextExtent()

void CGUITextLayout::CalcTextExtent ( )
protected

◆ DrawText()

void CGUITextLayout::DrawText ( CGUIFont * font,
float x,
float y,
UTILS::COLOR::Color color,
UTILS::COLOR::Color shadowColor,
const std::string & text,
uint32_t align )
static

◆ Filter()

void CGUITextLayout::Filter ( std::string & text)
static

◆ GetFirstText()

void CGUITextLayout::GetFirstText ( vecText & text) const

◆ GetText()

std::string CGUITextLayout::GetText ( ) const
protected

Returns the text, utf8 encoded.

Returns
utf8 text

◆ GetTextExtent()

void CGUITextLayout::GetTextExtent ( float & width,
float & height ) const

Returns the precalculated width and height of the text to be rendered (in constant time).

Parameters
width[out] width of text
height[out] height of text
See also
GetTextWidth, CalcTextExtent

◆ GetTextHeight()

float CGUITextLayout::GetTextHeight ( ) const
inline

Returns the precalculated height of the text to be rendered (in constant time).

Returns
height of text

◆ GetTextLength()

unsigned int CGUITextLayout::GetTextLength ( ) const

◆ GetTextWidth() [1/3]

float CGUITextLayout::GetTextWidth ( ) const
inline

Returns the precalculated width of the text to be rendered (in constant time).

Returns
width of text
See also
GetTextExtent, CalcTextExtent

◆ GetTextWidth() [2/3]

float CGUITextLayout::GetTextWidth ( const std::wstring & text) const

◆ GetTextWidth() [3/3]

float CGUITextLayout::GetTextWidth ( const vecText & text) const

◆ LineBreakText()

void CGUITextLayout::LineBreakText ( const vecText & text,
std::vector< CGUIString > & lines )
protected

◆ Render()

void CGUITextLayout::Render ( float x,
float y,
float angle,
UTILS::COLOR::Color color,
UTILS::COLOR::Color shadowColor,
uint32_t alignment,
float maxWidth,
bool solid = false )

◆ RenderOutline()

void CGUITextLayout::RenderOutline ( float x,
float y,
UTILS::COLOR::Color color,
UTILS::COLOR::Color outlineColor,
uint32_t alignment,
float maxWidth )
Todo
We should really have a better way to handle text extent - at the moment we assume that text is rendered from a posx, posy, width, and height which isn't enough to accurately position text. We need a vertical and horizontal offset of the baseline and cursor as well.

◆ RenderScrolling()

void CGUITextLayout::RenderScrolling ( float x,
float y,
float angle,
UTILS::COLOR::Color color,
UTILS::COLOR::Color shadowColor,
uint32_t alignment,
float maxWidth,
const CScrollInfo & scrollInfo )

◆ Reset()

void CGUITextLayout::Reset ( )

◆ SetMaxHeight()

void CGUITextLayout::SetMaxHeight ( float fHeight)

◆ SetMonoFont()

void CGUITextLayout::SetMonoFont ( CGUIFont * font)
inlineprotected

Set the monospaced font to use.

◆ SetWrap()

void CGUITextLayout::SetWrap ( bool bWrap = true)

◆ Update()

bool CGUITextLayout::Update ( const std::string & text,
float maxWidth = 0,
bool forceUpdate = false,
bool forceLTRReadingOrder = false )

◆ UpdateCommon()

void CGUITextLayout::UpdateCommon ( const std::wstring & text,
float maxWidth,
bool forceLTRReadingOrder )
protected

◆ UpdateScrollinfo()

bool CGUITextLayout::UpdateScrollinfo ( CScrollInfo & scrollInfo)

◆ UpdateStyled()

void CGUITextLayout::UpdateStyled ( const vecText & text,
const std::vector< UTILS::COLOR::Color > & colors,
float maxWidth = 0,
bool forceLTRReadingOrder = false )

Update text from a pre-styled vecText/std::vector<UTILS::COLOR::Color> combination Allows styled text to be passed directly to the text layout.

Parameters
textthe styled text to set.
colorsthe colors used on the text.
maxWidththe maximum width for wrapping text, defaults to 0 (no max width).
forceLTRReadingOrderwhether to force left to right reading order, defaults to false.

◆ UpdateW()

bool CGUITextLayout::UpdateW ( const std::wstring & text,
float maxWidth = 0,
bool forceUpdate = false,
bool forceLTRReadingOrder = false )

◆ UseMonoFont()

void CGUITextLayout::UseMonoFont ( bool use)
inlineprotected

Set whether or not to use the monospace font.

◆ WrapText()

void CGUITextLayout::WrapText ( const vecText & text,
float maxWidth )
protected

Member Data Documentation

◆ m_borderFont

CGUIFont* CGUITextLayout::m_borderFont
protected

◆ m_colors

std::vector<UTILS::COLOR::Color> CGUITextLayout::m_colors
protected

◆ m_font

CGUIFont* CGUITextLayout::m_font
protected

◆ m_lastText

std::wstring CGUITextLayout::m_lastText
protected

◆ m_lastUpdateW

bool CGUITextLayout::m_lastUpdateW
protected

true if the last string we updated was the wstring version

◆ m_lastUtf8Text

std::string CGUITextLayout::m_lastUtf8Text
protected

◆ m_lines

std::vector<CGUIString> CGUITextLayout::m_lines
protected

◆ m_maxHeight

float CGUITextLayout::m_maxHeight
protected

◆ m_monoFont

CGUIFont* CGUITextLayout::m_monoFont = nullptr
protected

Mono-space font to use.

◆ m_textColor

UTILS::COLOR::Color CGUITextLayout::m_textColor
protected

◆ m_textHeight

float CGUITextLayout::m_textHeight
protected

◆ m_textWidth

float CGUITextLayout::m_textWidth
protected

◆ m_varFont

CGUIFont* CGUITextLayout::m_varFont
protected

Varible-space font to use.

◆ m_wrap

bool CGUITextLayout::m_wrap
protected

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