aboutsummaryrefslogtreecommitdiff
path: root/include/Text.hpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2020-10-31 09:46:32 +0100
committerdec05eba <dec05eba@protonmail.com>2020-10-31 09:46:32 +0100
commitd638a6092bd6291c983490ba3f966162c7ca06c2 (patch)
tree45b9421e0f3dd22265b33be8ecdcd974e12b0346 /include/Text.hpp
parent11f644afe434ce6b6d570c9da2a95590321871b3 (diff)
Load fonts on demand
Diffstat (limited to 'include/Text.hpp')
-rw-r--r--include/Text.hpp20
1 files changed, 12 insertions, 8 deletions
diff --git a/include/Text.hpp b/include/Text.hpp
index 7ce7fa3..e471441 100644
--- a/include/Text.hpp
+++ b/include/Text.hpp
@@ -36,15 +36,21 @@ namespace QuickMedia
{
TEXT
};
+
+ enum class TextType {
+ LATIN,
+ CJK,
+ EMOJI
+ };
TextElement() {}
- TextElement(const StringViewUtf32 &_text, Type _type) : text(_text), type(_type), is_cjk(false) {}
+ TextElement(const StringViewUtf32 &_text, Type _type) : text(_text), type(_type), text_type(TextType::LATIN) {}
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 is_cjk;
+ TextType text_type;
};
struct VertexRef {
@@ -57,8 +63,8 @@ namespace QuickMedia
class Text
{
public:
- 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);
+ Text(bool bold_font);
+ Text(sf::String str, bool bold_font, unsigned int characterSize, float maxWidth);
void setString(sf::String str);
const sf::String& getString() const;
@@ -73,8 +79,7 @@ namespace QuickMedia
void setCharacterSize(unsigned int characterSize);
unsigned int getCharacterSize() const;
-
- const sf::Font* getFont() const;
+
void setFillColor(sf::Color color);
void setLineSpacing(float lineSpacing);
@@ -127,8 +132,7 @@ namespace QuickMedia
int get_vertex_line(int index) const;
private:
sf::String str; // TODO: Remove this for non-editable text??? also replace with std::string? then we get more efficient editing of text
- const sf::Font *font;
- const sf::Font *cjk_font;
+ const bool bold_font;
unsigned int characterSize;
sf::VertexArray vertices[2];
float maxWidth;