xbmc
Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
CGUITextLayout Class Reference
Inheritance diagram for CGUITextLayout:
Inheritance graph
[legend]
Collaboration diagram for CGUITextLayout:
Collaboration graph
[legend]

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). More...
 
float GetTextWidth () const
 Returns the precalculated width of the text to be rendered (in constant time). More...
 
float GetTextWidth (const std::wstring &text) const
 
float GetTextHeight () const
 Returns the precalculated height of the text to be rendered (in constant time). More...
 
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. More...
 
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. More...
 
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::Color > m_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 Function Documentation

◆ 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

◆ GetTextWidth()

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

◆ 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.

◆ 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.

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