diff --git a/ChangeLog.md b/ChangeLog.md index 64e1718cd..077ae0ee7 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -278,6 +278,7 @@ Nazara Development Kit: - Console has been remade with widgets (allowing to scroll back history, select text, etc.) - Added TextAreaWidget line wrap option - TextAreaWidget will now shift the text to the left/right in order to keep the cursor visible +- Added TextAreaWidget::[Get|Set]TextFont # 0.4: diff --git a/SDK/include/NDK/Widgets/TextAreaWidget.hpp b/SDK/include/NDK/Widgets/TextAreaWidget.hpp index 52d7a79ad..223a3759f 100644 --- a/SDK/include/NDK/Widgets/TextAreaWidget.hpp +++ b/SDK/include/NDK/Widgets/TextAreaWidget.hpp @@ -52,6 +52,7 @@ namespace Ndk inline std::size_t GetGlyphIndex(const Nz::Vector2ui& cursorPosition) const; inline const Nz::String& GetText() const; inline const Nz::Color& GetTextColor() const; + inline Nz::Font* GetTextFont() const; inline const Nz::Color& GetTextOulineColor() const; inline float GetTextOulineThickness() const; @@ -76,6 +77,7 @@ namespace Ndk inline void SetSelection(Nz::Vector2ui fromPosition, Nz::Vector2ui toPosition); inline void SetText(const Nz::String& text); inline void SetTextColor(const Nz::Color& text); + inline void SetTextFont(Nz::FontRef font); inline void SetTextOutlineColor(const Nz::Color& color); inline void SetTextOutlineThickness(float thickness); diff --git a/SDK/include/NDK/Widgets/TextAreaWidget.inl b/SDK/include/NDK/Widgets/TextAreaWidget.inl index c66662f32..535936243 100644 --- a/SDK/include/NDK/Widgets/TextAreaWidget.inl +++ b/SDK/include/NDK/Widgets/TextAreaWidget.inl @@ -108,6 +108,11 @@ namespace Ndk return m_drawer.GetColor(); } + inline Nz::Font* TextAreaWidget::GetTextFont() const + { + return m_drawer.GetFont(); + } + inline const Nz::Color& TextAreaWidget::GetTextOulineColor() const { return m_drawer.GetOutlineColor(); @@ -265,6 +270,13 @@ namespace Ndk UpdateDisplayText(); } + inline void TextAreaWidget::SetTextFont(Nz::FontRef font) + { + m_drawer.SetFont(font); + + UpdateDisplayText(); + } + inline void TextAreaWidget::SetTextOutlineColor(const Nz::Color& color) { m_drawer.SetOutlineColor(color); diff --git a/SDK/src/NDK/Console.cpp b/SDK/src/NDK/Console.cpp index 4108cddc5..8bfa48a0f 100644 --- a/SDK/src/NDK/Console.cpp +++ b/SDK/src/NDK/Console.cpp @@ -170,8 +170,8 @@ namespace Ndk NazaraAssert(font && font->IsValid(), "Invalid font"); m_defaultFont = std::move(font); - //m_historyDrawer.SetFont(m_defaultFont); - //m_inputDrawer.SetFont(m_defaultFont); + m_history->SetTextFont(m_defaultFont); + m_input->SetTextFont(m_defaultFont); Layout(); }