feat(ui): add word wrap for chat messages with font width measurement

This commit is contained in:
2026-07-20 10:39:20 +08:00
parent ce10290959
commit 5b081c0b0b
4 changed files with 62 additions and 2 deletions

View File

@@ -56,6 +56,7 @@ public:
TextMesh vertices(const std::string& text);
const Texture* text_texture();
static const std::string& font_path();
static float text_width(const std::string& text);
private:
FT_Library m_ft;

View File

@@ -51,5 +51,6 @@ private:
void on_render(Renderer& renderer) override;
bool handle_text_input_event(const TextInputEvent& e) override;
bool handle_key_event(const KeyEvent& e) override;
std::vector<std::string> wrap_message(const std::string& text) const;
};
} // namespace Cubed