aboutsummaryrefslogtreecommitdiff
path: root/include/Text.hpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2020-09-23 23:45:21 +0200
committerdec05eba <dec05eba@protonmail.com>2020-09-23 23:45:25 +0200
commit4690ba0cc66338b1f00e08fb6054ee95c1c0dcc6 (patch)
tree17f609546b85cb6b1243e53f66c27fd89ead91ef /include/Text.hpp
parent23dd37254cdf7479b88a7f1d711ecb5de92440e8 (diff)
Fallback to cjk font, change font to system noto sans
Diffstat (limited to 'include/Text.hpp')
-rw-r--r--include/Text.hpp18
1 files changed, 12 insertions, 6 deletions
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;