mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-09 04:51:49 +00:00
fix label font cache
This commit is contained in:
parent
c8ba5b5dbb
commit
edc6810283
7 changed files with 75 additions and 36 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue