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;
47 std::wstring GetAsWstring()
const;
54 bool m_carriageReturn;
68 UTILS::COLOR::Color color,
69 UTILS::COLOR::Color shadowColor,
73 void RenderScrolling(
float x,
76 UTILS::COLOR::Color color,
77 UTILS::COLOR::Color shadowColor,
81 void RenderOutline(
float x,
83 UTILS::COLOR::Color color,
84 UTILS::COLOR::Color outlineColor,
93 void GetTextExtent(
float &width,
float &height)
const;
101 float GetTextWidth(
const std::wstring &text)
const;
108 bool Update(
const std::string &text,
float maxWidth = 0,
bool forceUpdate =
false,
bool forceLTRReadingOrder =
false);
109 bool UpdateW(
const std::wstring &text,
float maxWidth = 0,
bool forceUpdate =
false,
bool forceLTRReadingOrder =
false);
118 void UpdateStyled(
const vecText& text,
119 const std::vector<UTILS::COLOR::Color>& colors,
121 bool forceLTRReadingOrder =
false);
123 unsigned int GetTextLength()
const;
124 void GetFirstText(vecText &text)
const;
127 void SetWrap(
bool bWrap=
true);
128 void SetMaxHeight(
float fHeight);
131 static void DrawText(
CGUIFont* font,
134 UTILS::COLOR::Color color,
135 UTILS::COLOR::Color shadowColor,
136 const std::string& text,
138 static void Filter(std::string &text);
141 void LineBreakText(
const vecText &text, std::vector<CGUIString> &lines);
142 void WrapText(
const vecText &text,
float maxWidth);
143 static void BidiTransform(std::vector<CGUIString> &lines,
bool forceLTRReadingOrder);
144 static std::wstring BidiFlip(
const std::wstring& text,
145 bool forceLTRReadingOrder,
146 int* visualToLogicalMap =
nullptr);
147 void CalcTextExtent();
148 void UpdateCommon(
const std::wstring &text,
float maxWidth,
bool forceLTRReadingOrder);
153 std::string GetText()
const;
159 void UseMonoFont(
bool use) { m_font = use && m_monoFont ? m_monoFont : m_varFont; }
162 std::vector<UTILS::COLOR::Color> m_colors;
163 std::vector<CGUIString> m_lines;
164 typedef std::vector<CGUIString>::iterator iLine;
175 UTILS::COLOR::Color m_textColor;
177 std::string m_lastUtf8Text;
178 std::wstring m_lastText;
183 inline bool IsSpace(character_t letter)
const XBMC_FORCE_INLINE
185 return (letter & 0xffff) == L
' ';
187 inline bool CanWrapAtLetter(character_t letter)
const XBMC_FORCE_INLINE
189 character_t ch = letter & 0xffff;
190 return ch == L
' ' || (ch >=0x4e00 && ch <= 0x9fff);
192 static void AppendToUTF32(
const std::string &utf8, character_t colStyle, vecText &utf32);
193 static void AppendToUTF32(
const std::wstring &utf16, character_t colStyle, vecText &utf32);
194 static void ParseText(
const std::wstring& text,
195 uint32_t defaultStyle,
196 UTILS::COLOR::Color defaultColor,
197 std::vector<UTILS::COLOR::Color>& colors,
198 vecText& parsedText);
void SetMonoFont(CGUIFont *font)
Set the monospaced font to use.
Definition: GUITextLayout.h:156
void UseMonoFont(bool use)
Set whether or not to use the monospace font.
Definition: GUITextLayout.h:159
Definition: GUITextLayout.h:57
float GetTextWidth() const
Returns the precalculated width of the text to be rendered (in constant time).
Definition: GUITextLayout.h:99
bool m_lastUpdateW
true if the last string we updated was the wstring version
Definition: GUITextLayout.h:179
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:106
CGUIFont * m_varFont
Varible-space font to use.
Definition: GUITextLayout.h:170