fix label font cache

This commit is contained in:
MihailRis
2025-09-30 18:22:39 +03:00
parent c8ba5b5dbb
commit edc6810283
7 changed files with 75 additions and 36 deletions
+6 -2
View File
@@ -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;