From 4690ba0cc66338b1f00e08fb6054ee95c1c0dcc6 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Wed, 23 Sep 2020 23:45:21 +0200 Subject: Fallback to cjk font, change font to system noto sans --- include/Text.hpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'include/Text.hpp') diff --git a/include/Text.hpp b/include/Text.hpp index 8b6c0b9..d70f356 100644 --- a/include/Text.hpp +++ b/include/Text.hpp @@ -35,21 +35,22 @@ namespace QuickMedia }; TextElement() {} - TextElement(const StringViewUtf32 &_text, Type _type) : text(_text), type(_type), ownLine(false) {} + TextElement(const StringViewUtf32 &_text, Type _type) : text(_text), type(_type), is_japanese(false) {} StringViewUtf32 text; sf::Vector2f position; Type type; - bool ownLine; // Currently only used for emoji, to make emoji bigger when it's the only thing on a line + //bool ownLine; // Currently only used for emoji, to make emoji bigger when it's the only thing on a line + bool is_japanese; }; class Text { public: - Text(const sf::Font *font); - Text(const sf::String &str, const sf::Font *font, unsigned int characterSize, float maxWidth, bool plainText = true); + Text(const sf::Font *font, const sf::Font *cjk_font); + Text(sf::String str, const sf::Font *font, const sf::Font *cjk_font, unsigned int characterSize, float maxWidth, bool plainText = true); - void setString(const sf::String &str); + void setString(sf::String str); const sf::String& getString() const; void setPosition(float x, float y); @@ -89,6 +90,7 @@ namespace QuickMedia END }; +#if 0 void updateCaret(); bool isCaretAtEnd() const; int getStartOfLine(int startIndex) const; @@ -97,11 +99,15 @@ namespace QuickMedia int getPreviousLineClosestPosition(int startIndex) const; int getNextLineClosestPosition(int startIndex) const; +#endif + + void splitTextByFont(); private: sf::String str; const sf::Font *font; + const sf::Font *cjk_font; unsigned int characterSize; - sf::VertexArray vertices; + sf::VertexArray vertices[2]; float maxWidth; sf::Vector2f position; sf::Color color; -- cgit v1.2.3