From 44e66882f6e517b06522cb1e510ed9dea7574273 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sat, 21 Nov 2020 18:20:00 +0100 Subject: Render emoji in text, do not show notification count for cache sync, lazy load 4chan board --- src/FontLoader.cpp | 52 ---------------------------------------------------- 1 file changed, 52 deletions(-) delete mode 100644 src/FontLoader.cpp (limited to 'src/FontLoader.cpp') diff --git a/src/FontLoader.cpp b/src/FontLoader.cpp deleted file mode 100644 index ca33377..0000000 --- a/src/FontLoader.cpp +++ /dev/null @@ -1,52 +0,0 @@ -#include "../include/FontLoader.hpp" -#include -#include -#include - -static std::array, 3> font_cache; - -namespace QuickMedia::FontLoader { - sf::Font* get_font(FontType font_type) { - sf::Font *font = font_cache[(size_t)font_type].get(); - if(!font) { - auto new_font = std::make_unique(); - std::vector noto_directories; - std::string font_file_name; - switch(font_type) { - case FontType::LATIN: { - noto_directories.push_back("/usr/share/fonts/noto"); - noto_directories.push_back("/usr/share/fonts/truetype/noto"); - font_file_name = "NotoSans-Regular.ttf"; - break; - } - case FontType::LATIN_BOLD: { - noto_directories.push_back("/usr/share/fonts/noto"); - noto_directories.push_back("/usr/share/fonts/truetype/noto"); - font_file_name = "NotoSans-Bold.ttf"; - break; - } - case FontType::CJK: { - noto_directories.push_back("/usr/share/fonts/noto-cjk"); - noto_directories.push_back("/usr/share/fonts/truetype/noto-cjk"); - font_file_name = "NotoSansCJK-Regular.ttc"; - break; - } - case FontType::EMOJI: { - noto_directories.push_back("/usr/share/fonts/noto"); - noto_directories.push_back("/usr/share/fonts/truetype/noto"); - font_file_name = "NotoColorEmoji.ttf"; - break; - } - } - - for(const std::string ¬o_dir : noto_directories) { - if(new_font->loadFromFile(noto_dir + "/" + font_file_name)) - break; - } - - font_cache[(size_t)font_type] = std::move(new_font); - font = font_cache[(size_t)font_type].get(); - } - return font; - } -} \ No newline at end of file -- cgit v1.2.3