|
|
@@ -146,7 +146,6 @@ void ElementTextDefault::OnRender()
|
|
|
// Generates a token of text from this element, returning only the width.
|
|
|
bool ElementTextDefault::GenerateToken(float& token_width, int line_begin)
|
|
|
{
|
|
|
- RMLUI_ASSERT_NONRECURSIVE;
|
|
|
RMLUI_ZoneScoped;
|
|
|
|
|
|
// Bail if we don't have a valid font face.
|
|
|
@@ -167,8 +166,7 @@ bool ElementTextDefault::GenerateToken(float& token_width, int line_begin)
|
|
|
white_space_property == WhiteSpace::Preline;
|
|
|
|
|
|
const word* token_begin = text.c_str() + line_begin;
|
|
|
- static WString token; // Avoids allocations, requires non-recursiveness. TODO: Doesn't actually behave like this, maybe use a stack-allocated string instead?
|
|
|
- token.clear();
|
|
|
+ WString token;
|
|
|
|
|
|
BuildToken(token, token_begin, text.c_str() + text.size(), true, collapse_white_space, break_at_endline, computed.text_transform);
|
|
|
token_width = (float) font_face_handle->GetStringWidth(token, 0);
|
|
|
@@ -179,7 +177,6 @@ bool ElementTextDefault::GenerateToken(float& token_width, int line_begin)
|
|
|
// Generates a line of text rendered from this element
|
|
|
bool ElementTextDefault::GenerateLine(WString& line, int& line_length, float& line_width, int line_begin, float maximum_line_width, float right_spacing_width, bool trim_whitespace_prefix)
|
|
|
{
|
|
|
- RMLUI_ASSERT_NONRECURSIVE;
|
|
|
RMLUI_ZoneScoped;
|
|
|
|
|
|
FontFaceHandle* font_face_handle = GetFontFaceHandle();
|
|
|
@@ -219,8 +216,7 @@ bool ElementTextDefault::GenerateLine(WString& line, int& line_length, float& li
|
|
|
const word* string_end = text.c_str() + text.size();
|
|
|
while (token_begin != string_end)
|
|
|
{
|
|
|
- static WString token; // Avoids allocations, requires non-recursiveness. TODO: Doesn't actually behave like this, maybe use a stack-allocated string instead?
|
|
|
- token.clear();
|
|
|
+ WString token;
|
|
|
const word* next_token_begin = token_begin;
|
|
|
|
|
|
// Generate the next token and determine its pixel-length.
|