11 #include "utils/ColorUtils.h" 19 #define XBMC_FORCE_INLINE __attribute__((always_inline)) 21 #define XBMC_FORCE_INLINE 36 typedef uint32_t character_t;
37 typedef std::vector<character_t> vecText;
42 typedef vecText::const_iterator iString;
44 CGUIString(iString start, iString end,
bool carriageReturn);
46 std::string GetAsString()
const;
49 bool m_carriageReturn;
63 UTILS::COLOR::Color color,
64 UTILS::COLOR::Color shadowColor,
68 void RenderScrolling(
float x,
71 UTILS::COLOR::Color color,
72 UTILS::COLOR::Color shadowColor,
76 void RenderOutline(
float x,
78 UTILS::COLOR::Color color,
79 UTILS::COLOR::Color outlineColor,
88 void GetTextExtent(
float &width,
float &height)
const;
96 float GetTextWidth(
const std::wstring &text)
const;
103 bool Update(
const std::string &text,
float maxWidth = 0,
bool forceUpdate =
false,
bool forceLTRReadingOrder =
false);
104 bool UpdateW(
const std::wstring &text,
float maxWidth = 0,
bool forceUpdate =
false,
bool forceLTRReadingOrder =
false);
113 void UpdateStyled(
const vecText& text,
114 const std::vector<UTILS::COLOR::Color>& colors,
116 bool forceLTRReadingOrder =
false);
118 unsigned int GetTextLength()
const;
119 void GetFirstText(vecText &text)
const;
122 void SetWrap(
bool bWrap=
true);
123 void SetMaxHeight(
float fHeight);
126 static void DrawText(
CGUIFont* font,
129 UTILS::COLOR::Color color,
130 UTILS::COLOR::Color shadowColor,
131 const std::string& text,
133 static void Filter(std::string &text);
136 void LineBreakText(
const vecText &text, std::vector<CGUIString> &lines);
137 void WrapText(
const vecText &text,
float maxWidth);
138 static void BidiTransform(std::vector<CGUIString> &lines,
bool forceLTRReadingOrder);
139 static std::wstring BidiFlip(
const std::wstring& text,
140 bool forceLTRReadingOrder,
141 int* visualToLogicalMap =
nullptr);
142 void CalcTextExtent();
143 void UpdateCommon(
const std::wstring &text,
float maxWidth,
bool forceLTRReadingOrder);
148 std::string GetText()
const;
154 void UseMonoFont(
bool use) { m_font = use && m_monoFont ? m_monoFont : m_varFont; }
157 std::vector<UTILS::COLOR::Color> m_colors;
158 std::vector<CGUIString> m_lines;
159 typedef std::vector<CGUIString>::iterator iLine;
170 UTILS::COLOR::Color m_textColor;
172 std::string m_lastUtf8Text;
173 std::wstring m_lastText;
178 inline bool IsSpace(character_t letter)
const XBMC_FORCE_INLINE
180 return (letter & 0xffff) == L
' ';
182 inline bool CanWrapAtLetter(character_t letter)
const XBMC_FORCE_INLINE
184 character_t ch = letter & 0xffff;
185 return ch == L
' ' || (ch >=0x4e00 && ch <= 0x9fff);
187 static void AppendToUTF32(
const std::string &utf8, character_t colStyle, vecText &utf32);
188 static void AppendToUTF32(
const std::wstring &utf16, character_t colStyle, vecText &utf32);
189 static void ParseText(
const std::wstring& text,
190 uint32_t defaultStyle,
191 UTILS::COLOR::Color defaultColor,
192 std::vector<UTILS::COLOR::Color>& colors,
193 vecText& parsedText);
void SetMonoFont(CGUIFont *font)
Set the monospaced font to use.
Definition: GUITextLayout.h:151
void UseMonoFont(bool use)
Set whether or not to use the monospace font.
Definition: GUITextLayout.h:154
Definition: GUITextLayout.h:52
float GetTextWidth() const
Returns the precalculated width of the text to be rendered (in constant time).
Definition: GUITextLayout.h:94
bool m_lastUpdateW
true if the last string we updated was the wstring version
Definition: GUITextLayout.h:174
Definition: GUIFont.h:107
Definition: GUITextLayout.h:39
float GetTextHeight() const
Returns the precalculated height of the text to be rendered (in constant time).
Definition: GUITextLayout.h:101
CGUIFont * m_varFont
Varible-space font to use.
Definition: GUITextLayout.h:165