2023-11-28 13:52:26 +01:00
|
|
|
#include <imgui_internal.h>
|
2023-11-28 01:55:41 +01:00
|
|
|
#include <hex/api/imhex_api.hpp>
|
|
|
|
|
|
|
|
#include <romfs/romfs.hpp>
|
|
|
|
|
|
|
|
#include <hex/helpers/utils.hpp>
|
|
|
|
|
|
|
|
#include <fonts/fontawesome_font.h>
|
|
|
|
#include <fonts/codicons_font.h>
|
|
|
|
|
2023-11-28 13:52:26 +01:00
|
|
|
#include <imgui_freetype.h>
|
|
|
|
|
2023-11-28 01:55:41 +01:00
|
|
|
namespace hex::plugin::builtin {
|
|
|
|
|
|
|
|
void loadFonts() {
|
2023-11-28 13:52:26 +01:00
|
|
|
using namespace ImHexApi::Fonts;
|
|
|
|
|
2023-11-28 10:37:38 +01:00
|
|
|
/**
|
|
|
|
* !!IMPORTANT!!
|
|
|
|
* Always load the font files in decreasing size of their glyphs. This will make the rasterize be more
|
|
|
|
* efficient when packing the glyphs into the font atlas and therefor make the atlas much smaller.
|
|
|
|
*/
|
|
|
|
|
2023-11-28 13:52:26 +01:00
|
|
|
ImHexApi::Fonts::loadFont("Font Awesome 5", romfs::get("fonts/fontawesome.otf").span<u8>(),
|
|
|
|
{
|
|
|
|
{ glyph(ICON_FA_BACKSPACE), glyph(ICON_FA_INFINITY), glyph(ICON_FA_TACHOMETER_ALT), glyph(ICON_FA_MICROCHIP), glyph(ICON_FA_CODE_BRANCH) }
|
|
|
|
},
|
2023-11-29 09:50:57 +01:00
|
|
|
{ 0, 0 });
|
2023-11-28 13:52:26 +01:00
|
|
|
|
|
|
|
ImHexApi::Fonts::loadFont("VS Codicons", romfs::get("fonts/codicons.ttf").span<u8>(),
|
|
|
|
{
|
|
|
|
{ ICON_MIN_VS, ICON_MAX_VS }
|
|
|
|
},
|
2023-11-29 11:02:14 +01:00
|
|
|
{ 0, -1_scaled });
|
2023-11-28 13:52:26 +01:00
|
|
|
|
|
|
|
ImHexApi::Fonts::loadFont("Unifont", romfs::get("fonts/unifont.otf").span<u8>());
|
2023-11-28 01:55:41 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|