Now uses embedded resources

This commit is contained in:
Antoine Pilote
2023-09-26 20:43:56 -04:00
parent 96bed6351e
commit ff4489a466
107 changed files with 191024 additions and 786 deletions

View File

@@ -3,6 +3,7 @@
#include <src/Vendors/imgui/imgui.h>
#include <src/Resource/FontAwesome5.h>
#include <src/Resource/StaticResources.h>
std::map<Fonts, ImFont*> FontManager::mFonts = std::map<Fonts, ImFont*>();
void FontManager::LoadFonts()
@@ -11,14 +12,24 @@ void FontManager::LoadFonts()
static const ImWchar icons_ranges[] = { ICON_MIN_FA, ICON_MAX_FA, 0 };
ImFontConfig icons_config; icons_config.MergeMode = true; icons_config.PixelSnapH = true;
mFonts[Normal] = io.Fonts->AddFontFromFileTTF("resources/Fonts/fa-solid-900.ttf", 11.0f, &icons_config, icons_ranges);
mFonts[Bold] = io.Fonts->AddFontFromFileTTF("resources/Fonts/FiraMono-Bold.ttf", 16.0);
mFonts[LargeBold] = io.Fonts->AddFontFromFileTTF("resources/Fonts/FiraMono-Regular.ttf", 32);
mFonts[Title] = io.Fonts->AddFontFromFileTTF("resources/Fonts/FiraMono-Bold.ttf", 50.0);
mFonts[SubTitle] = io.Fonts->AddFontFromFileTTF("resources/Fonts/FiraMono-Regular.ttf", 24.0);
using namespace Nuake::StaticResources;
mFonts[Normal] = io.Fonts->AddFontFromMemoryTTF(Resources_Fonts_fa_solid_900_ttf, Resources_Fonts_fa_solid_900_ttf_len, 11.f, &icons_config, icons_ranges);
ImFontConfig iconsConfigBold;
icons_config.PixelSnapH = true;
mFonts[Bold] = io.Fonts->AddFontFromMemoryTTF(Resources_Fonts_FiraMono_Bold_ttf, Resources_Fonts_FiraMono_Bold_ttf_len, 16.0);
iconsConfigBold.MergeMode = true;
io.Fonts->AddFontFromMemoryTTF(Resources_Fonts_fa_solid_900_ttf, Resources_Fonts_fa_solid_900_ttf_len, 16.f, &iconsConfigBold, icons_ranges);
iconsConfigBold.MergeMode = false;
mFonts[LargeBold] = io.Fonts->AddFontFromMemoryTTF(Resources_Fonts_FiraMono_Regular_ttf, Resources_Fonts_FiraMono_Regular_ttf_len, 32);
mFonts[Title] = io.Fonts->AddFontFromMemoryTTF(Resources_Fonts_FiraMono_Bold_ttf, Resources_Fonts_FiraMono_Bold_ttf_len, 50.0);
mFonts[SubTitle] = io.Fonts->AddFontFromMemoryTTF(Resources_Fonts_FiraMono_Regular_ttf, Resources_Fonts_FiraMono_Regular_ttf_len, 24.0);
ImGui::GetIO().Fonts->AddFontDefault();
icons_config.MergeMode = true;
mFonts[BigIcon] = io.Fonts->AddFontFromFileTTF("resources/Fonts/fa-solid-900.ttf", 42.0f, &icons_config, icons_ranges);
mFonts[BigIcon] = io.Fonts->AddFontFromMemoryTTF(Resources_Fonts_fa_solid_900_ttf, Resources_Fonts_fa_solid_900_ttf_len, 42.0f, &icons_config, icons_ranges);
}
ImFont* FontManager::GetFont(Fonts font)