Codechange: allocate enough memory to layout the strings

(cherry picked from commit 96fef9f643)
This commit is contained in:
Rubidium
2023-06-05 17:14:35 +02:00
committed by Jonathan G Rennison
parent 1e5bc2c12b
commit 78d28d432b

View File

@@ -64,8 +64,8 @@ static inline void GetLayouter(Layouter::LineCacheItem &line, std::string_view s
{ {
if (line.buffer != nullptr) free(line.buffer); if (line.buffer != nullptr) free(line.buffer);
typename T::CharType *buff_begin = MallocT<typename T::CharType>(DRAW_STRING_BUFFER); typename T::CharType *buff_begin = MallocT<typename T::CharType>(str.size() + 1);
const typename T::CharType *buffer_last = buff_begin + DRAW_STRING_BUFFER; const typename T::CharType *buffer_last = buff_begin + str.size() + 1;
typename T::CharType *buff = buff_begin; typename T::CharType *buff = buff_begin;
FontMap &fontMapping = line.runs; FontMap &fontMapping = line.runs;
Font *f = Layouter::GetFont(state.fontsize, state.cur_colour); Font *f = Layouter::GetFont(state.fontsize, state.cur_colour);