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;
53 bool m_carriageReturn;
67 UTILS::COLOR::Color color,
68 UTILS::COLOR::Color shadowColor,
72 void RenderScrolling(
float x,
75 UTILS::COLOR::Color color,
76 UTILS::COLOR::Color shadowColor,
80 void RenderOutline(
float x,
82 UTILS::COLOR::Color color,
83 UTILS::COLOR::Color outlineColor,
92 void GetTextExtent(
float &width,
float &height)
const;
100 float GetTextWidth(
const std::wstring &text)
const;
102 float GetTextWidth(
const vecText& text)
const;
109 bool Update(
const std::string &text,
float maxWidth = 0,
bool forceUpdate =
false,
bool forceLTRReadingOrder =
false);
110 bool UpdateW(
const std::wstring &text,
float maxWidth = 0,
bool forceUpdate =
false,
bool forceLTRReadingOrder =
false);
119 void UpdateStyled(
const vecText& text,
120 const std::vector<UTILS::COLOR::Color>& colors,
122 bool forceLTRReadingOrder =
false);
124 unsigned int GetTextLength()
const;
125 void GetFirstText(vecText &text)
const;
128 void SetWrap(
bool bWrap=
true);
129 void SetMaxHeight(
float fHeight);
132 static void DrawText(
CGUIFont* font,
135 UTILS::COLOR::Color color,
136 UTILS::COLOR::Color shadowColor,
137 const std::string& text,
139 static void Filter(std::string &text);
142 void LineBreakText(
const vecText &text, std::vector<CGUIString> &lines);
143 void WrapText(
const vecText &text,
float maxWidth);
144 static void BidiTransform(std::vector<CGUIString> &lines,
bool forceLTRReadingOrder);
145 static std::wstring BidiFlip(
const std::wstring& text,
146 bool forceLTRReadingOrder,
147 int* visualToLogicalMap =
nullptr);
148 void CalcTextExtent();
149 void UpdateCommon(
const std::wstring &text,
float maxWidth,
bool forceLTRReadingOrder);
154 std::string GetText()
const;
160 void UseMonoFont(
bool use) { m_font = use && m_monoFont ? m_monoFont : m_varFont; }
163 std::vector<UTILS::COLOR::Color> m_colors;
164 std::vector<CGUIString> m_lines;
165 typedef std::vector<CGUIString>::iterator iLine;
176 UTILS::COLOR::Color m_textColor;
178 std::string m_lastUtf8Text;
179 std::wstring m_lastText;
184 inline bool IsSpace(character_t letter)
const XBMC_FORCE_INLINE
186 return (letter & 0xffff) == L
' ';
188 inline bool CanWrapAtLetter(character_t letter)
const XBMC_FORCE_INLINE
190 character_t ch = letter & 0xffff;
191 return ch == L
' ' || (ch >=0x4e00 && ch <= 0x9fff);
193 static void AppendToUTF32(
const std::string &utf8, character_t colStyle, vecText &utf32);
194 static void AppendToUTF32(
const std::wstring &utf16, character_t colStyle, vecText &utf32);
195 static void ParseText(
const std::wstring& text,
196 uint32_t defaultStyle,
197 UTILS::COLOR::Color defaultColor,
198 std::vector<UTILS::COLOR::Color>& colors,
199 vecText& parsedText);
void SetMonoFont(CGUIFont *font)
Set the monospaced font to use.
Definition: GUITextLayout.h:157
void UseMonoFont(bool use)
Set whether or not to use the monospace font.
Definition: GUITextLayout.h:160
Definition: GUITextLayout.h:56
float GetTextWidth() const
Returns the precalculated width of the text to be rendered (in constant time).
Definition: GUITextLayout.h:98
bool m_lastUpdateW
true if the last string we updated was the wstring version
Definition: GUITextLayout.h:180
Definition: GUIFont.h:110
Definition: GUITextLayout.h:39
float GetTextHeight() const
Returns the precalculated height of the text to be rendered (in constant time).
Definition: GUITextLayout.h:107
CGUIFont * m_varFont
Varible-space font to use.
Definition: GUITextLayout.h:171