fix label font cache
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
#include "UINode.hpp"
|
||||
#include "constants.hpp"
|
||||
|
||||
#include "graphics/core/FontMetics.hpp"
|
||||
|
||||
class Font;
|
||||
struct FontStylesScheme;
|
||||
|
||||
@@ -13,14 +15,16 @@ namespace gui {
|
||||
};
|
||||
|
||||
struct LabelCache {
|
||||
Font* font = nullptr;
|
||||
ptrdiff_t fontId = 0;
|
||||
FontMetrics metrics;
|
||||
|
||||
std::vector<LineScheme> lines;
|
||||
/// @brief Reset cache flag
|
||||
bool resetFlag = true;
|
||||
size_t wrapWidth = -1;
|
||||
int multilineWidth = 0;
|
||||
|
||||
void prepare(Font* font, size_t wrapWidth);
|
||||
void prepare(std::ptrdiff_t fontId, FontMetrics metrics, size_t wrapWidth);
|
||||
void update(std::wstring_view text, bool multiline, bool wrap);
|
||||
|
||||
size_t getTextLineOffset(size_t line) const;
|
||||
|
||||
Reference in New Issue
Block a user