diff options
author | dec05eba <dec05eba@protonmail.com> | 2022-11-07 01:11:18 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2022-11-07 14:24:32 +0100 |
commit | f791d96362cbe7ef8435e999adaaf05e6f2683a5 (patch) | |
tree | 08daae7bd47d11ea7a6fdaa47f95db8b48435514 | |
parent | ede1a8476acd54941c20b809455ba62b30302a4e (diff) |
Fix some emoji that end with fe0f
-rw-r--r-- | src/Text.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/Text.cpp b/src/Text.cpp index e67d879..ed972e0 100644 --- a/src/Text.cpp +++ b/src/Text.cpp @@ -7,6 +7,7 @@ #include "../generated/Emoji.hpp" #include <string.h> #include <stack> +#include <unistd.h> #include <mglpp/graphics/Rectangle.hpp> #include <mglpp/window/Event.hpp> #include <mglpp/window/Window.hpp> @@ -509,6 +510,11 @@ namespace QuickMedia text_element.create_text(std::string_view(str.data() + index, offset)); text_element.text_type = TextElement::TextType::EMOJI; text_element.url = "/usr/share/quickmedia/emoji/" + emoji_codepoint_combined + ".png"; + // Some emoji do not work with the -fe0f variant + if(emoji_sequence_length > 0 && emoji_sequence[emoji_sequence_length - 1] == 0xfe0f && access(text_element.url.c_str(), F_OK) != 0) { + emoji_codepoint_combined.erase(emoji_codepoint_combined.end() - 5, emoji_codepoint_combined.end()); + text_element.url = "/usr/share/quickmedia/emoji/" + emoji_codepoint_combined + ".png"; + } text_element.local = true; text_element.size = { (int)vspace, (int)vspace }; text_element.text_num_bytes = emoji_byte_length; |