aboutsummaryrefslogtreecommitdiff
path: root/src/Text.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Text.cpp')
-rw-r--r--src/Text.cpp29
1 files changed, 13 insertions, 16 deletions
diff --git a/src/Text.cpp b/src/Text.cpp
index ee6bd55..171bd70 100644
--- a/src/Text.cpp
+++ b/src/Text.cpp
@@ -13,7 +13,6 @@
namespace QuickMedia
{
static const float TAB_WIDTH = 4.0f;
- static const sf::Color URL_COLOR(15, 192, 252);
static const float WORD_WRAP_MIN_SIZE = 80.0f;
size_t StringViewUtf32::find(const StringViewUtf32 &other, size_t offset) const {
@@ -34,7 +33,6 @@ namespace QuickMedia
characterSize(_characterSize),
maxWidth(_maxWidth),
color(sf::Color::White),
- urlColor(URL_COLOR),
dirty(true),
dirtyText(false),
dirtyCaret(false),
@@ -359,6 +357,7 @@ namespace QuickMedia
} else if(textElement.text_type == TextElement::TextType::EMOJI) {
vertices_index = 2;
textElement.position = glyphPos;
+ sf::Color emoji_color(255, 255, 255, color.a);
for(size_t i = 0; i < textElement.text.size; ++i)
{
sf::Uint32 codePoint = textElement.text[i];
@@ -376,12 +375,12 @@ namespace QuickMedia
sf::Vector2f textureBottomLeft(emoji_rec.x, emoji_rec.y + emoji_rec.height);
sf::Vector2f textureBottomRight(emoji_rec.x + emoji_rec.width, emoji_rec.y + emoji_rec.height);
- vertices[vertices_index].append({ vertexTopRight, sf::Color::White, textureTopRight });
- vertices[vertices_index].append({ vertexTopLeft, sf::Color::White, textureTopLeft });
- vertices[vertices_index].append({ vertexBottomLeft, sf::Color::White, textureBottomLeft });
- vertices[vertices_index].append({ vertexBottomLeft, sf::Color::White, textureBottomLeft });
- vertices[vertices_index].append({ vertexBottomRight, sf::Color::White, textureBottomRight });
- vertices[vertices_index].append({ vertexTopRight, sf::Color::White, textureTopRight });
+ vertices[vertices_index].append({ vertexTopRight, emoji_color, textureTopRight });
+ vertices[vertices_index].append({ vertexTopLeft, emoji_color, textureTopLeft });
+ vertices[vertices_index].append({ vertexBottomLeft, emoji_color, textureBottomLeft });
+ vertices[vertices_index].append({ vertexBottomLeft, emoji_color, textureBottomLeft });
+ vertices[vertices_index].append({ vertexBottomRight, emoji_color, textureBottomRight });
+ vertices[vertices_index].append({ vertexTopRight, emoji_color, textureTopRight });
glyphPos.x += std::floor(emoji_rec.width * get_ui_scale()) + characterSpacing;
vertices_linear.push_back({vertices_index, vertexStart, 0, codePoint});
@@ -474,14 +473,12 @@ namespace QuickMedia
sf::Vector2f textureBottomLeft(glyph.textureRect.left, glyph.textureRect.top + glyph.textureRect.height);
sf::Vector2f textureBottomRight(glyph.textureRect.left + glyph.textureRect.width, glyph.textureRect.top + glyph.textureRect.height);
- sf::Color fontColor = (textElement.type == TextElement::Type::TEXT ? color : urlColor);
-
- vertices[vertices_index].append({ vertexTopRight, fontColor, textureTopRight });
- vertices[vertices_index].append({ vertexTopLeft, fontColor, textureTopLeft });
- vertices[vertices_index].append({ vertexBottomLeft, fontColor, textureBottomLeft });
- vertices[vertices_index].append({ vertexBottomLeft, fontColor, textureBottomLeft });
- vertices[vertices_index].append({ vertexBottomRight, fontColor, textureBottomRight });
- vertices[vertices_index].append({ vertexTopRight, fontColor, textureTopRight });
+ vertices[vertices_index].append({ vertexTopRight, color, textureTopRight });
+ vertices[vertices_index].append({ vertexTopLeft, color, textureTopLeft });
+ vertices[vertices_index].append({ vertexBottomLeft, color, textureBottomLeft });
+ vertices[vertices_index].append({ vertexBottomLeft, color, textureBottomLeft });
+ vertices[vertices_index].append({ vertexBottomRight, color, textureBottomRight });
+ vertices[vertices_index].append({ vertexTopRight, color, textureTopRight });
glyphPos.x += glyph.advance + characterSpacing;
vertices_linear.push_back({vertices_index, vertexStart, 0, codePoint});